Skip to content

Commit 120db21

Browse files
authored
Merge pull request #903 from sbueringer/pr-finalize-release-targets-and-doc
🐛 fixup release targets and update doc accordingly
2 parents 3ba2413 + 35fadb3 commit 120db21

File tree

2 files changed

+49
-34
lines changed

2 files changed

+49
-34
lines changed

Makefile

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ DOCKER_BUILDKIT=1
6262
STAGING_REGISTRY := gcr.io/k8s-staging-capi-openstack
6363
STAGING_BUCKET ?= artifacts.k8s-staging-capi-openstack.appspot.com
6464
BUCKET ?= $(STAGING_BUCKET)
65-
PROD_REGISTRY := us.gcr.io/k8s-artifacts-prod/capi-openstack
65+
PROD_REGISTRY ?= k8s.gcr.io/capi-openstack
6666
REGISTRY ?= $(STAGING_REGISTRY)
6767
RELEASE_TAG ?= $(shell git describe --abbrev=0 2>/dev/null)
6868
PULL_BASE_REF ?= $(RELEASE_TAG) # PULL_BASE_REF will be provided by Prow
@@ -262,20 +262,33 @@ list-staging-releases: ## List staging images for image promotion
262262
list-image:
263263
gcloud container images list-tags $(STAGING_REGISTRY)/$(IMAGE) --filter="tags=('$(RELEASE_TAG)')" --format=json
264264

265-
.PHONY: check-release-tag
266-
check-release-tag:
267-
@if [ -z "${RELEASE_TAG}" ]; then echo "RELEASE_TAG is not set"; exit 1; fi
268-
@if ! [ -z "$$(git status --porcelain)" ]; then echo "Your local git repository contains uncommitted changes, use git clean before proceeding."; exit 1; fi
269-
270265
.PHONY: release
271-
release: $(RELEASE_NOTES) clean-release check-release-tag $(RELEASE_DIR) ## Builds and push container images using the latest git tag for the commit.
266+
release: $(RELEASE_NOTES) clean-release $(RELEASE_DIR) ## Builds and push container images using the latest git tag for the commit.
267+
@if [ -z "${RELEASE_TAG}" ]; then echo "RELEASE_TAG is not set"; exit 1; fi
268+
@if ! [ -z "$$(git status --porcelain)" ]; then echo "Your local git repository contains uncommitted changes, use git clean before proceeding."; fi
272269
git checkout "${RELEASE_TAG}"
273-
@if [ -z "${PREVIOUS_VERSION}" ]; then echo "PREVIOUS_VERSION is not set"; exit 1; fi
274-
$(RELEASE_NOTES) --from $(PREVIOUS_VERSION) > $(RELEASE_DIR)/CHANGELOG.md
275-
$(MAKE) release-notes
270+
# Set the manifest image to the production bucket.
271+
$(MAKE) manifest-modification REGISTRY=$(PROD_REGISTRY)
276272
$(MAKE) release-manifests
277273
$(MAKE) release-templates
278274

275+
.PHONY: manifest-modification
276+
manifest-modification: # Set the manifest images to the staging/production bucket.
277+
$(MAKE) set-manifest-image \
278+
MANIFEST_IMG=$(REGISTRY)/$(IMAGE_NAME) MANIFEST_TAG=$(RELEASE_TAG) \
279+
TARGET_RESOURCE="./config/default/manager_image_patch.yaml"
280+
$(MAKE) set-manifest-pull-policy PULL_POLICY=IfNotPresent TARGET_RESOURCE="./config/default/manager_pull_policy.yaml"
281+
282+
.PHONY: set-manifest-image
283+
set-manifest-image:
284+
$(info Updating kustomize image patch file for manager resource)
285+
sed -i'' -e 's@image: .*@image: '"${MANIFEST_IMG}:$(MANIFEST_TAG)"'@' $(TARGET_RESOURCE)
286+
287+
.PHONY: set-manifest-pull-policy
288+
set-manifest-pull-policy:
289+
$(info Updating kustomize pull policy file for manager resources)
290+
sed -i'' -e 's@imagePullPolicy: .*@imagePullPolicy: '"$(PULL_POLICY)"'@' $(TARGET_RESOURCE)
291+
279292
.PHONY: release-manifests
280293
release-manifests:
281294
$(MAKE) $(RELEASE_DIR)/$(MANIFEST_FILE).yaml TAG=$(RELEASE_TAG) PULL_POLICY=IfNotPresent
@@ -316,7 +329,7 @@ release-alias-tag: # Adds the tag to the last build tag.
316329

317330
.PHONY: release-notes
318331
release-notes: $(RELEASE_NOTES) ## Generate release notes
319-
$(RELEASE_NOTES) $(ARGS)
332+
$(RELEASE_NOTES) $(RELEASE_NOTES_ARGS)
320333

321334
.PHONY: release-templates
322335
release-templates: $(RELEASE_DIR) ## Generate release templates

RELEASE.md

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,31 @@
1818
## Process
1919

2020

21-
1. Make sure your repo is clean by git's standards
22-
2. If this is a new minor release, create a new release branch and push to github, otherwise switch to it, for example `release-0.2`
23-
3. Run `make release-notes` to gather changes since the last revision. If you need to specify a specific tag to look for changes
24-
since, use `make release-notes ARGS="--from <tag>"` Pay close attention to the `## :question: Sort these by hand` section, as it contains items that need to be manually sorted.
25-
4. Tag the repository and push the tag `git tag -s -m $VERSION $VERSION; git push upstream $VERSION`
26-
5. Create a draft release in github and associate it with the tag that was just created, copying the generated release notes into
27-
the draft.
28-
6. Checkout the tag you've just created and make sure git is in a clean state
29-
7. Run `make release`
30-
8. Attach the files to the drafted release:
31-
1. `./out/infrastructure-components.yaml`
32-
2. `./templates/cluster-template.yaml`
33-
3. `./templates/cluster-template-without-lb.yaml`
34-
4. `./templates/cluster-template-external-cloud-provider.yaml`
35-
5. `./metadata.yaml` (clusterctl >0.3.1 will include hardcoded metadata for CAPO. But let's keep the `metadata.yaml` file for our v0.3.* releases to be compatible with clusterctl <=0.3.1)
36-
9. Perform the [image promotion process](https://github.com/kubernetes/k8s.io/tree/main/k8s.gcr.io#image-promoter).
37-
The staging repository is at https://console.cloud.google.com/gcr/images/k8s-staging-capi-openstack/GLOBAL. Be
38-
sure to choose the top level `capi-openstack-controller`, which will provide the multi-arch manifest, rather than one for a specific architecture.
39-
The image build logs are available in [Cloud Build](https://console.cloud.google.com/cloud-build/builds?project=k8s-staging-capi-openstack).
40-
Add the new sha=>tag mapping to the [images.yaml](https://github.com/kubernetes/k8s.io/edit/main/k8s.gcr.io/images/k8s-staging-capi-openstack/images.yaml) (use the sha of the image with the corresponding tag)
41-
10. Finalise the release notes
42-
11. Publish release. Use the pre-release option for release
43-
candidate versions of Cluster API Provider OpenStack.
21+
1. Make sure your repo is clean by git's standards.
22+
1. Make sure you are on the correct branch (`master` for the current release and `release-0.x` for older releases).
23+
1. Create an annotated tag
24+
- `git tag -s -a $VERSION -m $VERSION`.
25+
1. Push the tag to the GitHub repository:
26+
> NOTE: `upstream` should be the name of the remote pointing to `github.com/kubernetes-sigs/cluster-api-provider-openstack`
27+
- `git push upstream $VERSION`
28+
1. Run `make release` to build artifacts (the image is automatically built by CI)
29+
1. Follow the [image promotion process](https://github.com/kubernetes/k8s.io/tree/main/k8s.gcr.io#image-promoter) to promote the image from the staging repo to `k8s.gcr.io/capi-openstack`.
30+
The staging repository can be inspected at https://console.cloud.google.com/gcr/images/k8s-staging-capi-openstack/GLOBAL. Be
31+
sure to choose the top level `capi-openstack-controller`, which will provide the multi-arch manifest, rather than one for a specific architecture.
32+
The image build logs are available at [Cloud Build](https://console.cloud.google.com/cloud-build/builds?project=k8s-staging-capi-openstack).
33+
Add the new sha=>tag mapping to the [images.yaml](https://github.com/kubernetes/k8s.io/edit/main/k8s.gcr.io/images/k8s-staging-capi-openstack/images.yaml) (use the sha of the image with the corresponding tag)
34+
1. Create a draft release in GitHub based on the tag created above
35+
1. Generate and finalize the release notes and add them to the draft release:
36+
- Run `make release-notes` to gather changes since the last revision. If you need to specify a specific tag to look for changes
37+
since, use `make release-notes RELEASE_NOTES_ARGS="--from <tag>"`.
38+
- Pay close attention to the `## :question: Sort these by hand` section, as it contains items that need to be manually sorted.
39+
1. Attach the following files to the draft release:
40+
- `./out/infrastructure-components.yaml`
41+
- `./out/cluster-template.yaml`
42+
- `./out/cluster-template-external-cloud-provider.yaml`
43+
- `./out/cluster-template-without-lb.yaml`
44+
- `./out/metadata.yaml`
45+
1. Publish release. Use the pre-release option for release candidate or beta versions.
4446

4547
### Permissions
4648

0 commit comments

Comments
 (0)