From 18ba957905afe7b9219bce85a567e1211cc0a07b Mon Sep 17 00:00:00 2001 From: Stuart Douglas Date: Fri, 11 Oct 2024 11:10:55 +1100 Subject: [PATCH] chore: release helm charts (#3078) --- .github/workflows/release.yml | 5 +++++ .gitignore | 3 ++- charts/Chart.yaml | 18 ++++++++---------- charts/Justfile | 18 +++++++++++++++++- charts/templates/controller.yaml | 2 +- charts/templates/db-migration-job.yaml | 4 ++-- charts/values.yaml | 1 - 7 files changed, 35 insertions(+), 16 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b6d3803af6..3756c873c2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -101,6 +101,10 @@ jobs: with: username: ftl0 password: ${{ secrets.FTL_DOCKER_PUSH_TOKEN }} + - name: Push Helm Chart + run: | + version="$(git describe --tags --abbrev=0 | sed s/v//)" + just chart release "$version" oci://ftl0/ftl-charts - name: Push Docker Images run: | version="$(git describe --tags --abbrev=0)" @@ -113,6 +117,7 @@ jobs: docker tag ftl0/ftl-box:latest ftl0/ftl-box:"$GITHUB_SHA" docker tag ftl0/ftl-box:latest ftl0/ftl-box:"$version" docker push -a ftl0/ftl-box + create-go-release: name: Release Go Binaries runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 3f570ba540..a5b48b30f5 100644 --- a/.gitignore +++ b/.gitignore @@ -45,4 +45,5 @@ junit*.xml .ftl.lock docker-build/ **/.ftl -charts/charts/ \ No newline at end of file +charts/charts/ +charts/output/ \ No newline at end of file diff --git a/charts/Chart.yaml b/charts/Chart.yaml index cb72c95dbe..ecac5214af 100644 --- a/charts/Chart.yaml +++ b/charts/Chart.yaml @@ -4,14 +4,12 @@ description: | A Helm chart for Kubernetes that deploys FTL home: https://github.com/TBD54566975/ftl version: 0.0.1 -appVersion: v0.354.1 - dependencies: -- name: postgresql - version: 15.5.29 - repository: oci://registry-1.docker.io/bitnamicharts - condition: postgresql.enabled -- name: harbor - version: v1.15.1 - repository: https://helm.goharbor.io - condition: harbor.enabled + - name: postgresql + version: 15.5.29 + repository: oci://registry-1.docker.io/bitnamicharts + condition: postgresql.enabled + - name: harbor + version: v1.15.1 + repository: https://helm.goharbor.io + condition: harbor.enabled diff --git a/charts/Justfile b/charts/Justfile index 880c6dc242..b822d4a2eb 100755 --- a/charts/Justfile +++ b/charts/Justfile @@ -2,4 +2,20 @@ _help: @just -l dep-update: - helm dep update . \ No newline at end of file + helm dep update . + +set-version version: + @echo "Setting version to {{version}}" + yq -i '.version="{{version}}"' Chart.yaml + +package: + helm lint . + helm package -u . -d output + +publish repo version: + helm push output/ftl-{{version}}.tgz {{repo}} + +release repo version: + just set-version version={{version}} + just package + just publish repo={{repo}} version={{version}} \ No newline at end of file diff --git a/charts/templates/controller.yaml b/charts/templates/controller.yaml index 4e50c87f45..525ffd7708 100644 --- a/charts/templates/controller.yaml +++ b/charts/templates/controller.yaml @@ -22,7 +22,7 @@ spec: serviceAccountName: {{ include "ftl.fullname" . }}-controller containers: - name: app - image: "{{ .Values.controller.image.repository }}:{{ .Values.controller.image.tag }}" + image: "{{ .Values.controller.image.repository }}:{{ .Values.controller.image.tag | default .Chart.Version }}" {{- if .Values.controller.envFrom }} envFrom: {{- if .Values.controller.envFrom }} diff --git a/charts/templates/db-migration-job.yaml b/charts/templates/db-migration-job.yaml index d592d68f33..09e8bca9ca 100644 --- a/charts/templates/db-migration-job.yaml +++ b/charts/templates/db-migration-job.yaml @@ -2,7 +2,7 @@ apiVersion: batch/v1 kind: Job metadata: - name: {{ include "ftl.fullname" . }}-dbmig-{{ .Values.controller.image.tag }} + name: {{ include "ftl.fullname" . }}-dbmig-{{ .Values.controller.image.tag | default .Chart.Version }} labels: {{- include "ftl.labels" . | nindent 4 }} spec: @@ -18,7 +18,7 @@ spec: restartPolicy: OnFailure containers: - name: dbmig - image: "{{ .Values.controller.image.repository | replace "controller" "runner" }}:{{ .Values.controller.image.tag }}" + image: "{{ .Values.controller.image.repository | replace "controller" "runner" }}:{{ .Values.controller.image.tag | default .Chart.Version }}" env: {{- if not .Values.postgresql.enabled }} - name: FTL_CONTROLLER_DSN diff --git a/charts/values.yaml b/charts/values.yaml index aa9a747137..72d0f2b25a 100644 --- a/charts/values.yaml +++ b/charts/values.yaml @@ -20,7 +20,6 @@ controller: image: repository: "ftl0/ftl-controller" - tag: "v0.361.2" envFrom: null dbConnectionString: "postgres://$(endpoint):$(port)/tbd?sslmode=disable&user=$(username)&password=$(password)"