Skip to content

Add a patch-to-latest discover mode #1245

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

Merged
merged 1 commit into from
Apr 23, 2020

Conversation

msau42
Copy link
Member

@msau42 msau42 commented Apr 17, 2020

What type of PR is this?

/kind feature

What this PR does / why we need it:

Adds a patch-to-latest discover mode, that generates the release notes from the latest patch release to the top of the release branch.

We use this tool to generate release notes for kubernetes-csi repos. Our release model is to generate the release notes before tagging the release, so the existing "patch-to-patch" doesn't work for us.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Adds "patch-to-latest" discover mode.

@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/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority size/M Denotes a PR that changes 30-99 lines, ignoring generated files. area/release-eng Issues or PRs related to the Release Engineering subproject labels Apr 17, 2020
@k8s-ci-robot k8s-ci-robot requested review from hasheddan and jeefy April 17, 2020 21:05
@k8s-ci-robot k8s-ci-robot added the sig/release Categorizes an issue or PR as relevant to SIG Release. label Apr 17, 2020
@msau42 msau42 force-pushed the add-patch-to-latest branch 2 times, most recently from 27a7974 to 2d26fff Compare April 17, 2020 21:59

result, err := testRepo.sut.LatestPatchToLatest(testRepo.branchName)
require.Nil(t, err)
require.Equal(t, result.StartSHA(), testRepo.firstCommit)
Copy link
Member Author

Choose a reason for hiding this comment

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

This is surprising to me. I expected it to use secondBranchCommit

Copy link
Member

Choose a reason for hiding this comment

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

Yeah maybe the return value of LatestTagForBranch is wrong.

Copy link
Member Author

Choose a reason for hiding this comment

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

So the issue appears to be that TagsForBranch orders the tags not by timestamp, but by tag value, ie: 0.1.1, 0.1.2, 1.17.0 even though they were committed in a different order. I'm not sure if this is an issue with the gogit library or if this is how a real git repo behaves.

Do you expect a scenario where the intermediate tags on a branch are of a completely different major/minor version?

Anyway, what I did was change the v0.1.2 tag to v1.17.1 so that the test branch contains both kinds of tags. Basically, the v0.1.2 tag gets ignored for the most part since it's last in the ordering, and now the test cases work as expected.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good to me, thank you for the test-fix :)

Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

Hey @msau42, thank you for the valuable addition! Let’s just find out why the test did not behave as expected. The rest LGTM


result, err := testRepo.sut.LatestPatchToLatest(testRepo.branchName)
require.Nil(t, err)
require.Equal(t, result.StartSHA(), testRepo.firstCommit)
Copy link
Member

Choose a reason for hiding this comment

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

Yeah maybe the return value of LatestTagForBranch is wrong.

@msau42 msau42 force-pushed the add-patch-to-latest branch 4 times, most recently from 2e0fc9b to b50b09c Compare April 23, 2020 01:22
@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 Apr 23, 2020
@msau42 msau42 force-pushed the add-patch-to-latest branch 2 times, most recently from d19f100 to 044b945 Compare April 23, 2020 02:34
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 23, 2020
… from the latest patch release to the top of the release branch
@msau42 msau42 force-pushed the add-patch-to-latest branch from 044b945 to 1765c99 Compare April 23, 2020 02:39
@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 Apr 23, 2020
Copy link
Member

@saschagrunert saschagrunert 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 Apr 23, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: msau42, 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 23, 2020
@k8s-ci-robot k8s-ci-robot merged commit b764989 into kubernetes:master Apr 23, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.19 milestone Apr 23, 2020
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/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority 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.

3 participants