Skip to content

Include revert PR instead of the reverted one in release notes #3974

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

Conversation

IrvingMg
Copy link
Contributor

@IrvingMg IrvingMg commented Apr 7, 2025

What type of PR is this?

/kind bug

What this PR does / why we need it:

As described in #3966, the release notes include the reverted PRs instead of the revert PRs.

Which issue(s) this PR fixes:

Fixes #3966

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Fix release notes to include the revert PR instead of the reverted one.

@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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/release-eng Issues or PRs related to the Release Engineering subproject labels Apr 7, 2025
@k8s-ci-robot k8s-ci-robot requested a review from jimangel April 7, 2025 19:24
@k8s-ci-robot k8s-ci-robot requested a review from salaxander April 7, 2025 19:24
@k8s-ci-robot k8s-ci-robot added the sig/release Categorizes an issue or PR as relevant to SIG Release. label Apr 7, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @IrvingMg. Thanks for your PR.

I'm waiting for a kubernetes 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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 7, 2025
@IrvingMg
Copy link
Contributor Author

IrvingMg commented Apr 7, 2025

/cc @mimowo

@k8s-ci-robot k8s-ci-robot requested a review from mimowo April 7, 2025 19:25
@mimowo
Copy link

mimowo commented Apr 8, 2025

/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 Apr 8, 2025
@@ -1136,6 +1136,13 @@ func prsNumForCommitFromMessage(commitMessage string) (prs []int, err error) {
prs = append(prs, pr)
}

regex = regexp.MustCompile(`\(#(?P<number>\d+)\)\s*\n\nThis reverts commit`)
Copy link

@mimowo mimowo Apr 8, 2025

Choose a reason for hiding this comment

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

This seems to anchor the message produced by the "git revert" command: https://github.com/git/git/blob/9d22ac51228304102deb62f30c3ecba6377e1237/sequencer.c#L2366

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct. I've added the \(#(?P<number>\d+)\)\s*\n\n part so that we can retrieve the last PR number that appears in the commit message

Copy link
Member

Choose a reason for hiding this comment

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

not new to this PR, but it would be helpful to use descriptive names (and comments!) instead of repeatedly using the regex variable to do different unrelated things.


pr = prForRegex(regex, commitMessage)
if pr != 0 {
prs = append(prs, pr)
Copy link

@mimowo mimowo Apr 8, 2025

Choose a reason for hiding this comment

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

This is adding a new pr onto the list, and so it is not immediately clear to me, can you explain why this fixes the issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I understood correctly, the function prsNumForCommitFromMessage retrieves all the PR numbers included in the commit message. Then, later in the notesForCommit function, we iterate over the list of PRs until we find one with a valid release note. Once a valid note is found, we stop the iteration and ignore the remaining PRs.

Currently, revert commits—which contain multiple PR numbers in the message—are handled as regular squashed commits, and the PR number retrieved is the first one that appears. By adding this regex, we prepend the last PR number from the message to the PRs list. So if that PR has a release note, the notesForCommit function will retrieve it and stop, ignoring the rest.

Copy link

Choose a reason for hiding this comment

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

I see, thanks for the explanation.

@mimowo
Copy link

mimowo commented Apr 8, 2025

LGTM
/assign @saschagrunert
PTAL

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: IrvingMg, 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:

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 Apr 9, 2025
@k8s-ci-robot k8s-ci-robot merged commit 7808a30 into kubernetes:master Apr 9, 2025
11 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.33 milestone Apr 9, 2025
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/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. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[script] Generation of release notes picks up reverted PR instead of the PR which reverts it
5 participants