From a2ef47ca8062b93184468389df14e187edfdbac3 Mon Sep 17 00:00:00 2001 From: Timo Notheisen <65653426+tnotheis@users.noreply.github.com> Date: Tue, 23 Apr 2024 15:59:17 +0200 Subject: [PATCH] Unify all deliverables under a single verison (#614) * ci: combine all publish workflows into one * chore: read version for all subcharts from values.global.chartVersion * fix: add eventhandler to global Chart.yaml * chore: set values.global.chartVersion in buildChart script * ci: replace __appVersion__ in all Chart.yaml files * chore: improve explaining comment --- .ci/helm/buildChart.js | 4 + .github/workflows/publish-acli.yml | 46 ------- .github/workflows/publish-aui.yml | 46 ------- .github/workflows/publish-capi.yml | 46 ------- .github/workflows/publish-ehs.yml | 46 ------- .github/workflows/publish-fsc.yml | 46 ------- .github/workflows/publish-helm.yml | 36 ----- .github/workflows/publish.yml | 196 ++++++++++++++++++++++++++++ helm/Chart.yaml | 3 + helm/charts/admincli/Chart.yaml | 2 +- helm/charts/adminui/Chart.yaml | 2 +- helm/charts/consumerapi/Chart.yaml | 2 +- helm/charts/eventhandler/Chart.yaml | 2 +- 13 files changed, 207 insertions(+), 270 deletions(-) delete mode 100644 .github/workflows/publish-acli.yml delete mode 100644 .github/workflows/publish-aui.yml delete mode 100644 .github/workflows/publish-capi.yml delete mode 100644 .github/workflows/publish-ehs.yml delete mode 100644 .github/workflows/publish-fsc.yml delete mode 100644 .github/workflows/publish-helm.yml create mode 100644 .github/workflows/publish.yml diff --git a/.ci/helm/buildChart.js b/.ci/helm/buildChart.js index 2f9eb9e25a..ed917a0e9e 100755 --- a/.ci/helm/buildChart.js +++ b/.ci/helm/buildChart.js @@ -6,4 +6,8 @@ import { getRequiredEnvVar } from "../lib.js"; const version = getRequiredEnvVar("VERSION"); await $`helm dependency update helm`; + +// replace <> with the value of `version` in all Chart.yaml files in helm folder +await $`find helm -name Chart.yaml -exec sed -i -e 's/__app_version__/${version}/g' {} +`; + await $`helm package --version ${version} helm`; diff --git a/.github/workflows/publish-acli.yml b/.github/workflows/publish-acli.yml deleted file mode 100644 index 309ca8ac14..0000000000 --- a/.github/workflows/publish-acli.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Publish Admin CLI Container Image - -on: - push: - tags: - - "acli/*" - -jobs: - publish-acli-container-image: - name: Publish Admin CLI Container Image - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install script dependencies - run: npm install --prefix ./.ci - - name: Docker Login - uses: docker/login-action@v3.0.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract version from git tag - id: extract-version-from-git-tag - run: echo "VERSION=$(./.ci/extractVersionFromGitTag.js)" >> $GITHUB_OUTPUT - env: - GIT_TAG: ${{ github.ref_name }} - - name: Log in to Docker Hub for accessing the cloud builder - uses: docker/login-action@v3 - with: - username: ${{ secrets.CLOUD_BUILDER_USERNAME }} - password: ${{ secrets.CLOUD_BUILDER_TOKEN }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - version: "lab:latest" - driver: cloud - endpoint: "jssoft/js-soft" - - name: Build and Push Container Image - run: ./.ci/acli/buildContainerImage.js - env: - TAG: ${{ steps.extract-version-from-git-tag.outputs.VERSION }} - PUSH: 1 diff --git a/.github/workflows/publish-aui.yml b/.github/workflows/publish-aui.yml deleted file mode 100644 index ef7c533d76..0000000000 --- a/.github/workflows/publish-aui.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Publish Admin UI Container Image - -on: - push: - tags: - - "aui/*" - -jobs: - publish-aui-container-image: - name: Publish Admin UI Container Image - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install script dependencies - run: npm install --prefix ./.ci - - name: Docker Login - uses: docker/login-action@v3.0.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract version from git tag - id: extract-version-from-git-tag - run: echo "VERSION=$(./.ci/extractVersionFromGitTag.js)" >> $GITHUB_OUTPUT - env: - GIT_TAG: ${{ github.ref_name }} - - name: Log in to Docker Hub for accessing the cloud builder - uses: docker/login-action@v3 - with: - username: ${{ secrets.CLOUD_BUILDER_USERNAME }} - password: ${{ secrets.CLOUD_BUILDER_TOKEN }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - version: "lab:latest" - driver: cloud - endpoint: "jssoft/js-soft" - - name: Build and Push Container Image - run: ./.ci/aui/buildContainerImage.js - env: - TAG: ${{ steps.extract-version-from-git-tag.outputs.VERSION }} - PUSH: 1 diff --git a/.github/workflows/publish-capi.yml b/.github/workflows/publish-capi.yml deleted file mode 100644 index a317e8b83b..0000000000 --- a/.github/workflows/publish-capi.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Publish Consumer API Container Image - -on: - push: - tags: - - "capi/*" - -jobs: - publish-capi-container-image: - name: Publish Consumer API Container Image - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install script dependencies - run: npm install --prefix ./.ci - - name: Docker Login - uses: docker/login-action@v3.0.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract version from git tag - id: extract-version-from-git-tag - run: echo "VERSION=$(./.ci/extractVersionFromGitTag.js)" >> $GITHUB_OUTPUT - env: - GIT_TAG: ${{ github.ref_name }} - - name: Log in to Docker Hub for accessing the cloud builder - uses: docker/login-action@v3 - with: - username: ${{ secrets.CLOUD_BUILDER_USERNAME }} - password: ${{ secrets.CLOUD_BUILDER_TOKEN }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - version: "lab:latest" - driver: cloud - endpoint: "jssoft/js-soft" - - name: Build and Push Container Image - run: ./.ci/capi/buildContainerImage.js - env: - TAG: ${{ steps.extract-version-from-git-tag.outputs.VERSION }} - PUSH: 1 diff --git a/.github/workflows/publish-ehs.yml b/.github/workflows/publish-ehs.yml deleted file mode 100644 index f0ce2fc1d1..0000000000 --- a/.github/workflows/publish-ehs.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Publish Event Handler Service Container Image - -on: - push: - tags: - - "eh/*" - -jobs: - publish-eh-container-image: - name: Publish Event Handler Service Container Image - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install script dependencies - run: npm install --prefix ./.ci - - name: Docker Login - uses: docker/login-action@v3.0.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract version from git tag - id: extract-version-from-git-tag - run: echo "VERSION=$(./.ci/extractVersionFromGitTag.js)" >> $GITHUB_OUTPUT - env: - GIT_TAG: ${{ github.ref_name }} - - name: Log in to Docker Hub for accessing the cloud builder - uses: docker/login-action@v3 - with: - username: ${{ secrets.CLOUD_BUILDER_USERNAME }} - password: ${{ secrets.CLOUD_BUILDER_TOKEN }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - version: "lab:latest" - driver: cloud - endpoint: "jssoft/js-soft" - - name: Build and Push Container Image - run: ./.ci/eh/buildContainerImage.js - env: - TAG: ${{ steps.extract-version-from-git-tag.outputs.VERSION }} - PUSH: 1 diff --git a/.github/workflows/publish-fsc.yml b/.github/workflows/publish-fsc.yml deleted file mode 100644 index dada44bcf5..0000000000 --- a/.github/workflows/publish-fsc.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Publish Files Sanity Check Container Image - -on: - push: - tags: - - "fsc/*" - -jobs: - publish-fsc-container-image: - name: Publish Files Sanity Check Container Image - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install script dependencies - run: npm install --prefix ./.ci - - name: Docker Login - uses: docker/login-action@v3.0.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract version from git tag - id: extract-version-from-git-tag - run: echo "VERSION=$(./.ci/extractVersionFromGitTag.js)" >> $GITHUB_OUTPUT - env: - GIT_TAG: ${{ github.ref_name }} - - name: Log in to Docker Hub for accessing the cloud builder - uses: docker/login-action@v3 - with: - username: ${{ secrets.CLOUD_BUILDER_USERNAME }} - password: ${{ secrets.CLOUD_BUILDER_TOKEN }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - version: "lab:latest" - driver: cloud - endpoint: "jssoft/js-soft" - - name: Build and Push Container Image - run: ./.ci/sc/buildContainerImage.js - env: - TAG: ${{ steps.extract-version-from-git-tag.outputs.VERSION }} - PUSH: 1 diff --git a/.github/workflows/publish-helm.yml b/.github/workflows/publish-helm.yml deleted file mode 100644 index 3b5cf5ca9b..0000000000 --- a/.github/workflows/publish-helm.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Publish Helm Chart - -on: - push: - tags: - - "helm/*" - -jobs: - publish-helm-chart: - name: Publish Helm Chart - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install script dependencies - run: npm install --prefix ./.ci - - run: echo "$PASSWORD" | helm registry login -u $USER --password-stdin https://ghcr.io - env: - USER: ${{ github.actor }} - PASSWORD: ${{ secrets.GITHUB_TOKEN }} - - name: Extract version from git tag - id: extract-version-from-git-tag - run: echo "VERSION=$(./.ci/extractVersionFromGitTag.js)" >> $GITHUB_OUTPUT - env: - GIT_TAG: ${{ github.ref_name }} - - name: Build Helm Chart - run: ./.ci/helm/buildChart.js - env: - VERSION: ${{ steps.extract-version-from-git-tag.outputs.VERSION }} - - name: Push Helm Chart - run: ./.ci/helm/pushChart.js - env: - VERSION: ${{ steps.extract-version-from-git-tag.outputs.VERSION }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000000..eef6319349 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,196 @@ +name: Publish Helm Chart + +on: + push: + tags: "*" + +jobs: + publish-admin-cli: + name: Publish Admin CLI Container Image + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install script dependencies + run: npm install --prefix ./.ci + - name: Docker Login + uses: docker/login-action@v3.0.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract version from git tag + id: extract-version-from-git-tag + run: echo "VERSION=$(./.ci/extractVersionFromGitTag.js)" >> $GITHUB_OUTPUT + env: + GIT_TAG: ${{ github.ref_name }} + - name: Log in to Docker Hub for accessing the cloud builder + uses: docker/login-action@v3 + with: + username: ${{ secrets.CLOUD_BUILDER_USERNAME }} + password: ${{ secrets.CLOUD_BUILDER_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + version: "lab:latest" + driver: cloud + endpoint: "jssoft/js-soft" + - name: Build and Push Container Image + run: ./.ci/acli/buildContainerImage.js + env: + TAG: ${{ steps.extract-version-from-git-tag.outputs.VERSION }} + PUSH: 1 + + publish-admin-ui: + name: Publish Admin UI Container Image + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install script dependencies + run: npm install --prefix ./.ci + - name: Docker Login + uses: docker/login-action@v3.0.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract version from git tag + id: extract-version-from-git-tag + run: echo "VERSION=$(./.ci/extractVersionFromGitTag.js)" >> $GITHUB_OUTPUT + env: + GIT_TAG: ${{ github.ref_name }} + - name: Log in to Docker Hub for accessing the cloud builder + uses: docker/login-action@v3 + with: + username: ${{ secrets.CLOUD_BUILDER_USERNAME }} + password: ${{ secrets.CLOUD_BUILDER_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + version: "lab:latest" + driver: cloud + endpoint: "jssoft/js-soft" + - name: Build and Push Container Image + run: ./.ci/aui/buildContainerImage.js + env: + TAG: ${{ steps.extract-version-from-git-tag.outputs.VERSION }} + PUSH: 1 + + publish-consumer-api: + name: Publish Consumer API Container Image + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install script dependencies + run: npm install --prefix ./.ci + - name: Docker Login + uses: docker/login-action@v3.0.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract version from git tag + id: extract-version-from-git-tag + run: echo "VERSION=$(./.ci/extractVersionFromGitTag.js)" >> $GITHUB_OUTPUT + env: + GIT_TAG: ${{ github.ref_name }} + - name: Log in to Docker Hub for accessing the cloud builder + uses: docker/login-action@v3 + with: + username: ${{ secrets.CLOUD_BUILDER_USERNAME }} + password: ${{ secrets.CLOUD_BUILDER_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + version: "lab:latest" + driver: cloud + endpoint: "jssoft/js-soft" + - name: Build and Push Container Image + run: ./.ci/capi/buildContainerImage.js + env: + TAG: ${{ steps.extract-version-from-git-tag.outputs.VERSION }} + PUSH: 1 + + publish-event-handler: + name: Publish Event Handler Service Container Image + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install script dependencies + run: npm install --prefix ./.ci + - name: Docker Login + uses: docker/login-action@v3.0.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract version from git tag + id: extract-version-from-git-tag + run: echo "VERSION=$(./.ci/extractVersionFromGitTag.js)" >> $GITHUB_OUTPUT + env: + GIT_TAG: ${{ github.ref_name }} + - name: Log in to Docker Hub for accessing the cloud builder + uses: docker/login-action@v3 + with: + username: ${{ secrets.CLOUD_BUILDER_USERNAME }} + password: ${{ secrets.CLOUD_BUILDER_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + version: "lab:latest" + driver: cloud + endpoint: "jssoft/js-soft" + - name: Build and Push Container Image + run: ./.ci/eh/buildContainerImage.js + env: + TAG: ${{ steps.extract-version-from-git-tag.outputs.VERSION }} + PUSH: 1 + + publish-helm-chart: + name: Publish Helm Chart + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + needs: + - publish-admin-cli + - publish-admin-ui + - publish-consumer-api + - publish-event-handler + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install script dependencies + run: npm install --prefix ./.ci + - run: echo "$PASSWORD" | helm registry login -u $USER --password-stdin https://ghcr.io + env: + USER: ${{ github.actor }} + PASSWORD: ${{ secrets.GITHUB_TOKEN }} + - name: Extract version from git tag + id: extract-version-from-git-tag + run: echo "VERSION=$(./.ci/extractVersionFromGitTag.js)" >> $GITHUB_OUTPUT + env: + GIT_TAG: ${{ github.ref_name }} + - name: Build Helm Chart + run: ./.ci/helm/buildChart.js + env: + VERSION: ${{ steps.extract-version-from-git-tag.outputs.VERSION }} + - name: Push Helm Chart + run: ./.ci/helm/pushChart.js + env: + VERSION: ${{ steps.extract-version-from-git-tag.outputs.VERSION }} diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 1095aa8030..d2abe8d5f2 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -16,6 +16,9 @@ dependencies: - name: consumerapi version: "*" repository: file://charts/consumerapi + - name: eventhandler + version: "*" + repository: file://charts/eventhandler icon: https://raw.githubusercontent.com/nmshd/nmshd.github.io/main/assets/images/Logo.svg home: https://enmeshed.eu diff --git a/helm/charts/admincli/Chart.yaml b/helm/charts/admincli/Chart.yaml index 29b396a176..54002a6002 100644 --- a/helm/charts/admincli/Chart.yaml +++ b/helm/charts/admincli/Chart.yaml @@ -6,4 +6,4 @@ type: application version: "1.0.0" -appVersion: "v2.2.3" +appVersion: "__appVersion__" diff --git a/helm/charts/adminui/Chart.yaml b/helm/charts/adminui/Chart.yaml index 9b57271b25..76d2c27b25 100644 --- a/helm/charts/adminui/Chart.yaml +++ b/helm/charts/adminui/Chart.yaml @@ -6,4 +6,4 @@ type: application version: "1.0.0" -appVersion: "v2.6.0" +appVersion: "__appVersion__" diff --git a/helm/charts/consumerapi/Chart.yaml b/helm/charts/consumerapi/Chart.yaml index 92e1dc0276..bf0efeb8cf 100644 --- a/helm/charts/consumerapi/Chart.yaml +++ b/helm/charts/consumerapi/Chart.yaml @@ -6,4 +6,4 @@ type: application version: "1.0.0" -appVersion: "v4.5.0" +appVersion: "__appVersion__" diff --git a/helm/charts/eventhandler/Chart.yaml b/helm/charts/eventhandler/Chart.yaml index 0fe584190b..7230025f17 100644 --- a/helm/charts/eventhandler/Chart.yaml +++ b/helm/charts/eventhandler/Chart.yaml @@ -6,4 +6,4 @@ type: application version: "1.0.0" -appVersion: "v1.0.0" +appVersion: "__appVersion__"