From 257d57eddaf1462008882bc255442f47de6f050e Mon Sep 17 00:00:00 2001 From: Arvind Iyengar Date: Sun, 29 Jan 2023 18:57:14 -0800 Subject: [PATCH] Ensure that appVersion always matches .image.tag --- Dockerfile.dapper | 3 +++ scripts/ci | 1 + scripts/validate-chart | 12 ++++++++++++ 3 files changed, 16 insertions(+) create mode 100755 scripts/validate-chart diff --git a/Dockerfile.dapper b/Dockerfile.dapper index ac4f0e9..0d81129 100644 --- a/Dockerfile.dapper +++ b/Dockerfile.dapper @@ -14,6 +14,9 @@ RUN if [ "${ARCH}" == "amd64" ]; then \ curl -sL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.40.1; \ fi +ENV YQ_VERSION=v4.25.1 +RUN wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_${ARCH} -O /usr/bin/yq && chmod +x /usr/bin/yq; + COPY --from=helm ./helm/bin/helm /usr/local/bin/ ENV DAPPER_ENV REPO TAG DRONE_TAG CROSS diff --git a/scripts/ci b/scripts/ci index 5233410..2df510e 100755 --- a/scripts/ci +++ b/scripts/ci @@ -7,4 +7,5 @@ cd $(dirname $0) ./test ./validate ./validate-ci +./validate-chart ./package diff --git a/scripts/validate-chart b/scripts/validate-chart new file mode 100755 index 0000000..120e808 --- /dev/null +++ b/scripts/validate-chart @@ -0,0 +1,12 @@ +#!/bin/bash +set -e + +cd $(dirname $0)/.. + +app_version=$(yq e '.appVersion' charts/helm-project-operator/Chart.yaml) +image_tag=$(yq e '.image.tag' charts/helm-project-operator/values.yaml) + +if [[ "${image_tag}" != "v${app_version}" ]]; then + echo "ERROR: .image.tag in charts/helm-project-operator/values.yaml (found: ${image_tag}) must match appVersion in charts/helm-project-operator/Chart.yaml (found ${app_version})" + exit 1 +fi