From 220a067af7afc8ff53910acc320cbeb8da18d441 Mon Sep 17 00:00:00 2001 From: Johannes Edmeier Date: Sat, 27 Jan 2024 21:53:14 +0100 Subject: [PATCH] build: bump appVersion in Helm chart on release --- .github/workflows/ci.yml | 2 ++ Makefile | 12 +++++++ .../steadybit-extension-prometheus/Chart.yaml | 4 +-- .../templates/deployment.yaml | 2 +- .../__snapshot__/deployment_test.yaml.snap | 36 +++++++++---------- .../tests/deployment_test.yaml | 2 ++ .../values.yaml | 6 ++-- 7 files changed, 40 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da53a4c..6925437 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,9 @@ jobs: uses: steadybit/extension-kit/.github/workflows/reusable-extension-ci.yml@main with: build_linux_packages: false + VERSION_BUMPER_APPID: ${{ vars.GH_APP_STEADYBIT_APP_ID }} secrets: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} PAT_TOKEN_EXTENSION_DEPLOYER: ${{ secrets.PAT_TOKEN_EXTENSION_DEPLOYER }} SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} + VERSION_BUMPER_SECRET: ${{ secrets.GH_APP_STEADYBIT_PRIVATE_KEY }} diff --git a/Makefile b/Makefile index 423e3ed..3cafde6 100755 --- a/Makefile +++ b/Makefile @@ -54,6 +54,18 @@ charttesting: chartlint: ct lint --config chartTesting.yaml +## chart-bump-version: Bump the patch version and optionally set the appVersion +.PHONY: chart-bump-version +chart-bump-version: + @set -e; \ + for dir in charts/steadybit-extension-*; do \ + if [ ! -z "$(APP_VERSION)" ]; then \ + yq -i ".appVersion = strenv(APP_VERSION)" $$dir/Chart.yaml; \ + fi; \ + CHART_VERSION=$$(semver -i patch $$(yq '.version' $$dir/Chart.yaml)) \ + yq -i ".version = strenv(CHART_VERSION)" $$dir/Chart.yaml; \ + grep -e "^version:" -e "^appVersion:" $$dir/Chart.yaml; \ + done # ==================================================================================== # # BUILD # ==================================================================================== # diff --git a/charts/steadybit-extension-prometheus/Chart.yaml b/charts/steadybit-extension-prometheus/Chart.yaml index de21b14..468b1f8 100644 --- a/charts/steadybit-extension-prometheus/Chart.yaml +++ b/charts/steadybit-extension-prometheus/Chart.yaml @@ -1,8 +1,8 @@ apiVersion: v2 name: steadybit-extension-prometheus description: Steadybit Prometheus extension Helm chart for Kubernetes. -version: 1.4.23 -appVersion: latest +version: 1.5.0 +appVersion: v2.0.6 home: https://www.steadybit.com/ icon: https://steadybit-website-assets.s3.amazonaws.com/logo-symbol-transparent.png maintainers: diff --git a/charts/steadybit-extension-prometheus/templates/deployment.yaml b/charts/steadybit-extension-prometheus/templates/deployment.yaml index 2a6f5a2..9304eb1 100644 --- a/charts/steadybit-extension-prometheus/templates/deployment.yaml +++ b/charts/steadybit-extension-prometheus/templates/deployment.yaml @@ -38,7 +38,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} containers: - - image: {{ .Values.image.name }}:{{ .Values.image.tag }} + - image: {{ .Values.image.name }}:{{ default .Chart.AppVersion .Values.image.tag }} imagePullPolicy: {{ .Values.image.pullPolicy }} name: extension resources: diff --git a/charts/steadybit-extension-prometheus/tests/__snapshot__/deployment_test.yaml.snap b/charts/steadybit-extension-prometheus/tests/__snapshot__/deployment_test.yaml.snap index 61aa260..e9761bf 100644 --- a/charts/steadybit-extension-prometheus/tests/__snapshot__/deployment_test.yaml.snap +++ b/charts/steadybit-extension-prometheus/tests/__snapshot__/deployment_test.yaml.snap @@ -36,8 +36,8 @@ manifest should match snapshot using podAnnotations and Labels: value: null - name: STEADYBIT_EXTENSION_PROMETHEUS_INSTANCE_0_ORIGIN value: null - image: ghcr.io/steadybit/extension-prometheus:latest - imagePullPolicy: Always + image: ghcr.io/steadybit/extension-prometheus:v0.0.0 + imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 5 httpGet: @@ -116,8 +116,8 @@ manifest should match snapshot with TLS: value: null - name: STEADYBIT_EXTENSION_PROMETHEUS_INSTANCE_0_ORIGIN value: null - image: ghcr.io/steadybit/extension-prometheus:latest - imagePullPolicy: Always + image: ghcr.io/steadybit/extension-prometheus:v0.0.0 + imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 5 httpGet: @@ -206,8 +206,8 @@ manifest should match snapshot with extra env vars: name: env-configmap - name: env-secrets secretRef: null - image: ghcr.io/steadybit/extension-prometheus:latest - imagePullPolicy: Always + image: ghcr.io/steadybit/extension-prometheus:v0.0.0 + imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 5 httpGet: @@ -284,8 +284,8 @@ manifest should match snapshot with extra labels: value: null - name: STEADYBIT_EXTENSION_PROMETHEUS_INSTANCE_0_ORIGIN value: null - image: ghcr.io/steadybit/extension-prometheus:latest - imagePullPolicy: Always + image: ghcr.io/steadybit/extension-prometheus:v0.0.0 + imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 5 httpGet: @@ -366,8 +366,8 @@ manifest should match snapshot with mutual TLS: value: null - name: STEADYBIT_EXTENSION_PROMETHEUS_INSTANCE_0_ORIGIN value: null - image: ghcr.io/steadybit/extension-prometheus:latest - imagePullPolicy: Always + image: ghcr.io/steadybit/extension-prometheus:v0.0.0 + imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 5 httpGet: @@ -462,8 +462,8 @@ manifest should match snapshot with mutual TLS using containerPaths: value: null - name: STEADYBIT_EXTENSION_PROMETHEUS_INSTANCE_0_ORIGIN value: null - image: ghcr.io/steadybit/extension-prometheus:latest - imagePullPolicy: Always + image: ghcr.io/steadybit/extension-prometheus:v0.0.0 + imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 5 httpGet: @@ -538,8 +538,8 @@ manifest should match snapshot with podSecurityContext: value: null - name: STEADYBIT_EXTENSION_PROMETHEUS_INSTANCE_0_ORIGIN value: null - image: ghcr.io/steadybit/extension-prometheus:latest - imagePullPolicy: Always + image: ghcr.io/steadybit/extension-prometheus:v0.0.0 + imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 5 httpGet: @@ -616,8 +616,8 @@ manifest should match snapshot with priority class: value: null - name: STEADYBIT_EXTENSION_PROMETHEUS_INSTANCE_0_ORIGIN value: null - image: ghcr.io/steadybit/extension-prometheus:latest - imagePullPolicy: Always + image: ghcr.io/steadybit/extension-prometheus:v0.0.0 + imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 5 httpGet: @@ -693,8 +693,8 @@ manifest should match snapshot without TLS: value: null - name: STEADYBIT_EXTENSION_PROMETHEUS_INSTANCE_0_ORIGIN value: null - image: ghcr.io/steadybit/extension-prometheus:latest - imagePullPolicy: Always + image: ghcr.io/steadybit/extension-prometheus:v0.0.0 + imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 5 httpGet: diff --git a/charts/steadybit-extension-prometheus/tests/deployment_test.yaml b/charts/steadybit-extension-prometheus/tests/deployment_test.yaml index ee19f08..b6ae49f 100644 --- a/charts/steadybit-extension-prometheus/tests/deployment_test.yaml +++ b/charts/steadybit-extension-prometheus/tests/deployment_test.yaml @@ -1,5 +1,7 @@ templates: - deployment.yaml +chart: + appVersion: v0.0.0 tests: - it: manifest should match snapshot without TLS asserts: diff --git a/charts/steadybit-extension-prometheus/values.yaml b/charts/steadybit-extension-prometheus/values.yaml index 80619b7..54ab974 100644 --- a/charts/steadybit-extension-prometheus/values.yaml +++ b/charts/steadybit-extension-prometheus/values.yaml @@ -11,11 +11,11 @@ prometheus: image: # image.name -- The container image to use for the steadybit prometheus extension. name: ghcr.io/steadybit/extension-prometheus - # image.tag -- tag name of the extension-prometheus container image to use. + # image.tag -- tag name of the extension-prometheus container image to use. Defaults to appVersion of this chart. # See https://hub.docker.com/r/steadybit/extension-prometheus for all tags. - tag: latest + tag: null # image.pullPolicy -- Specifies when to pull the image container. - pullPolicy: Always + pullPolicy: IfNotPresent tls: server: