From 026cfc566e7523c2a5b9e317be3c97495c0b2543 Mon Sep 17 00:00:00 2001 From: John Jeffers Date: Mon, 3 Jun 2024 16:33:44 -0600 Subject: [PATCH] use placeholder vars in chart files --- .github/workflows/release.yml | 27 ++++++++++++--------------- chart/Chart.yaml | 4 ++-- chart/README.md | 2 +- chart/examples/minikube/values.yaml | 2 +- chart/values.yaml | 2 +- 5 files changed, 17 insertions(+), 20 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 202e92a..3953925 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,6 @@ on: push: tags: - '**' - workflow_dispatch: jobs: release: @@ -17,20 +16,23 @@ jobs: with: fetch-depth: 0 - - name: update FusionAuth app version in misc files + - name: update placeholder versions working-directory: ./chart run: | - apk add -q curl jq - APP_VERSION=$(curl -s https://account.fusionauth.io/api/version | jq -r '.versions[]' | sort -V | tail -n 1) + apk add -q curl jq envsubst - echo "Chart: ${GITHUB_REF##*/}" + export APP_VERSION=$(curl -s https://account.fusionauth.io/api/version | jq -r '.versions[]' | sort -V | tail -n 1) + export CHART_VERSION="${GITHUB_REF##*/}" + + echo "Chart: $CHART_VERSION" echo "App: $APP_VERSION" - sed -i 's/\(version: \).*/\1'"${GITHUB_REF##*/}"'/' Chart.yaml - sed -i 's/\(appVersion: \).*/\1'"$APP_VERSION"'/' Chart.yaml - sed -i 's/\(^ tag: \).*/\1'"$APP_VERSION"'/' values.yaml - sed -i 's/\(^ tag: \).*/\1'"$APP_VERSION"'/' examples/minikube/values.yaml - sed -i '/| image.tag/s/\"\([^]]*\)\"/\"'"$APP_VERSION"'\"/' README.md + for file in Chart.yaml values.yaml README.md examples/minikube/values.yaml + do + tmpfile=$(mktemp) + cat "$file" > "$tmpfile" + envsubst < "$tmpfile" > "$file" + done echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV @@ -40,11 +42,6 @@ jobs: git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" git config --global --add safe.directory /__w/charts/charts - - name: commit app version - run: | - git commit -am "Update FusionAuth app version in chart to ${{ env.APP_VERSION }}" - git push - - name: Release id: release env: diff --git a/chart/Chart.yaml b/chart/Chart.yaml index 1da0a49..882619e 100644 --- a/chart/Chart.yaml +++ b/chart/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: fusionauth description: Helm chart for FusionAuth type: application -version: 0.0.0+dev -appVersion: "1.50.1" +version: ${CHART_VERSION} +appVersion: ${APP_VERSION} diff --git a/chart/README.md b/chart/README.md index 27aaf78..0d33ba8 100644 --- a/chart/README.md +++ b/chart/README.md @@ -86,7 +86,7 @@ The helm chart is versioned independently from FusionAuth app releases. However, | fullnameOverride | string | `""` | Overrides full resource names. | | image.pullPolicy | string | `"IfNotPresent"` | Kubernetes image pullPolicy to use for fusionauth-app. | | image.repository | string | `"fusionauth/fusionauth-app"` | The image repository to use for fusionauth-app. | -| image.tag | string | `"1.50.1"` | The image tag to pull for fusionauth-app (this is the fusionauth-app version). | +| image.tag | string | `"${APP_VERSION}"` | The image tag to pull for fusionauth-app (this is the fusionauth-app version). | | imagePullSecrets | list | `[]` | Configures Kubernetes secrets to use for pulling images from private repositories. | | ingress.annotations | object | `{}` | Configure annotations to add to the ingress object. | | ingress.enabled | bool | `false` | Enables ingress creation for fusionauth. | diff --git a/chart/examples/minikube/values.yaml b/chart/examples/minikube/values.yaml index cf78aa8..4ab4a47 100644 --- a/chart/examples/minikube/values.yaml +++ b/chart/examples/minikube/values.yaml @@ -8,7 +8,7 @@ image: # image.repository -- The name of the docker repository for fusionauth-app repository: fusionauth/fusionauth-app # image.repository -- The docker tag to pull for fusionauth-app - tag: 1.50.1 + tag: ${APP_VERSION} # image.pullPolicy -- Kubernetes image pullPolicy to use for fusionauth-app pullPolicy: IfNotPresent diff --git a/chart/values.yaml b/chart/values.yaml index 87a71b8..055d099 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -9,7 +9,7 @@ image: # image.repository -- The name of the docker repository for fusionauth-app repository: fusionauth/fusionauth-app # image.repository -- The docker tag to pull for fusionauth-app - tag: 1.50.1 + tag: ${APP_VERSION} # image.pullPolicy -- Kubernetes image pullPolicy to use for fusionauth-app pullPolicy: IfNotPresent