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

Adding support for removing branch #382

Merged

Conversation

mohitsharma-in
Copy link

Adding support for removing branch
Fixes #377

Cc: @akhilerm

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 19, 2023
@akhilerm
Copy link
Member

/cc @akhilerm

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 19, 2023
@mohitsharma-in mohitsharma-in force-pushed the adding-branch-removal-support branch 2 times, most recently from 7d2353d to 5239145 Compare September 21, 2023 06:54
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 21, 2023
Adding support for removing branch
@mohitsharma-in mohitsharma-in changed the title [WIP] Adding support for removing branch Adding support for removing branch Sep 22, 2023
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 22, 2023
@mohitsharma-in
Copy link
Author

@akhilerm Please Review

Copy link
Member

@akhilerm akhilerm left a comment

Choose a reason for hiding this comment

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

Provided a few comments.

.gitignore Outdated Show resolved Hide resolved
cmd/update-rules/README.md Outdated Show resolved Hide resolved
cmd/update-rules/README.md Outdated Show resolved Hide resolved
cmd/update-rules/README.md Outdated Show resolved Hide resolved
cmd/update-rules/README.md Outdated Show resolved Hide resolved
cmd/update-rules/main.go Outdated Show resolved Hide resolved
cmd/update-rules/main.go Outdated Show resolved Hide resolved
@akhilerm
Copy link
Member

akhilerm commented Oct 5, 2023

@mohitsharma-in kubernetes/kubernetes#120822 has been merged. So now you wont see the diff in the rules related to the new field.

@akhilerm
Copy link
Member

@mohitsharma-in Is this ready for review ?

@mohitsharma-in
Copy link
Author

mohitsharma-in commented Oct 26, 2023

@mohitsharma-in Is this ready for review ?

@akhilerm
Please review the code i will update readme once the code is good

Copy link
Member

@akhilerm akhilerm left a comment

Choose a reason for hiding this comment

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

Given a few comments.

.gitignore Outdated Show resolved Hide resolved
cmd/update-rules/main.go Outdated Show resolved Hide resolved
cmd/update-rules/main.go Outdated Show resolved Hide resolved
cmd/update-rules/main.go Outdated Show resolved Hide resolved
@mohitsharma-in mohitsharma-in force-pushed the adding-branch-removal-support branch 3 times, most recently from 371aea9 to 69f351f Compare October 31, 2023 11:28
.idea/workspace.xml Outdated Show resolved Hide resolved
bin/golangci-lint Outdated Show resolved Hide resolved
test-update-rule/new-rules.yaml Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 27, 2023
@mohitsharma-in mohitsharma-in force-pushed the adding-branch-removal-support branch 2 times, most recently from 24490f5 to aa70fd9 Compare November 27, 2023 13:19
Copy link
Member

@akhilerm akhilerm left a comment

Choose a reason for hiding this comment

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

A few changes are needed on the test cases.

Sorry @mohitsharma-in I missed to review the test file during the last round of review.

Comment on lines 174 to 176
"release-1.20",
"release-1.XY",
"1.17.1",
Copy link
Member

Choose a reason for hiding this comment

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

A few changes are needed on the tests.

  1. Can you give a proper name to the test?
  2. Since release-1.XY does not exist in the testdata/rules.yaml, if we try to delete that branch, the test will always pass. We need to add another case in which we try to delete a branch that already exists in the rules.yaml file and make sure that after the UpdateRules() func, the branch is properly deleted.

Copy link
Author

Choose a reason for hiding this comment

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

fixed 1 and 2
For 2 point we already have a loop which checks and returns error if branch is not deleted

Copy link
Member

Choose a reason for hiding this comment

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

We need the inverse of that also, Like to make sure that there are no changes to any of the rules. see the below comment.

cmd/update-rules/main_test.go Outdated Show resolved Hide resolved
cmd/update-rules/main_test.go Outdated Show resolved Hide resolved
cmd/update-rules/main_test.go Outdated Show resolved Hide resolved
}
UpdateRules(rules, tt.branch, tt.goVersion, true)

for _, repoRule := range rules.Rules {
Copy link
Member

Choose a reason for hiding this comment

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

One more check needs to be done to make sure that, if the branch to be deleted was a non-existent branch, there are no changes to the rules that has been loaded from testdataRules

Copy link
Author

Choose a reason for hiding this comment

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

we have the error logged in the below loop for the same if it failed to delete the branch do you mean should we check if branch exist or not instead before deleting?

Copy link
Member

Choose a reason for hiding this comment

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

we have the error logged in the below loop for the same if it failed to delete the branch

this is correct.

do you mean should we check if branch exist or not instead before deleting?

no. The test should check that, if a non existent branch is tried for deletion, it doesnt affect rest of the rules.

Copy link
Author

Choose a reason for hiding this comment

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

Do you have and recommendations around this

@mohitsharma-in
Copy link
Author

/retest

@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 Dec 18, 2023
cmd/update-rules/main.go Outdated Show resolved Hide resolved
Copy link
Member

@akhilerm akhilerm left a comment

Choose a reason for hiding this comment

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

/lgtm
/assign @dims @nikhita for approval

@k8s-ci-robot
Copy link
Contributor

@akhilerm: GitHub didn't allow me to assign the following users: for, approval.

Note that only kubernetes members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

/lgtm
/assign @dims @nikhita for approval

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 the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 18, 2023
@dims
Copy link
Member

dims commented Jan 2, 2024

/approve
/lgtm

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: akhilerm, dims, mohitsharma-in

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 Jan 2, 2024
@k8s-ci-robot k8s-ci-robot merged commit 3cb4242 into kubernetes:master Jan 2, 2024
7 checks passed
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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.

Add support for removing branches in update-rules
5 participants