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

Remove dead checks in image promoter #796

Merged
merged 2 commits into from
Mar 28, 2023

Conversation

jonjohnsonjr
Copy link
Contributor

These are only called by tests. This also hides a flag that was unused (for image size).

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

This removes a bunch of dead code to make it easier to understand what's going on in the promoter.

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

I'm sorry.

Does this PR introduce a user-facing change?

NONE

/cc @puerco

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 27, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @jonjohnsonjr. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 k8s-ci-robot added sig/release Categorizes an issue or PR as relevant to SIG Release. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 27, 2023
@puerco
Copy link
Member

puerco commented Mar 27, 2023

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 27, 2023
Copy link
Member

@puerco puerco left a comment

Choose a reason for hiding this comment

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

I'm leaving this comment here for future reference if we need this test again 👇

Comment on lines -96 to -145
// Run executes ImageRemovalCheck on a set of promotion edges.
// Returns an error if the pull request removes images from the
// promoter manifests.
func (check *ImageRemovalCheck) Run() error {
r, err := gogit.PlainOpen(check.GitRepoPath)
if err != nil {
return fmt.Errorf("could not open the Git repo: %v", err)
}
w, err := r.Worktree()
if err != nil {
return fmt.Errorf("could not create Git worktree: %v", err)
}

// The Prow job that this check is running in has already cloned the
// git repo for us so we can just checkout the master branch to get the
// master branch's version of the promoter manifests.
err = w.Checkout(&gogit.CheckoutOptions{
Hash: check.MasterSHA,
Force: true,
})
if err != nil {
return fmt.Errorf("could not checkout the master branch of the Git"+
" repo: %v", err)
}

mfests, err := schema.ParseThinManifestsFromDir(check.GitRepoPath, false)
if err != nil {
return fmt.Errorf("could not parse manifests from the directory: %v",
err)
}
masterEdges, err := ToPromotionEdges(mfests)
if err != nil {
return fmt.Errorf("could not generate promotion edges from promoter"+
" manifests: %v", err)
}

// Reset the current directory back to the pull request branch so that this
// check doesn't leave lasting effects that could affect subsequent checks.
err = w.Checkout(&gogit.CheckoutOptions{
Hash: check.PullRequestSHA,
Force: true,
})
if err != nil {
return fmt.Errorf("could not checkout the pull request branch of the"+
" Git repo %v: %v",
check.GitRepoPath, err)
}

return check.Compare(masterEdges, check.PullEdges)
}
Copy link
Member

Choose a reason for hiding this comment

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

This check actually seems useful to have if it works. I wonder why it was never instrumented anywhere 🤔

Since we are not using it, let's dump it to push towards an easier codebase and we can revert it if we need it in the future. We also need to ensure that our practices are in line with not allowing deletions, I seem to remember we've had some due to typos and such.

@puerco
Copy link
Member

puerco commented Mar 28, 2023

The linter failed, but otherwise lgtm

@puerco
Copy link
Member

puerco commented Mar 28, 2023

/retest required

@k8s-ci-robot
Copy link
Contributor

@puerco: The /retest command does not accept any targets.
The following commands are available to trigger required jobs:

  • /test pull-cip-auditor-e2e
  • /test pull-cip-e2e
  • /test pull-cip-image-cip
  • /test pull-cip-unit-tests
  • /test pull-cip-verify
  • /test pull-cip-verify-archives

Use /test all to run all jobs.

In response to this:

/retest required

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.

@puerco
Copy link
Member

puerco commented Mar 28, 2023

/test all

@puerco
Copy link
Member

puerco commented Mar 28, 2023

it looks like it needs a rebase, weird that prow didn't catch it

@jonjohnsonjr
Copy link
Contributor Author

$ PWD=/home/prow/go/src/sigs.k8s.io/promo-tools git fetch https://github.com/kubernetes-sigs/promo-tools.git dead-checks (runtime: 5.430497836s)
fatal: couldn't find remote ref dead-checks

Weird that it's trying to fetch this branch from this repo and not my fork?

These are only called by tests. This also hides a flag that was unused
(for image size).

Signed-off-by: Jon Johnson <jonjohnsonjr@gmail.com>
Signed-off-by: Jon Johnson <jonjohnsonjr@gmail.com>
@puerco
Copy link
Member

puerco commented Mar 28, 2023

what.is.this .. :|

@puerco
Copy link
Member

puerco commented Mar 28, 2023

Weird that it's trying to fetch this branch from this repo and not my fork?

Ah yeah at the bottom. wtf.

@eddiezane
Copy link
Member

@puerco
Copy link
Member

puerco commented Mar 28, 2023

A revert to prow is going on here: kubernetes/test-infra#29167

@jonjohnsonjr
Copy link
Contributor Author

/retest

1 similar comment
@jonjohnsonjr
Copy link
Contributor Author

/retest

@puerco
Copy link
Member

puerco commented Mar 28, 2023

Great, in it goes!
/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 28, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jonjohnsonjr, puerco

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:

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 28, 2023
@k8s-ci-robot k8s-ci-robot merged commit 8466cd0 into kubernetes-sigs:main Mar 28, 2023
@jonjohnsonjr jonjohnsonjr deleted the dead-checks branch March 28, 2023 17:38
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/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. sig/release Categorizes an issue or PR as relevant to SIG Release. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants