From 685f033f1e8747c1ff7b0729f4b68fc38c4ec514 Mon Sep 17 00:00:00 2001 From: eromanova Date: Wed, 17 Jul 2024 16:21:09 +0400 Subject: [PATCH] Use version instead of appVersion in templates generator --- Makefile | 9 ++++++--- hack/templates.sh | 4 ++-- .../hmc-templates/files/templates/aws-hosted-cp.yaml | 2 +- .../hmc-templates/files/templates/aws-standalone-cp.yaml | 2 +- .../files/templates/cluster-api-provider-aws.yaml | 2 +- templates/hmc-templates/files/templates/cluster-api.yaml | 2 +- templates/hmc-templates/files/templates/hmc.yaml | 2 +- templates/hmc-templates/files/templates/k0smotron.yaml | 2 +- 8 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 161a2b5fd..76c166c60 100644 --- a/Makefile +++ b/Makefile @@ -64,14 +64,17 @@ hmc-chart-generate: kustomize helmify yq ## Generate hmc helm chart $(KUSTOMIZE) build config/default | $(HELMIFY) templates/hmc $(YQ) eval -iN '' templates/hmc/values.yaml config/default/hmc_values.yaml +.PHONY: set-hmc-version +set-hmc-version: + $(YQ) eval '.version = "$(VERSION)"' -i templates/hmc/Chart.yaml + $(YQ) eval '.version = "$(VERSION)"' -i templates/hmc-templates/Chart.yaml + .PHONY: hmc-chart-release -hmc-chart-release: kustomize helmify yq ## Generate hmc helm chart +hmc-chart-release: kustomize helmify yq set-hmc-version templates-generate ## Generate hmc helm chart rm -rf templates/hmc/values.yaml templates/hmc/templates/*.yaml cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} $(KUSTOMIZE) build config/default | $(HELMIFY) templates/hmc $(YQ) eval -iN '' templates/hmc/values.yaml config/default/hmc_values.yaml - $(YQ) eval '.version = "$(VERSION)"' -i templates/hmc/Chart.yaml - $(YQ) eval '.version = "$(VERSION)"' -i templates/hmc-templates/Chart.yaml .PHONY: hmc-dist-release hmc-dist-release: diff --git a/hack/templates.sh b/hack/templates.sh index 36f21269d..a17a222ee 100755 --- a/hack/templates.sh +++ b/hack/templates.sh @@ -30,7 +30,7 @@ for chart in $TEMPLATES_DIR/*; do if [ -d "$chart" ]; then name=$(grep '^name:' $chart/Chart.yaml | awk '{print $2}') if [ "$name" = "$HMC_TEMPLATES_CHART_NAME" ]; then continue; fi - appVersion=$(grep '^appVersion:' $chart/Chart.yaml | awk '{print $2}') + version=$(grep '^version:' $chart/Chart.yaml | awk '{print $2}') cat < $TEMPLATES_OUTPUT_DIR/$name.yaml apiVersion: hmc.mirantis.com/v1alpha1 @@ -40,7 +40,7 @@ metadata: spec: helm: chartName: $name - chartVersion: $appVersion + chartVersion: $version EOF echo "Generated $TEMPLATES_OUTPUT_DIR/$name.yaml" diff --git a/templates/hmc-templates/files/templates/aws-hosted-cp.yaml b/templates/hmc-templates/files/templates/aws-hosted-cp.yaml index 8ad89d1c8..6ec084106 100644 --- a/templates/hmc-templates/files/templates/aws-hosted-cp.yaml +++ b/templates/hmc-templates/files/templates/aws-hosted-cp.yaml @@ -5,4 +5,4 @@ metadata: spec: helm: chartName: aws-hosted-cp - chartVersion: "0.1.0" + chartVersion: 0.1.0 diff --git a/templates/hmc-templates/files/templates/aws-standalone-cp.yaml b/templates/hmc-templates/files/templates/aws-standalone-cp.yaml index 5fe412674..cefb224e6 100644 --- a/templates/hmc-templates/files/templates/aws-standalone-cp.yaml +++ b/templates/hmc-templates/files/templates/aws-standalone-cp.yaml @@ -5,4 +5,4 @@ metadata: spec: helm: chartName: aws-standalone-cp - chartVersion: "0.1.0" + chartVersion: 0.1.0 diff --git a/templates/hmc-templates/files/templates/cluster-api-provider-aws.yaml b/templates/hmc-templates/files/templates/cluster-api-provider-aws.yaml index 0f7e487d1..d4c9d4821 100644 --- a/templates/hmc-templates/files/templates/cluster-api-provider-aws.yaml +++ b/templates/hmc-templates/files/templates/cluster-api-provider-aws.yaml @@ -5,4 +5,4 @@ metadata: spec: helm: chartName: cluster-api-provider-aws - chartVersion: "0.1.0" + chartVersion: 0.1.0 diff --git a/templates/hmc-templates/files/templates/cluster-api.yaml b/templates/hmc-templates/files/templates/cluster-api.yaml index 5d5866852..b416a211d 100644 --- a/templates/hmc-templates/files/templates/cluster-api.yaml +++ b/templates/hmc-templates/files/templates/cluster-api.yaml @@ -5,4 +5,4 @@ metadata: spec: helm: chartName: cluster-api - chartVersion: "0.1.0" + chartVersion: 0.1.0 diff --git a/templates/hmc-templates/files/templates/hmc.yaml b/templates/hmc-templates/files/templates/hmc.yaml index 14c26a494..5dceb1c29 100644 --- a/templates/hmc-templates/files/templates/hmc.yaml +++ b/templates/hmc-templates/files/templates/hmc.yaml @@ -5,4 +5,4 @@ metadata: spec: helm: chartName: hmc - chartVersion: "0.1.0" + chartVersion: 0.1.0 diff --git a/templates/hmc-templates/files/templates/k0smotron.yaml b/templates/hmc-templates/files/templates/k0smotron.yaml index 2daeb4b16..b3c736f8f 100644 --- a/templates/hmc-templates/files/templates/k0smotron.yaml +++ b/templates/hmc-templates/files/templates/k0smotron.yaml @@ -5,4 +5,4 @@ metadata: spec: helm: chartName: k0smotron - chartVersion: "0.1.0" + chartVersion: 0.1.0