From 8dd0caa737649311bf31281bed72d3f071a8eb95 Mon Sep 17 00:00:00 2001 From: Richard Case Date: Thu, 5 Oct 2023 13:45:44 +0200 Subject: [PATCH] fix: kpromo failed during release During the v2.2.4 release `make promote` images failed for 2 reasons: - incorrect project name - blank fork This change fixes both of these problems. Signed-off-by: Richard Case --- Makefile | 12 +++++------- docs/book/src/development/releasing.md | 10 +++++++++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 58e28ddfe7..938d35ebaf 100644 --- a/Makefile +++ b/Makefile @@ -82,11 +82,6 @@ else export GOPATH := $(shell go env GOPATH) endif -USER_FORK ?= $(shell git config --get remote.origin.url | cut -d/ -f4) # only works on https://github.com//cluster-api.git style URLs -ifeq ($(USER_FORK),) -USER_FORK := $(shell git config --get remote.origin.url | cut -d: -f2 | cut -d/ -f1) # for git@github.com:/cluster-api.git style URLs -endif - # Release variables STAGING_REGISTRY ?= gcr.io/k8s-staging-cluster-api-aws @@ -100,6 +95,10 @@ RELEASE_ALIAS_TAG ?= $(PULL_BASE_REF) RELEASE_DIR := out RELEASE_POLICIES := $(RELEASE_DIR)/AWSIAMManagedPolicyControllers.json $(RELEASE_DIR)/AWSIAMManagedPolicyControllersWithEKS.json $(RELEASE_DIR)/AWSIAMManagedPolicyCloudProviderControlPlane.json $(RELEASE_DIR)/AWSIAMManagedPolicyCloudProviderNodes.json $(RELEASE_DIR)/AWSIAMManagedPolicyControllersWithS3.json BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD) +USER_FORK ?= $(shell git config --get remote.origin.url | cut -d/ -f4) # only works on https://github.com//cluster-api-provider-aws.git style URLs +ifeq ($(strip $(USER_FORK)),) +USER_FORK := $(shell git config --get remote.origin.url | cut -d: -f2 | cut -d/ -f1) # for git@github.com:/cluster-api-provider-aws.git style URLs +endif # image name used to build the cmd/clusterawsadm TOOLCHAIN_IMAGE := toolchain @@ -584,8 +583,7 @@ release-changelog: $(RELEASE_NOTES) check-release-tag check-previous-release-tag .PHONY: promote-images promote-images: $(KPROMO) $(YQ) - IMAGE_REVIEWERS="$(shell ./hack/get-project-maintainers.sh ${YQ})" - $(KPROMO) pr --project cluster-api-provider-aws --tag $(RELEASE_TAG) --reviewers "$(IMAGE_REVIEWERS)" --fork $(USER_FORK) --image cluster-api-aws-controller + $(KPROMO) pr --project cluster-api-aws --tag $(RELEASE_TAG) --reviewers "$(shell ./hack/get-project-maintainers.sh ${YQ})" --fork $(USER_FORK) --image cluster-api-aws-controller .PHONY: release-binaries release-binaries: ## Builds the binaries to publish with a release diff --git a/docs/book/src/development/releasing.md b/docs/book/src/development/releasing.md index 80b3222f20..7a5c2d3761 100644 --- a/docs/book/src/development/releasing.md +++ b/docs/book/src/development/releasing.md @@ -29,16 +29,22 @@ Promote the container images from the staging registry to the production registr 3. Wait for an image to appear with the tagged release version. 4. If you don't have a GitHub token, create one by going to your GitHub settings, in [Personal access tokens](https://github.com/settings/tokens). Make sure you give the token the `repo` scope. 5. Create a PR to promote the images: + ```bash export GITHUB_TOKEN= make promote-images ``` + **Notes**: + *`make promote-images` target tries to figure out your Github user handle in order to find the forked [k8s.io](https://github.com/kubernetes/k8s.io) repository. + If you have not forked the repo, please do it before running the Makefile target. + * if `make promote-images` fails with an error like `FATAL while checking fork of kubernetes/k8s.io` you may be able to solve it by manually setting the USER_FORK variable i.e. `export USER_FORK=` * `kpromo` uses `git@github.com:...` as remote to push the branch for the PR. If you don't have `ssh` set up you can configure git to use `https` instead via `git config --global url."https://github.com/".insteadOf git@github.com:`. * This will automatically create a PR in [k8s.io](https://github.com/kubernetes/k8s.io) and assign the CAPA maintainers. 6. Wait for the PR to be approved (typically by CAPA maintainers authorized to merge PRs into the k8s.io repository) and merged. 7. Verify the images are available in the production registry: + ```bash docker pull registry.k8s.io/cluster-api-aws/cluster-api-aws-controller:${VERSION} ``` @@ -69,6 +75,7 @@ Promote the container images from the staging registry to the production registr 1. Publish release. Use the pre-release option for release candidate versions of Cluster API Provider AWS. 1. Email `kubernetes-sig-cluster-lifecycle@googlegroups.com` to announce the release. You can use this template for the email: + ``` Subject: [ANNOUNCE] cluster-api-provider-aws v2.1.0 is released Body: @@ -78,4 +85,5 @@ Promote the container images from the staging registry to the production registr If you have any questions about this release or CAPA, please join us on our Slack channel: https://kubernetes.slack.com/archives/CD6U2V71N ``` -1. Update the Title and Description of the Slack channel to point to the new version. \ No newline at end of file + +1. Update the Title and Description of the Slack channel to point to the new version.