-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ use goreleaser for releasing binary (#4748)
* use goreleaser for releasing the binaries Signed-off-by: Anurag <[email protected]> * disable releasing of binaries using make targets since we intend to use goreleaser now, we can remove the make targets. This commit does the same. Signed-off-by: Anurag <[email protected]> * Update release-binaries target to use goreleaser * Add goreleaser as a tool dependency * Update .goreleaser configuration to upload YAML templates as GitHub release artifacts * Create binaries rather than archives to mimic current uploads. Signed-off-by: Nolan Brubaker <[email protected]> * Update documentation and remove unused targets Signed-off-by: Nolan Brubaker <[email protected]> * Remove unused gh targets/client Signed-off-by: Nolan Brubaker <[email protected]> * Updates based on doing dry runs * Remove Windows format override * Move goreleaser invocation into the Makefile * Add output directory to goreleaser configuration * Use generated release notes as the release contents * Run make release target inside the GitHub workflow * Set expected environment variables in the GitHub workflow * Build goreleaser before running the release target Signed-off-by: Nolan Brubaker <[email protected]> * Updates based on doing dry runs * Remove Windows format override * Move goreleaser invocation into the Makefile * Add output directory to goreleaser configuration * Use generated release notes as the release contents * Run make release target inside the GitHub workflow * Set expected environment variables in the GitHub workflow * Build goreleaser before running the release target * Force goreleaser to use local config * Set RELEASE_TAG env variable for release notes * Output env vars for debugging * Re-enable changelog support Signed-off-by: Nolan Brubaker <[email protected]> * Remove reference to unused steps Signed-off-by: Nolan Brubaker <[email protected]> --------- Signed-off-by: Anurag <[email protected]> Signed-off-by: Nolan Brubaker <[email protected]> Co-authored-by: Nolan Brubaker <[email protected]>
- Loading branch information
Showing
11 changed files
with
511 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
permissions: | ||
contents: write # required to write to github release. | ||
|
||
jobs: | ||
release: | ||
name: Create draft release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.21' | ||
- name: Set version info | ||
run: | | ||
echo "VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV | ||
echo "PREVIOUS_VERSION=$(git describe --abbrev=0 2> /dev/null)" >> $GITHUB_ENV | ||
echo "RELEASE_BRANCH=release-$(echo ${GITHUB_REF_NAME} | grep -Eo '[0-9]\.[0-9]+')" >> $GITHUB_ENV | ||
echo "RELEASE_TAG=${GITHUB_REF_NAME}" >> $GITHUB_ENV | ||
- name: Run release | ||
run: | | ||
echo "Version is: $VERSION" | ||
echo "Previous version is: $PREVIOUS_VERSION" | ||
echo "Release branch is: $RELEASE_BRANCH" | ||
echo "Release tag is: $RELEASE_TAG" | ||
make release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,7 @@ junit.*.xml | |
.DS_Store | ||
|
||
.tiltbuild | ||
dist | ||
|
||
# test results | ||
_artifacts | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
builds: | ||
# clusterctl-aws | ||
- id: "clusterctl-aws" | ||
main: ./cmd/clusterawsadm | ||
binary: bin/clusterctl-aws | ||
env: | ||
- CGO_ENABLED=0 | ||
ldflags: | ||
- -s -w | ||
- -X 'sigs.k8s.io/cluster-api-provider-aws/v2/version.gitMajor={{.Major}}' | ||
- -X 'sigs.k8s.io/cluster-api-provider-aws/v2/version.gitMinor={{.Minor}}' | ||
- -X 'sigs.k8s.io/cluster-api-provider-aws/v2/version.gitVersion={{.Version}}' | ||
- -X 'sigs.k8s.io/cluster-api-provider-aws/v2/version.gitCommit={{.Commit}}' | ||
- -X 'sigs.k8s.io/cluster-api-provider-aws/v2/version.gitTreeState={{.GitTreeState}}' | ||
- -X 'sigs.k8s.io/cluster-api-provider-aws/v2/version.buildDate={{.Date}}' | ||
- -X 'sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/cmd/version.CLIName=clusterctl-aws' | ||
goos: | ||
- linux | ||
- darwin | ||
- windows | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
|
||
# clusterawsadm | ||
- id: "clusterawsadm" | ||
main: ./cmd/clusterawsadm | ||
binary: bin/clusterawsadm | ||
env: | ||
- CGO_ENABLED=0 | ||
ldflags: | ||
- -s -w | ||
- -X 'sigs.k8s.io/cluster-api-provider-aws/v2/version.gitMajor={{.Major}}' | ||
- -X 'sigs.k8s.io/cluster-api-provider-aws/v2/version.gitMinor={{.Minor}}' | ||
- -X 'sigs.k8s.io/cluster-api-provider-aws/v2/version.gitVersion={{.Version}}' | ||
- -X 'sigs.k8s.io/cluster-api-provider-aws/v2/version.gitCommit={{.Commit}}' | ||
- -X 'sigs.k8s.io/cluster-api-provider-aws/v2/version.gitTreeState={{.GitTreeState}}' | ||
- -X 'sigs.k8s.io/cluster-api-provider-aws/v2/version.buildDate={{.Date}}' | ||
goos: | ||
- linux | ||
- darwin | ||
- windows | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
|
||
archives: | ||
- id: clusterctl-aws | ||
builds: | ||
- clusterctl-aws | ||
name_template: "clusterctl-aws_{{ .Tag }}_{{ .Os }}_{{ .Arch }}" | ||
format: binary | ||
- id: clusterawsadm | ||
builds: | ||
- clusterawsadm | ||
name_template: "clusterawsadm_{{ .Tag }}_{{ .Os }}_{{ .Arch }}" | ||
format: binary | ||
|
||
release: | ||
discussion_category_name: General | ||
extra_files: | ||
- glob: ./templates/*.yaml | ||
- glob: ./out/* | ||
draft: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,13 +14,12 @@ | |
1. Update the release branch on the repository, e.g. `git push origin HEAD:release-1.5`. `origin` refers to the remote git reference to your fork. | ||
1. Update the release branch on the repository, e.g. `git push upstream HEAD:release-1.5`. `upstream` refers to the upstream git reference. | ||
1. Make sure your repo is clean by git standards. | ||
1. Set environment variable `GITHUB_TOKEN` to a GitHub personal access token. The token must have write access to the `kubernetes-sigs/cluster-api-provider-aws` repository. | ||
1. Set environment variables `PREVIOUS_VERSION` which is the last release tag and `VERSION` which is the current release version, e.g. `export PREVIOUS_VERSION=v1.4.0 VERSION=v1.5.0`, or `export PREVIOUS_VERSION=v1.5.0 VERSION=v1.5.1`). | ||
1. Set environment variables which is the last release tag and `VERSION` which is the current release version, e.g. `export VERSION=v1.5.0`, or `export VERSION=v1.5.1`). | ||
_**Note**_: the version MUST contain a `v` in front. | ||
_**Note**_: you must have a gpg signing configured with git and registered with GitHub. | ||
|
||
1. Create a tag `git tag -s -m $VERSION $VERSION`. `-s` flag is for GNU Privacy Guard (GPG) signing. | ||
1. Make sure you have push permissions to the upstream CAPA repo. Push tag you've just created (`git push <upstream-repo-remote> $VERSION`). | ||
1. Make sure you have push permissions to the upstream CAPA repo. Push tag you've just created (`git push <upstream-repo-remote> $VERSION`). Pushing this tag will kick off a GitHub Action that will create the release and attach the binaries and YAML templates to it. | ||
1. A prow job will start running to push images to the staging repo, can be seen [here](https://testgrid.k8s.io/sig-cluster-lifecycle-image-pushes#post-cluster-api-provider-aws-push-images). The job is called "post-cluster-api-provider-aws-push-images," and is defined in <https://github.com/kubernetes/test-infra/blob/master/config/jobs/image-pushing/k8s-staging-cluster-api.yaml>. | ||
1. When the job is finished, wait for the images to be created: `docker pull gcr.io/k8s-staging-cluster-api-aws/cluster-api-aws-controller:$VERSION`. You can also wrap this with a command to retry periodically, until the job is complete, e.g. `watch --interval 30 --chgexit docker pull <...>`. | ||
|
||
|
@@ -53,30 +52,34 @@ Promote the container images from the staging registry to the production registr | |
docker pull registry.k8s.io/cluster-api-aws/cluster-api-aws-controller:${VERSION} | ||
``` | ||
## Create release artifacts, and a GitHub draft release | ||
1. Again, make sure your repo is clean by git standards. | ||
1. Export the current branch `export BRANCH=release-1.5` (`export BRANCH=main`)and run `make release`. | ||
1. Run `make create-gh-release` to create a draft release on Github, copying the generated release notes from `out/CHANGELOG.md` into the draft. | ||
1. Run `make upload-gh-artifacts` to upload artifacts from .out/ directory. You may run into API limit errors, so verify artifacts at next step. | ||
## Verify and Publish the draft release | ||
1. Verify that all the files below are attached to the drafted release: | ||
1. `clusterawsadm-darwin-amd64` | ||
1. `clusterawsadm-darwin-arm64` | ||
1. `clusterawsadm-linux-amd64` | ||
1. `clusterawsadm-linux-arm64` | ||
1. `clusterawsadm-windows-amd64.exe` | ||
1. `clusterawsadm-windows-arm64.exe` | ||
1. `infrastructure-components.yaml` | ||
1. `cluster-template.yaml` | ||
1. `cluster-template-machinepool.yaml` | ||
1. `cluster-template-eks.yaml` | ||
1. `cluster-template-eks-ipv6.yaml` | ||
1. `cluster-template-eks-fargate.yaml` | ||
1. `cluster-template-eks-managedmachinepool.yaml` | ||
1. `cluster-template-eks-managedmachinepool-vpccni.yaml` | ||
1. `cluster-template-eks-managedmachinepool-gpu.yaml` | ||
1. `eks-controlplane-components.yaml` | ||
1. `eks-bootstrap-components.yaml` | ||
1. `cluster-template-external-cloud-provider.yaml` | ||
1. `cluster-template-flatcar.yaml` | ||
1. `cluster-template-machinepool.yaml` | ||
1. `cluster-template-multitenancy-clusterclass.yaml` | ||
1. `cluster-template-rosa-machinepool.yaml` | ||
1. `cluster-template-rosa.yaml` | ||
1. `cluster-template-simple-clusterclass.yaml` | ||
1. `metadata.yaml` | ||
1. Finalise the release notes by editing the draft release. | ||
_**Note**_: ONLY do this _after_ you verified that the promotion succeeded [here](https://testgrid.k8s.io/sig-k8s-infra-k8sio#post-k8sio-image-promo). | ||
## Publish the draft release | ||
1. Update the release description to link to the promotion image. | ||
1. Publish release. Use the pre-release option for release candidate versions of Cluster API Provider AWS. | ||
1. Email `[email protected]` to announce the release. You can use this template for the email: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.