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 automation to create release branch and tags #9111

Merged
merged 2 commits into from
Aug 21, 2023

Conversation

CecileRobertMichon
Copy link
Contributor

@CecileRobertMichon CecileRobertMichon commented Aug 2, 2023

What this PR does / why we need it: This adds automated release branch and release tags creation via the release github action to enable the CAPI release team to cut releases without needing the maintainers to cut the releases (maintainers still need to be involved to manually hit the "publish" button and to review the release notes PR).

The process becomes as follows:

  • Release team (docs/comms manager) opens a PR to add the auto-generated and manually revised release notes for the upcoming release on the main branch
  • Release team (lead/everyone) and maintainers review and merge the PR
  • Commit on main branch triggers the Create Release Action which will:
    1. Validate the release version
    2. Create a release branch
    3. Create and push release tags
    4. Generate release artifacts
    5. Create a draft release from the tag with artifacts and the checked in release notes

This was tested extensively in my own fork with a different branch and fake/tags, you can see the latest passing run here

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #7128

@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 Aug 2, 2023
@CecileRobertMichon
Copy link
Contributor Author

/cc @kubernetes-sigs/cluster-api-release-team
/cc @kubernetes-sigs/cluster-api-maintainers

@k8s-ci-robot
Copy link
Contributor

@CecileRobertMichon: GitHub didn't allow me to request PR reviews from the following users: kubernetes-sigs/cluster-api-release-team.

Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @kubernetes-sigs/cluster-api-release-team
/cc @kubernetes-sigs/cluster-api-maintainers

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 requested a review from a team August 2, 2023 23:51
CHANGELOG/OWNERS Outdated Show resolved Hide resolved

1. Checkout the latest commit on the release branch, e.g. `release-1.4`.
1. Checkout the latest commit on the main branch.
Copy link
Contributor Author

@CecileRobertMichon CecileRobertMichon Aug 2, 2023

Choose a reason for hiding this comment

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

this is important: the notes must be generated from and checked into the main branch

In theory this should work for all types of releases (alpha, beta, rc, .0, and patch) and I ran through all the scenarios but let me know if you can think of any issues with this...

We always checkout the release branch and fetch the release notes file from the CHANGELOG folder in the main branch in the GH action.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure how this target would pick up the RELEASE_TAG env var:

release-notes: $(RELEASE_NOTES_DIR) $(RELEASE_NOTES)
	if [ -n "${PRE_RELEASE}" ]; then \
	echo ":rotating_light: This is a RELEASE CANDIDATE. Use it only for testing purposes. If you find any bugs, file an [issue](https://github.com/kubernetes-sigs/cluster-api/issues/new)." > $(RELEASE_NOTES_DIR)/$(RELEASE_TAG).md; \
	else \
	go run ./hack/tools/release/notes.go --from=$(PREVIOUS_TAG) > $(RELEASE_NOTES_DIR)/$(RELEASE_TAG).md; \
	fi

It always seems to generate notes from PREVIOUS_TAG until current commit?

I'm probably missing something

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good question. @nawazkh @furkatgofurov7 does notes.go always need to be run from the commit we're releasing from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I checked and you were correct @sbueringer, the notes tool will generate notes from PREVIOUS_TAG to HEAD so this means base notes need to be generated from the release branch still, clarified the instructions.

The PR should still be open in the main branch.

		commitRange = lastTag()
		cmd = exec.Command("git", "rev-list", commitRange+"..HEAD", "--merges", "--pretty=format:%B") //nolint:gosec

Copy link
Member

@furkatgofurov7 furkatgofurov7 left a comment

Choose a reason for hiding this comment

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

Awesome job, thanks @CecileRobertMichon. This should help to release team activities a lot 🎉

Few nits/questions:

.github/workflows/release.yml Outdated Show resolved Hide resolved
.github/workflows/release.yml Outdated Show resolved Hide resolved
docs/release/release-tasks.md Outdated Show resolved Hide resolved
docs/release/release-tasks.md Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 5, 2023
Copy link
Contributor

@g-gaston g-gaston left a comment

Choose a reason for hiding this comment

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

love this, thanks a lot @CecileRobertMichon
lgtm

@k8s-ci-robot k8s-ci-robot added do-not-merge/invalid-owners-file Indicates that a PR should not merge because it has an invalid OWNERS file in it. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Aug 7, 2023
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/invalid-owners-file Indicates that a PR should not merge because it has an invalid OWNERS file in it. label Aug 8, 2023
@CecileRobertMichon
Copy link
Contributor Author

/assign @vincepri @sbueringer @furkatgofurov7 @g-gaston @nawazkh

@nawazkh
Copy link
Member

nawazkh commented Aug 9, 2023

Looks good to me, thanks for creating this automation!
/lgtm

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

LGTM label has been added.

Git tree hash: 9fb495e676e077787679450a9fffd5d54babd5f6

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 14, 2023
@CecileRobertMichon
Copy link
Contributor Author

Would be good to get reviews from other maintainers

/assign @vincepri
/cc @killianmuldoon @fabriziopandini @enxebre

@sbueringer
Copy link
Member

Thank you very much!

Really nice work :)

/lgtm

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

LGTM label has been added.

Git tree hash: b4a8de39b61f87d43e883205d95aaa1777599311

CHANGELOG/README.md Show resolved Hide resolved
Comment on lines +46 to +49
if [[ $RELEASE_VERSION =~ beta ]] || [[ $RELEASE_VERSION =~ alpha ]]; then
export RELEASE_BRANCH=main
echo "RELEASE_BRANCH=$RELEASE_BRANCH" >> $GITHUB_ENV
echo "This is a beta or alpha release, will use release branch $RELEASE_BRANCH"
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to handle RCs as well?

There might be an edge case I think here where we're curring beta/alphas on a specific release branch, rather than on the main one. Usually this is vey rare, or it might never happened; but might be good to document?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

RC is where the release branch gets created for the first time. alpha/beta are created from the main branch. This is documented in https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/release/release-cycle.md.

Copy link
Member

@sbueringer sbueringer Aug 16, 2023

Choose a reason for hiding this comment

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

Q: If I see correctly, in case we have some edge case we can always work around this action by just doing everything manually, right? (and then at the end add the changelog to the repo)

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

Copy link
Contributor

@killianmuldoon killianmuldoon left a comment

Choose a reason for hiding this comment

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

/lgtm

Looking forward to seeing this working!

@sbueringer
Copy link
Member

I would say let's give it a few more days and if there are no objections until then merge on Monday

@sbueringer
Copy link
Member

/approve
/hold

@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 Aug 17, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

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 Aug 17, 2023
@killianmuldoon
Copy link
Contributor

I would say let's give it a few more days and if there are no objections until then merge on Monday

+100

@sbueringer
Copy link
Member

@CecileRobertMichon Thank you very much for making this happen :)

/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 Aug 21, 2023
@k8s-ci-robot k8s-ci-robot merged commit 5edbd19 into kubernetes-sigs:main Aug 21, 2023
@k8s-ci-robot k8s-ci-robot added this to the v1.6 milestone Aug 21, 2023
@g-gaston
Copy link
Contributor

/area release

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 Issues or PRs related to releasing 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.

Automate release branch and tag creation
9 participants