@@ -36,16 +36,17 @@ vars:
3636 kustomize :
3737 url : sigs.k8s.io/kustomize/kustomize/v5
3838 version : 5.7.1
39- jq :
40- url : github.com/itchyny/gojq/cmd/gojq
41- version : 0.12.17
39+ # not the good yq, but the good one has no "just run" option
40+ yq :
41+ url : github.com/mikefarah/yq/v4
42+ version : 4.49.2
4243 controllerGenCmd : ' go run {{ (index .tools "controller-gen").url }}@v{{ (index .tools "controller-gen").version }}'
4344 conversionGenCmd : ' go run {{ (index .tools "conversion-gen").url }}@v{{ (index .tools "conversion-gen").version }}'
4445 golangciLintCmd : ' go run {{ (index .tools "golangci-lint").url }}@v{{ (index .tools "golangci-lint").version }}'
4546 gofumptCmd : ' go run {{ (index .tools "gofumpt").url }}@v{{ (index .tools "gofumpt").version }}'
4647 golinesCmd : ' go run {{ (index .tools "golines").url }}@v{{ (index .tools "golines").version }}'
4748 kustomizeCmd : ' go run {{ (index .tools "kustomize").url }}@v{{ (index .tools "kustomize").version }}'
48- jqCmd : ' go run {{ (index .tools "jq ").url }}@v{{ (index .tools "jq ").version }}'
49+ yqCmd : ' go run {{ (index .tools "yq ").url }}@v{{ (index .tools "yq ").version }}'
4950 buildDir : build
5051 artifactsDir : _artifacts
5152 # TODO: until https://github.com/go-task/task/issues/178 is done
@@ -68,21 +69,18 @@ tasks:
6869 declare -a supportedVersions
6970 mapfile -t supportedVersions <<< "$(sed -n -r 's#^\s+cluster.x-k8s.io/(v\S+): \S+#\1#gp' {{ .buildDir }}/crds/controlplane.* | sort -u)"
7071 declare -a currentVersion
71- mapfile -t currentVersion <<< "$({{ .jqCmd }} -r '.["."] | split(".") | "\(.[0])\n\(.[1])"' .github/release-please/manifest.json)"
72- (
73- cat <<EOF
72+ mapfile -t currentVersion <<< "$({{ .yqCmd }} -r '.["."] | split(".") | "\(.[0])\n\(.[1])"' .github/release-please/manifest.json)"
73+ if ! [[ -f metadata.yaml ]]; then
74+ cat <<EOF | cut -c 5- > metadata.yaml
7475 apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3
7576 kind: Metadata
76- releaseSeries:
77+ releaseSeries: []
7778 EOF
78- for version in "${supportedVersions[@]}"; do
79- cat <<EOF
80- - major: ${currentVersion[0]}
81- minor: ${currentVersion[1]}
82- contract: ${version}
83- EOF
84- done
85- ) | cut -c 5- > {{ .buildDir }}/metadata.yaml
79+ fi
80+ for version in "${supportedVersions[@]}"; do
81+ MAJOR="${currentVersion[0]}" MINOR="${currentVersion[1]}" VERSION="$version" {{ .yqCmd }} -i '.releaseSeries = (.releaseSeries + [{"major":env(MAJOR),"minor":env(MINOR),"contract":strenv(VERSION)}] | unique | sort_by(.major, .minor) | reverse)' metadata.yaml
82+ done
83+ mv metadata.yaml {{ .buildDir }}/metadata.yaml
8684 generates :
8785 - " {{ .buildDir }}/control-plane-components.yaml"
8886 - " {{ .buildDir }}/metadata.yaml"
@@ -179,7 +177,7 @@ tasks:
179177 arch : ' {{ .arch | default ARCH }}'
180178 oldDigests :
181179 sh : >-
182- (buildah manifest inspect {{ .IMAGE }} 2> /dev/null || echo '{}') | {{ .jqCmd }} -r '.manifests // [] | map(select(.platform.architecture == "{{ .arch }}")) | map(.digest)[]' 2>/dev/null || true
180+ (buildah manifest inspect {{ .IMAGE }} 2> /dev/null || echo '{}') | {{ .yqCmd }} -r '.manifests // [] | map(select(.platform.architecture == "{{ .arch }}")) | map(.digest)[]' 2>/dev/null || true
183181 sources :
184182 - Containerfile
185183 - .containerignore
0 commit comments