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

Add changelog remote lookup feature #1003

Merged
merged 1 commit into from
Jan 13, 2020
Merged

Add changelog remote lookup feature #1003

merged 1 commit into from
Jan 13, 2020

Conversation

saschagrunert
Copy link
Member

@saschagrunert saschagrunert commented Jan 9, 2020

🎉 With this change we're pretty close to be able to replace the relnotes script and parts of anago with the krel changelog subcommand. Just one TODO left. 😇

Description

We now correctly assume that a non-patch final version needs to have a
remote changelog available and failure if this one does not exist.

We also have to provide the target tag to the changelog subcommand to be
able to find the right release notes generation approach.

The git package has been adapted to contain a more robust way to
retrieve tags for a dedicated branch.

Demo

# A beta version provided. We now expect to generate the notes to the previous tag on the same branch (alpha, beta, rc)
> go run cmd/krel/main.go changelog -t $TOKEN --tars $TARS --tag v1.16.0-beta.2
# ...
INFO Found previous tag v1.16.0-beta.1
INFO Generating release notes
INFO cloning/updating repository to discover start or end sha
INFO using found start SHA: 92639f719ee353219fa2cd19128a93409bb3a1e3
INFO using found end SHA: 48ca054daba9e610f13c6d6bfcedf6c7de12b138
# ...

# A final version provided. We now expect to download the remote notes
> go run cmd/krel/main.go changelog -t $TOKEN --tars $TARS --tag v1.16.0
# ...
INFO Assuming new minor release
INFO Found release notes
# ...

# A patch release provided. We now expect to generate the notes to the previous patch on the same branch
> go run cmd/krel/main.go changelog -t $TOKEN --tars $TARS --tag v1.16.3
# ...
INFO Assuming new patch release
INFO cloning/updating repository to discover start or end sha
INFO using found start SHA: c97fe5036ef3df2967d086711e6c0c405941e14b
INFO using found end SHA: b3cbbae08ec52a7fc73d334838e18d17e8512749
# ...

All three runs will be merged together in one single CHANGELOG-1.16.md file, which looks like this:
https://gist.github.com/saschagrunert/b04e87ebfd7d4e632f91ecd61ed478b7#kubernetes-v1160-release-notes

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 9, 2020
@k8s-ci-robot k8s-ci-robot added 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 sig/release Categorizes an issue or PR as relevant to SIG Release. labels Jan 9, 2020
@saschagrunert
Copy link
Member Author

Had to rebase again :)

@saschagrunert saschagrunert changed the title Add changelog remote lookup feature WIP: Add changelog remote lookup feature Jan 13, 2020
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 13, 2020
We now correctly assume that a non-patch final version needs to have a
remote changelog available and failure if this one does not exist.

We also have to provide the target tag to the changelog subcommand to be
able to find the right release notes generation approach.

The git package has been adapted to contain a more robust way to
retrieve tags for a dedicated branch.

Signed-off-by: Sascha Grunert <[email protected]>
@saschagrunert saschagrunert changed the title WIP: Add changelog remote lookup feature Add changelog remote lookup feature Jan 13, 2020
@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 Jan 13, 2020
@saschagrunert saschagrunert changed the title Add changelog remote lookup feature Add changelog remote lookup feature Jan 13, 2020
@saschagrunert
Copy link
Member Author

Ready for review, PTAL @justaugustus @hoegaarden @hasheddan @cpanato

Comment on lines +174 to +176
notesOptions.Branch = branch
notesOptions.StartRev = startRev
notesOptions.EndRev = endRev
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these required for notesOptions.ValidateAndFinish()? Wondering if some of these options being set in this list could either be passed as parameters to NewOptions() or configured as sane defaults. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes exactly. Yeah we could apply something like a builder pattern for validation... 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

That is exactly what I was thinking :) Given that this does not change functionality, would you prefer for this to be tackled in a follow-up PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

I would like to defer that to a follow-up PR if you don't mind :)

Copy link
Contributor

Choose a reason for hiding this comment

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

SGTM!

Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

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

/lgtm
/hold for more reviews

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 13, 2020
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 13, 2020
Copy link
Contributor

@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.

Thanks for this great work @saschagrunert!

/lgtm

@justaugustus
Copy link
Member

Thanks @saschagrunert!
/lgtm
/approve
/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 Jan 13, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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 355d4a3 into kubernetes:master Jan 13, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.18 milestone Jan 13, 2020
@saschagrunert saschagrunert deleted the changelog-lookup branch January 14, 2020 07:55
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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.

5 participants