Skip to content

Commit e6484cd

Browse files
authored
Merge pull request #87 from alexander-demicev/releasedocs
📖 Add doc describing release process
2 parents f6387a1 + 0c39eaa commit e6484cd

File tree

3 files changed

+96
-0
lines changed

3 files changed

+96
-0
lines changed

Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.24.2
5252
export KUBEBUILDER_CONTROLPLANE_START_TIMEOUT ?= 60s
5353
export KUBEBUILDER_CONTROLPLANE_STOP_TIMEOUT ?= 60s
5454

55+
# Release
56+
USER_FORK ?= $(shell git config --get remote.origin.url | cut -d/ -f4) # only works on https://github.com/<username>/cluster-api.git style URLs
57+
ifeq ($(USER_FORK),)
58+
USER_FORK := $(shell git config --get remote.origin.url | cut -d: -f2 | cut -d/ -f1) # for [email protected]:<username>/cluster-api.git style URLs
59+
endif
60+
IMAGE_REVIEWERS ?= $(shell ./hack/get-project-maintainers.sh)
61+
5562
# Binaries.
5663
# Need to use abspath so we can invoke these from subdirectories
5764
CONTROLLER_GEN_VER := v0.9.2
@@ -90,6 +97,10 @@ HELM_VER := v3.8.1
9097
HELM_BIN := helm
9198
HELM := $(TOOLS_BIN_DIR)/$(HELM_BIN)-$(HELM_VER)
9299

100+
YQ_VER := v4.25.2
101+
YQ_BIN := yq
102+
YQ := $(TOOLS_BIN_DIR)/$(YQ_BIN)-$(YQ_VER)
103+
93104
# It is set by Prow GIT_TAG, a git-based tag of the form vYYYYMMDD-hash, e.g., v20210120-v0.3.10-308-gc61521971
94105
TAG ?= dev
95106
ARCH ?= amd64
@@ -145,6 +156,7 @@ setup-envtest: $(SETUP_ENVTEST) ## Build a local copy of setup-envtest.
145156
golangci-lint: $(GOLANGCI_LINT) ## Build a local copy of golang ci-lint.
146157
gotestsum: $(GOTESTSUM) ## Build a local copy of gotestsum.
147158
helm: $(HELM) ## Build a local copy of helm.
159+
yq: $(YQ) ## Build a local copy of yq.
148160

149161
$(KUSTOMIZE): ## Build kustomize from tools folder.
150162
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) sigs.k8s.io/kustomize/kustomize/v4 $(KUSTOMIZE_BIN) $(KUSTOMIZE_VER)
@@ -179,6 +191,9 @@ $(HELM): ## Put helm into tools folder.
179191
ln -sf $(HELM) $(TOOLS_BIN_DIR)/$(HELM_BIN)
180192
rm -f $(TOOLS_BIN_DIR)/get_helm.sh
181193

194+
$(YQ):
195+
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) github.com/mikefarah/yq/v4 $(YQ_BIN) ${YQ_VER}
196+
182197
.PHONY: cert-mananger
183198
cert-manager: # Install cert-manager on the cluster. This is used for development purposes only.
184199
$(ROOT)/hack/cert-manager.sh
@@ -409,6 +424,10 @@ upload-staging-artifacts: ## Upload release artifacts to the staging bucket
409424
update-helm-repo:
410425
./hack/update-helm-repo.sh $(RELEASE_TAG)
411426

427+
.PHONY: promote-images
428+
promote-images: $(KPROMO)
429+
$(KPROMO) pr --project capi-operator --tag $(RELEASE_TAG) --reviewers "$(IMAGE_REVIEWERS)" --fork $(USER_FORK) --image cluster-api-operator
430+
412431
## --------------------------------------
413432
## Cleanup / Verification
414433
## --------------------------------------

docs/release.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Releasing new versions
2+
3+
This documents describes release process for the Cluster API Operator.
4+
5+
1. Cut the release branch.
6+
7+
```bash
8+
export RELEASE_TAG=v0.1.1
9+
10+
git tag -s -a ${RELEASE_TAG} -m ${RELEASE_TAG}
11+
12+
git push upstream ${RELEASE_TAG}
13+
```
14+
15+
This will trigger [release github action](https://github.com/kubernetes-sigs/cluster-api-operator/blob/main/.github/workflows/release.yaml) that will
16+
create a draft release with operator components and helm chart, also a Prow job to publish operator image to the staging registry will start.
17+
18+
2. Wait for image to appear in the [staging registry](https://console.cloud.google.com/gcr/images/k8s-staging-capi-operator/global/cluster-api-operator).
19+
20+
3. Create a GitHub [Personal access tokens](https://github.com/settings/tokens) if you don't have one already. We're going to use for opening a PR
21+
to promote image from staging to production.
22+
23+
```bash
24+
export GITHUB_TOKEN=<your GH token>
25+
make promote-images
26+
```
27+
28+
Merge the PR after it was created and verify that image is present in the production registry.
29+
30+
```bash
31+
docker pull registry.k8s.io/capi-operator:${RELEASE_TAG}
32+
```
33+
34+
4. Publish the release on Github.
35+
36+
5. After release was published, switch back to main branch and update index.yaml. It's the source for operator helm chart repository.
37+
38+
```bash
39+
git checkout main
40+
make update-helm-repo
41+
```
42+
43+
6. Create a PR with the changes.

hack/get-project-maintainers.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2022 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -o errexit
18+
set -o nounset
19+
set -o pipefail
20+
21+
if [[ "${TRACE-0}" == "1" ]]; then
22+
set -o xtrace
23+
fi
24+
25+
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
26+
27+
YQ_BIN=yq
28+
YQ_PATH=hack/tools/bin/${YQ_BIN}
29+
30+
cd "${REPO_ROOT}" && make ${YQ_BIN} >/dev/null
31+
32+
KEYS=()
33+
while IFS='' read -r line; do KEYS+=("$line"); done < <(${YQ_PATH} e '.aliases["cluster-api-operator-admins"][]' OWNERS_ALIASES)
34+
echo "${KEYS[@]/#/@}"

0 commit comments

Comments
 (0)