Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Add CAREN release to cluster class artifacts #979

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ test/e2e/config/caren-envsubst.yaml
/release-metadata.yaml
hack/tools/fetch-images/fetch-images
caren-images.txt
hack/examples/release/*-cluster-class.yaml
6 changes: 5 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ release:
- glob: release-metadata.yaml
name_template: metadata.yaml
- glob: runtime-extensions-components.yaml
- glob: ./charts/{{ .ProjectName }}/defaultclusterclasses/*.yaml
- glob: ./hack/examples/release/*-cluster-class.yaml
- glob: caren-images.txt

before:
Expand Down Expand Up @@ -58,6 +58,10 @@ before:
sh -ec 'if [ {{ .IsSnapshot }} == false ] ; then
make --no-print-directory CAREN_VERSION=v{{ trimprefix .Version "v" }} list-images >caren-images.txt
fi'
- |
sh -ec 'if [ {{ .IsSnapshot }} == false ] ; then
make --no-print-directory CAREN_VERSION=v{{ trimprefix .Version "v" }} add-version-to-clusterclasses
dlipovetsky marked this conversation as resolved.
Show resolved Hide resolved
fi'

builds:
- id: cluster-api-runtime-extensions-nutanix
Expand Down
21 changes: 21 additions & 0 deletions hack/examples/release/add-version-to-clusterclasses.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

# Copyright 2024 Nutanix. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

set -euo pipefail
IFS=$'\n\t'

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly SCRIPT_DIR

trap 'find "${SCRIPT_DIR}" -name kustomization.yaml -delete' EXIT

export CAREN_RELEASE_VERSION="${1}"

for CC_TEMPLATE in "${SCRIPT_DIR}"/../../../charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/*.yaml; do
export CC_TEMPLATE
envsubst -no-empty -no-unset -i "${SCRIPT_DIR}/kustomization.yaml.tmpl" -o "${SCRIPT_DIR}/kustomization.yaml"

kustomize build "${SCRIPT_DIR}" --load-restrictor LoadRestrictionsNone >"${SCRIPT_DIR}/$(basename "${CC_TEMPLATE}")"
done
14 changes: 14 additions & 0 deletions hack/examples/release/kustomization.yaml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2023 Nutanix. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

sortOptions:
order: fifo

commonAnnotations:
caren.nutanix.com/version: "${CAREN_RELEASE_VERSION}"

resources:
- "${CC_TEMPLATE}"
4 changes: 4 additions & 0 deletions make/goreleaser.mk
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ release-snapshot: go-generate ; $(info $(M) building snapshot release $*)
.PHONY: list-releases
list-releases: ## List releases from GitHub
gh release list --json tagName | gojq -r .[].tagName

.PHONY: add-version-to-clusterclasses
add-version-to-clusterclasses:
./hack/examples/release/add-version-to-clusterclasses.sh $(CAREN_VERSION)
Loading