Skip to content

Commit 0b01878

Browse files
authored
build: Add CAREN release to cluster class artifacts (#979)
This attaches the updated cluster class artifacts containing the CAREN release version to the release artifacts on release.
1 parent e03cea0 commit 0b01878

File tree

5 files changed

+45
-1
lines changed

5 files changed

+45
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,4 @@ test/e2e/config/caren-envsubst.yaml
4949
/release-metadata.yaml
5050
hack/tools/fetch-images/fetch-images
5151
caren-images.txt
52+
hack/examples/release/*-cluster-class.yaml

.goreleaser.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ release:
3030
- glob: release-metadata.yaml
3131
name_template: metadata.yaml
3232
- glob: runtime-extensions-components.yaml
33-
- glob: ./charts/{{ .ProjectName }}/defaultclusterclasses/*.yaml
33+
- glob: ./hack/examples/release/*-cluster-class.yaml
3434
- glob: caren-images.txt
3535

3636
before:
@@ -58,6 +58,10 @@ before:
5858
sh -ec 'if [ {{ .IsSnapshot }} == false ] ; then
5959
make --no-print-directory CAREN_VERSION=v{{ trimprefix .Version "v" }} list-images >caren-images.txt
6060
fi'
61+
- |
62+
sh -ec 'if [ {{ .IsSnapshot }} == false ] ; then
63+
make --no-print-directory CAREN_VERSION=v{{ trimprefix .Version "v" }} add-version-to-clusterclasses
64+
fi'
6165
6266
builds:
6367
- id: cluster-api-runtime-extensions-nutanix
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2024 Nutanix. All rights reserved.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
set -euo pipefail
7+
IFS=$'\n\t'
8+
9+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10+
readonly SCRIPT_DIR
11+
12+
trap 'find "${SCRIPT_DIR}" -name kustomization.yaml -delete' EXIT
13+
14+
export CAREN_RELEASE_VERSION="${1}"
15+
16+
for CC_TEMPLATE in "${SCRIPT_DIR}"/../../../charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/*.yaml; do
17+
export CC_TEMPLATE
18+
envsubst -no-empty -no-unset -i "${SCRIPT_DIR}/kustomization.yaml.tmpl" -o "${SCRIPT_DIR}/kustomization.yaml"
19+
20+
kustomize build "${SCRIPT_DIR}" --load-restrictor LoadRestrictionsNone >"${SCRIPT_DIR}/$(basename "${CC_TEMPLATE}")"
21+
done
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2023 Nutanix. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
apiVersion: kustomize.config.k8s.io/v1beta1
5+
kind: Kustomization
6+
7+
sortOptions:
8+
order: fifo
9+
10+
commonAnnotations:
11+
caren.nutanix.com/version: "${CAREN_RELEASE_VERSION}"
12+
13+
resources:
14+
- "${CC_TEMPLATE}"

make/goreleaser.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,7 @@ release-snapshot: go-generate ; $(info $(M) building snapshot release $*)
4242
.PHONY: list-releases
4343
list-releases: ## List releases from GitHub
4444
gh release list --json tagName | gojq -r .[].tagName
45+
46+
.PHONY: add-version-to-clusterclasses
47+
add-version-to-clusterclasses:
48+
./hack/examples/release/add-version-to-clusterclasses.sh $(CAREN_VERSION)

0 commit comments

Comments
 (0)