Skip to content

Commit

Permalink
Merge pull request #87 from alexander-demicev/releasedocs
Browse files Browse the repository at this point in the history
📖 Add doc describing release process
  • Loading branch information
k8s-ci-robot authored Mar 20, 2023
2 parents f6387a1 + 0c39eaa commit e6484cd
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.24.2
export KUBEBUILDER_CONTROLPLANE_START_TIMEOUT ?= 60s
export KUBEBUILDER_CONTROLPLANE_STOP_TIMEOUT ?= 60s

# Release
USER_FORK ?= $(shell git config --get remote.origin.url | cut -d/ -f4) # only works on https://github.com/<username>/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:<username>/cluster-api.git style URLs
endif
IMAGE_REVIEWERS ?= $(shell ./hack/get-project-maintainers.sh)

# Binaries.
# Need to use abspath so we can invoke these from subdirectories
CONTROLLER_GEN_VER := v0.9.2
Expand Down Expand Up @@ -90,6 +97,10 @@ HELM_VER := v3.8.1
HELM_BIN := helm
HELM := $(TOOLS_BIN_DIR)/$(HELM_BIN)-$(HELM_VER)

YQ_VER := v4.25.2
YQ_BIN := yq
YQ := $(TOOLS_BIN_DIR)/$(YQ_BIN)-$(YQ_VER)

# It is set by Prow GIT_TAG, a git-based tag of the form vYYYYMMDD-hash, e.g., v20210120-v0.3.10-308-gc61521971
TAG ?= dev
ARCH ?= amd64
Expand Down Expand Up @@ -145,6 +156,7 @@ setup-envtest: $(SETUP_ENVTEST) ## Build a local copy of setup-envtest.
golangci-lint: $(GOLANGCI_LINT) ## Build a local copy of golang ci-lint.
gotestsum: $(GOTESTSUM) ## Build a local copy of gotestsum.
helm: $(HELM) ## Build a local copy of helm.
yq: $(YQ) ## Build a local copy of yq.

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

$(YQ):
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) github.com/mikefarah/yq/v4 $(YQ_BIN) ${YQ_VER}

.PHONY: cert-mananger
cert-manager: # Install cert-manager on the cluster. This is used for development purposes only.
$(ROOT)/hack/cert-manager.sh
Expand Down Expand Up @@ -409,6 +424,10 @@ upload-staging-artifacts: ## Upload release artifacts to the staging bucket
update-helm-repo:
./hack/update-helm-repo.sh $(RELEASE_TAG)

.PHONY: promote-images
promote-images: $(KPROMO)
$(KPROMO) pr --project capi-operator --tag $(RELEASE_TAG) --reviewers "$(IMAGE_REVIEWERS)" --fork $(USER_FORK) --image cluster-api-operator

## --------------------------------------
## Cleanup / Verification
## --------------------------------------
Expand Down
43 changes: 43 additions & 0 deletions docs/release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Releasing new versions

This documents describes release process for the Cluster API Operator.

1. Cut the release branch.

```bash
export RELEASE_TAG=v0.1.1

git tag -s -a ${RELEASE_TAG} -m ${RELEASE_TAG}

git push upstream ${RELEASE_TAG}
```

This will trigger [release github action](https://github.com/kubernetes-sigs/cluster-api-operator/blob/main/.github/workflows/release.yaml) that will
create a draft release with operator components and helm chart, also a Prow job to publish operator image to the staging registry will start.

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).

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
to promote image from staging to production.

```bash
export GITHUB_TOKEN=<your GH token>
make promote-images
```

Merge the PR after it was created and verify that image is present in the production registry.

```bash
docker pull registry.k8s.io/capi-operator:${RELEASE_TAG}
```

4. Publish the release on Github.

5. After release was published, switch back to main branch and update index.yaml. It's the source for operator helm chart repository.

```bash
git checkout main
make update-helm-repo
```

6. Create a PR with the changes.
34 changes: 34 additions & 0 deletions hack/get-project-maintainers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash

# Copyright 2022 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit
set -o nounset
set -o pipefail

if [[ "${TRACE-0}" == "1" ]]; then
set -o xtrace
fi

REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..

YQ_BIN=yq
YQ_PATH=hack/tools/bin/${YQ_BIN}

cd "${REPO_ROOT}" && make ${YQ_BIN} >/dev/null

KEYS=()
while IFS='' read -r line; do KEYS+=("$line"); done < <(${YQ_PATH} e '.aliases["cluster-api-operator-admins"][]' OWNERS_ALIASES)
echo "${KEYS[@]/#/@}"

0 comments on commit e6484cd

Please sign in to comment.