Skip to content

Commit

Permalink
Merge pull request #2218 from Nordix/mquhuy/update-releasing-docs
Browse files Browse the repository at this point in the history
🌱 Update release note generator and docs to reflect the new release workflow
  • Loading branch information
metal3-io-bot authored Jan 10, 2025
2 parents 69cdf58 + 601fc8a commit 0049b81
Show file tree
Hide file tree
Showing 6 changed files with 198 additions and 109 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ minikube.kubeconfig

# Example and binary output directory
out
releasenotes

# vscode
.vscode
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ release-manifests: $(KUSTOMIZE) $(RELEASE_DIR) ## Builds the manifests to publis

.PHONY: release-notes
release-notes: $(RELEASE_NOTES_DIR) $(RELEASE_NOTES)
$(GO) run ./hack/tools/release/notes.go --from=$(PREVIOUS_TAG) > $(RELEASE_NOTES_DIR)/$(RELEASE_TAG).md
cd hack/tools && $(GO) run release/notes.go --releaseTag=$(RELEASE_TAG) > $(realpath $(RELEASE_NOTES_DIR))/$(RELEASE_TAG).md

.PHONY: release
release:
Expand Down
119 changes: 55 additions & 64 deletions docs/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,76 +59,67 @@ CAPM3 uses [semantic versioning](https://semver.org).

### Repository setup

Clone the repository:
- Clone the repository:
`git clone [email protected]:metal3-io/cluster-api-provider-metal3`

or if using existing repository, verify your intended remote is set to
`metal3-io`: `git remote -v`. For this document, we assume it is `origin`.

- If creating a new minor branch, identify the commit you wish to create the
branch from, and create a branch `release-1.x`:
`git checkout <sha> -b release-1.x` and push it to remote:
`git push origin release-1.x` to create it
- If creating a new patch release, use existing branch `release-1.x`:
`git checkout origin/release-1.x`

### Tags

First we create a primary release tag, that triggers release note creation and
image building processes.

- Create a signed, annotated tag with: `git tag -s -a v1.x.y -m v1.x.y`
- Push the tags to the GitHub repository: `git push origin v1.x.y`

This triggers two things:

- GitHub action workflow for automated release process creates a draft release
in GitHub repository with correct content, comparing the pushed tag to
previous tag. Running actions are visible on the
[Actions](https://github.com/metal3-io/cluster-api-provider-metal3/actions)
page, and draft release will be visible on top of the
[Releases](https://github.com/metal3-io/cluster-api-provider-metal3/releases)
page.
- GH action `build-images-action` starts building release image with the release
tag in Jenkins, and it gets pushed to Quay. Make sure the release tag is
visible in
[Quay tags page](https://quay.io/repository/metal3-io/cluster-api-provider-metal3?tab=tags).
If the release tag build is not visible, check if the action has failed and
retrigger as necessary.

We also need to create one or more tags for the Go modules ecosystem:

- For any subdirectory with `go.mod` in it (excluding `hack/tools` and
`hack/fake-apiserver`), create another Git tag with directory prefix, ie.
`git tag api/v1.x.y` and `git tag test/v1.x.y`. This enables the
tags to be used as a Go module version for any downstream users.

**NOTE**: Do not create annotated tags (`-a`, or implicitly via `-m` or `-s`)
for Go modules. Release notes expects only the main tag to be annotated,
otherwise it might create incorrect release notes. Push both of the tags to
`origin`.

### Release notes

Next step is to clean up the release note manually. Release note has been
generated by the `release` action, do not click the `Generate release notes`
button. In case there is issue with release action, you may rerun it via
`Actions` tab, or you can `make release-notes` to get a markdown file with
the release content to be inserted.

- If release is not a beta or release candidate, check for duplicates, reverts,
and incorrect classifications of PRs, and whatever release creation tagged to
be manually checked.
or if using existing repository, make sure origin is set to the fork and
upstream is set to `metal3-io`. Verify if your remote is set properly or not
by using following command `git remote -v`.

- Fetch the remote (`metal3-io`): `git fetch upstream`
This makes sure that all the tags are accessible.

### Creating Release Notes

- Switch to the main branch: `git checkout main`

- Create a new branch for the release notes**:
`git checkout -b release-notes-1.x.x origin/main`

- Generate the release notes: `RELEASE_TAG=v1.x.x make release-notes`
- Replace `v1.x.x` with the new release tag you're creating.
- This command generates the release notes here
`releasenotes/<RELEASE_TAG>.md` .

- Next step is to clean up the release note manually.
- If release is not a beta or release candidate, check for duplicates,
reverts, and incorrect classifications of PRs, and whatever release
creation tagged to be manually checked.
- For any superseded PRs (like same dependency uplifted multiple times, or
commit revertions) that provide no value to the release, move them to
commit revertion) that provide no value to the release, move them to
Superseded section. This way the changes are acknowledged to be part of the
release, but not overwhelming the important changes contained by the
release.
- If the release you're making is not a new major release, new minor release,
or a new patch release from the latest release branch, uncheck the box for
latest release.
- If it is a release candidate (RC) or a beta release, tick pre-release box.
- Save the release note as a draft, and have others review it.

- Commit your changes, push the new branch and create a pull request:
- The commit and PR title should be 🚀 Release v1.x.y:
- `git commit -S -s -m ":rocket: Release v1.x.x"`
- `git push -u origin release-notes-1.x.x`
- Important! The commit should only contain the release notes file, nothing
else, otherwise automation will not work.

- Ask maintainers and release team members to review your pull request.

Once PR is merged following GitHub actions are triggered:

- GitHub action `Create Release` runs following jobs:
- GitHub job `push_release_tags` will create and push the tags. This action
will also create release branch if its missing and release is `rc` or
minor.
- GitHub job `create draft release` creates draft release. Don't publish the
release until release tag is visible in. Running actions are visible on the
[Actions](https://github.com/metal3-io/cluster-api-provider-metal3/actions)
page, and draft release will be visible on top of the
[Releases](https://github.com/metal3-io/cluster-api-provider-metal3/releases).
If the release you're making is not a new major release, new minor release,
or a new patch release from the latest release branch, uncheck the box for
latest release. If it is a release candidate (RC) or a beta release,
tick pre-release box.
- GitHub job `build_CAPM3` builds release image with the release tag,
and pushes it to Quay. Make sure the release tag is visible in
[Quay tags page](https://quay.io/repository/metal3-io/cluster-api-provider-metal3?tab=tags).
If the release tag build is not visible, check if the action has failed and
retrigger as necessary.

### Release artifacts

Expand Down
6 changes: 5 additions & 1 deletion hack/tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ module github.com/metal3-io/cluster-api-provider-metal3/hack/tools
go 1.22.8

require (
github.com/blang/semver v3.5.1+incompatible
github.com/drone/envsubst v1.0.3
github.com/golang/mock v1.6.0
github.com/google/go-github v17.0.0+incompatible
github.com/jteeuwen/go-bindata v3.0.7+incompatible
github.com/pkg/errors v0.9.1
golang.org/x/oauth2 v0.21.0
k8s.io/code-generator v0.31.4
sigs.k8s.io/controller-tools v0.16.5
sigs.k8s.io/kustomize/kustomize/v5 v5.5.0
Expand All @@ -27,6 +31,7 @@ require (
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
Expand All @@ -39,7 +44,6 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/onsi/gomega v1.34.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/spf13/cobra v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
Expand Down
9 changes: 9 additions & 0 deletions hack/tools/go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ=
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
Expand Down Expand Up @@ -39,9 +41,14 @@ github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY=
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
Expand Down Expand Up @@ -143,6 +150,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs=
golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down
Loading

0 comments on commit 0049b81

Please sign in to comment.