From f4fbc42833568c542ccd5cf6df4c53355b25611c Mon Sep 17 00:00:00 2001 From: Stuart Douglas Date: Mon, 14 Oct 2024 10:37:04 +1100 Subject: [PATCH] feat: release charts from GH repo (#3095) --- .github/workflows/release.yml | 39 +++++++++++++++---- .gitignore | 4 +- charts/Justfile | 16 ++------ charts/{ => ftl}/Chart.lock | 0 charts/{ => ftl}/Chart.yaml | 0 charts/{ => ftl}/templates/_helpers.tpl | 0 .../{ => ftl}/templates/controller-role.yaml | 0 .../templates/controller-services.yaml | 0 charts/{ => ftl}/templates/controller.yaml | 0 .../{ => ftl}/templates/db-migration-job.yaml | 0 charts/{ => ftl}/templates/ingress.yaml | 0 charts/{ => ftl}/templates/istio.yaml | 0 charts/{ => ftl}/templates/runner.yaml | 0 charts/{ => ftl}/templates/secrets.yaml | 0 charts/{ => ftl}/values.yaml | 0 15 files changed, 38 insertions(+), 21 deletions(-) rename charts/{ => ftl}/Chart.lock (100%) rename charts/{ => ftl}/Chart.yaml (100%) rename charts/{ => ftl}/templates/_helpers.tpl (100%) rename charts/{ => ftl}/templates/controller-role.yaml (100%) rename charts/{ => ftl}/templates/controller-services.yaml (100%) rename charts/{ => ftl}/templates/controller.yaml (100%) rename charts/{ => ftl}/templates/db-migration-job.yaml (100%) rename charts/{ => ftl}/templates/ingress.yaml (100%) rename charts/{ => ftl}/templates/istio.yaml (100%) rename charts/{ => ftl}/templates/runner.yaml (100%) rename charts/{ => ftl}/templates/secrets.yaml (100%) rename charts/{ => ftl}/values.yaml (100%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e0e75695c1..d1889b5f0b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -101,13 +101,6 @@ jobs: with: username: ftl0 password: ${{ secrets.FTL_DOCKER_PUSH_TOKEN }} - - name: Push Helm Chart - run: | - helm registry login -u ftl0 -p "$PASSWORD" registry-1.docker.io - version="$(git describe --tags --abbrev=0 | sed 's/v//')" - just chart release oci://registry-1.docker.io/ftl0 "$version" - env: - PASSWORD: ${{ secrets.FTL_DOCKER_PUSH_TOKEN }} - name: Push Docker Images run: | version="$(git describe --tags --abbrev=0)" @@ -225,3 +218,35 @@ jobs: just publish-extension env: VSCE_PAT: ${{ secrets.VSCE_PAT }} + helm-release: + name: Release Helm Charts + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + name: "Checkout Charts Repository" + with: + repository: 'stuartwdouglas/ftl-charts' + token: '${{ secrets.FTL_CHARTS_TOKEN }}' + fetch-depth: 0 + - name: Checkout FTL + uses: actions/checkout@v4 + with: + fetch-depth: 0 + path: .ftl + - name: Init Hermit + uses: cashapp/activate-hermit@v1.1.3 + with: + working-directory: '.ftl' + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + git config pull.rebase true + - name: Sync Charts to Charts Repository + run: | + version="$(git describe --tags --abbrev=0 | sed 's/v//')" + ( cd .ftl && just chart set-version "$version" ) + cp -r .ftl/charts/ charts/ + git add charts + git commit -a -m "Update charts" + git push \ No newline at end of file diff --git a/.gitignore b/.gitignore index e9757147c6..3ba679daaf 100644 --- a/.gitignore +++ b/.gitignore @@ -46,5 +46,5 @@ junit*.xml .ftl.lock docker-build/ **/.ftl -charts/charts/ -charts/output/ \ No newline at end of file +charts/**/charts/ +charts/**/output/ \ No newline at end of file diff --git a/charts/Justfile b/charts/Justfile index 9b091ba5a2..22c4fc6393 100755 --- a/charts/Justfile +++ b/charts/Justfile @@ -2,20 +2,12 @@ _help: @just -l dep-update: - helm dep update . + helm dep update ftl set-version version: @echo "Setting version to {{version}}" - yq -i '.version="{{version}}",.appVersion="{{version}}"' Chart.yaml + yq -i '.version="{{version}}",.appVersion="{{version}}"' ftl/Chart.yaml package: - helm lint . - helm package -u . -d output - -publish repo version: - helm push output/ftl-chart-{{version}}.tgz {{repo}} - -release repo version: - just set-version {{version}} - just package - just publish {{repo}} {{version}} \ No newline at end of file + helm lint ftl + helm package -u ftl -d output diff --git a/charts/Chart.lock b/charts/ftl/Chart.lock similarity index 100% rename from charts/Chart.lock rename to charts/ftl/Chart.lock diff --git a/charts/Chart.yaml b/charts/ftl/Chart.yaml similarity index 100% rename from charts/Chart.yaml rename to charts/ftl/Chart.yaml diff --git a/charts/templates/_helpers.tpl b/charts/ftl/templates/_helpers.tpl similarity index 100% rename from charts/templates/_helpers.tpl rename to charts/ftl/templates/_helpers.tpl diff --git a/charts/templates/controller-role.yaml b/charts/ftl/templates/controller-role.yaml similarity index 100% rename from charts/templates/controller-role.yaml rename to charts/ftl/templates/controller-role.yaml diff --git a/charts/templates/controller-services.yaml b/charts/ftl/templates/controller-services.yaml similarity index 100% rename from charts/templates/controller-services.yaml rename to charts/ftl/templates/controller-services.yaml diff --git a/charts/templates/controller.yaml b/charts/ftl/templates/controller.yaml similarity index 100% rename from charts/templates/controller.yaml rename to charts/ftl/templates/controller.yaml diff --git a/charts/templates/db-migration-job.yaml b/charts/ftl/templates/db-migration-job.yaml similarity index 100% rename from charts/templates/db-migration-job.yaml rename to charts/ftl/templates/db-migration-job.yaml diff --git a/charts/templates/ingress.yaml b/charts/ftl/templates/ingress.yaml similarity index 100% rename from charts/templates/ingress.yaml rename to charts/ftl/templates/ingress.yaml diff --git a/charts/templates/istio.yaml b/charts/ftl/templates/istio.yaml similarity index 100% rename from charts/templates/istio.yaml rename to charts/ftl/templates/istio.yaml diff --git a/charts/templates/runner.yaml b/charts/ftl/templates/runner.yaml similarity index 100% rename from charts/templates/runner.yaml rename to charts/ftl/templates/runner.yaml diff --git a/charts/templates/secrets.yaml b/charts/ftl/templates/secrets.yaml similarity index 100% rename from charts/templates/secrets.yaml rename to charts/ftl/templates/secrets.yaml diff --git a/charts/values.yaml b/charts/ftl/values.yaml similarity index 100% rename from charts/values.yaml rename to charts/ftl/values.yaml