Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/cip: Default to non-production runs with --confirm #285

Merged
merged 3 commits into from
Sep 14, 2021

Conversation

justaugustus
Copy link
Contributor

@justaugustus justaugustus commented Dec 1, 2020

What type of PR is this?

/kind bug regression
/priority critical-urgent

What this PR does / why we need it:

  • test-e2e: Minor cleanup for cmp.Diff() output

  • cmd/cip: Use --confirm instead of --dry-run

    Similar to our --nomock flags for other tools, we use a --confirm
    flag for cip, since the default nil value for booleans is false.

    Meaning: If --dry-run is not explicitly set to true, our tooling
    will initiate an image promotion.

  • Flip confirm logic in cip/cip-auditor e2e MakeSyncContext() calls

/assign @hasheddan @xmudrii
cc: @kubernetes-sigs/release-engineering

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?

- cmd/cip: Use `--confirm` instead of `--dry-run`

  Similar to our `--nomock` flags for other tools, we use a `--confirm`
  flag for `cip`, since the default nil value for booleans is `false`.
  
  Meaning: If `--dry-run` is not explicitly set to `true`, our tooling
  will initiate an image promotion.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. kind/regression Categorizes issue or PR as related to a regression from a prior release. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 1, 2020
@k8s-ci-robot k8s-ci-robot requested review from dims and tpepper December 1, 2020 00:48
@k8s-ci-robot k8s-ci-robot added sig/release Categorizes an issue or PR as relevant to SIG Release. approved Indicates a PR has been approved by an approver from all required OWNERS files. wg/k8s-infra size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 1, 2020
@justaugustus
Copy link
Contributor Author

(Needed to flip the flag in the e2e test as well. Fixed in 6a5b04a.)

@justaugustus
Copy link
Contributor Author

justaugustus commented Dec 1, 2020

checking snapshots BEFORE promotion:
execing cmd bazel [run --workspace_status_command=/home/prow/go/src/sigs.k8s.io/k8s-container-image-promoter/workspace_status.sh //cmd/cip:cip -- run --snapshot=us.gcr.io/k8s-cip-test-prod/golden-bar]
time="2020-12-01T00:58:09Z" level=fatal msg="<<<<<<< got (type []inventory.Image)\n[{bar map[sha256:610b1ef6fec876146dee2b2846c890b566d26f235d7ea8982056a3e84bd35929:[1.0]]}]\n=======\n[]\n>>>>>>> expected (type []inventory.Image)" 

???

grumbles
/test pull-cip-e2e

@justaugustus
Copy link
Contributor Author

Local run:

$ time bazel run --workspace_status_command=$(pwd)/workspace_status.sh //cmd/cip:cip -- run --snapshot=us.gcr.io/k8s-cip-test-prod/golden-bar
INFO: Analyzed target //cmd/cip:cip (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //cmd/cip:cip up-to-date:
  bazel-bin/cmd/cip/cip_/cip
INFO: Elapsed time: 2.650s, Critical Path: 2.49s
INFO: 13 processes: 13 linux-sandbox.
INFO: Build completed successfully, 14 total actions
INFO: Build completed successfully, 14 total actions
INFO Request {us.gcr.io/k8s-cip-test-prod/golden-bar   true}: OK 
INFO Request {us.gcr.io/k8s-cip-test-prod/golden-bar/bar   false}: OK 
- name: bar
  dmap:
    "sha256:610b1ef6fec876146dee2b2846c890b566d26f235d7ea8982056a3e84bd35929": ["1.0"]

real	0m4.111s
user	0m0.125s
sys	0m0.064s

@justaugustus
Copy link
Contributor Author

Oh hello, auditor flake?
/test pull-cip-auditor-e2e

Copy link

@hasheddan hasheddan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 1, 2020
@saschagrunert
Copy link
Member

/retest

@saschagrunert
Copy link
Member

The CI issue seems reproducible to me. 🤔

@k8s-ci-robot k8s-ci-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 2, 2020
@listx
Copy link
Contributor

listx commented Aug 16, 2021

I feel like maybe it used default to true and then somewhere in the churn of #273 that got lost?

Yeah that seems likely. FTR every deployed instance of CIP in recent memory (including the current version v2.4.1 that's seeing presubmit/postsubmit usage) has always had --dry-run=true as the default.

@justaugustus
Copy link
Contributor Author

Yeah that seems likely. FTR every deployed instance of CIP in recent memory (including the current version v2.4.1 that's seeing presubmit/postsubmit usage) has always had --dry-run=true as the default.

Right, we haven't changed the actual cip run invocations for CI jobs, but the default behavior/underlying implementation is what needs to be fixed.

@justaugustus
Copy link
Contributor Author

Just to capture some things from Slack:

This line creates a new set of options:
https://github.com/kubernetes-sigs/k8s-container-image-promoter/blob/97e351eb08d2af791f1a62ead66e5291398c4f0b/cmd/cip/cmd/root.go#L38

The options themselves: https://github.com/kubernetes-sigs/k8s-container-image-promoter/blob/97e351eb08d2af791f1a62ead66e5291398c4f0b/legacy/cli/root.go#L25-L28

If --dry-run is never set, it will be its nil value, which is false AKA unconditional promotion, which is what we don't want.
We'll proceed w/ --confirm as the flag name (to improve readability and make it a little more consistent with other tools across the community).

@justaugustus
Copy link
Contributor Author

(rebasing for handoff)
I've asked @puerco to take over this branch/work in https://kubernetes.slack.com/archives/CJH2GBF7Y/p1631539082071700.
/assign @puerco

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 13, 2021
Flag changed from `dry-run` to `confirm` so we flip the logic in
MakeSyncContext(). Prior to this, test registries were not cleared
as the delete invocation was running in dry run (or confirm = false).

Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
@justaugustus
Copy link
Contributor Author

@puerco -- Nice work! 🎉
/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 14, 2021
@justaugustus justaugustus changed the title Default dry run cmd/cip: Default to non-production runs with --confirm Sep 14, 2021
@puerco
Copy link
Member

puerco commented Sep 14, 2021

Reviewing @justaugustus commits :)
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 14, 2021
@justaugustus
Copy link
Contributor Author

Symbolic LGTM for @puerco's fixes (even though the bot will yell at me):
/lgtm
/approve
/honk

@k8s-ci-robot
Copy link
Contributor

@justaugustus: you cannot LGTM your own PR.

In response to this:

Symbolic LGTM for @puerco's fixes (even though the bot will yell at me):
/lgtm
/approve
/honk

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot
Copy link
Contributor

@justaugustus:
goose image

In response to this:

Symbolic LGTM for @puerco's fixes (even though the bot will yell at me):
/lgtm
/approve
/honk

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hasheddan, justaugustus, saschagrunert

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [justaugustus,saschagrunert]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 17c63b1 into kubernetes-sigs:master Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/artifacts Issues or PRs related to the hosting of release artifacts for subprojects area/release-eng Issues or PRs related to the Release Engineering subproject cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. kind/regression Categorizes issue or PR as related to a regression from a prior release. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/release Categorizes an issue or PR as relevant to SIG Release. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants