diff --git a/.github/workflows/check-for-release.yaml b/.github/workflows/check_for_release.yaml similarity index 100% rename from .github/workflows/check-for-release.yaml rename to .github/workflows/check_for_release.yaml diff --git a/.github/workflows/check_version.yaml b/.github/workflows/check_version.yaml index 718f58a..b2c9f7b 100644 --- a/.github/workflows/check_version.yaml +++ b/.github/workflows/check_version.yaml @@ -13,6 +13,8 @@ jobs: outputs: version_change: ${{ steps.check_for_version_change.outputs.version_change }} app_version_change: ${{ steps.check_for_appVersion_change.outputs.app_version_change }} + version: ${{ steps.chart_version.outputs.version }} + appVersion: ${{ steps.app_version.outputs.app_version }} steps: - name: Checkout code @@ -32,6 +34,18 @@ jobs: version_change=$(git diff main HEAD~1 -- deployments/chart/Chart.yaml | grep -qe "^[+-]version: " && echo "version changed" || echo "version didn't change") echo "version_change=$version_change" >> $GITHUB_OUTPUT + - name: Extract Chart Version + id: chart_version + run: | + version=$(yq e '.version' ./deployments/chart/Chart.yaml) + echo "version=$version" >> $GITHUB_OUTPUT + + - name: Extract App Version + id: app_version + run: | + app_version=$(yq e '.appVersion' ./deployments/chart/Chart.yaml) + echo "app_version=$app_version" >> $GITHUB_OUTPUT + build_new_chart: runs-on: ubuntu-latest needs: check_versions @@ -40,22 +54,13 @@ jobs: contents: write steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Extract Chart Version - id: chart_version - run: | - version=$(yq e '.version' ./deployments/chart/Chart.yaml) - echo "version=$version" >> $GITHUB_ENV - - name: Dispatch Event to build new helm chart uses: peter-evans/repository-dispatch@v3 with: token: ${{ secrets.GITHUB_TOKEN }} repository: caas-team/GoKubeDownscaler event-type: build-new-chart - client-payload: '{"version": "${{ env.version }}"}' + client-payload: '{"version": "${{ needs.check_versions.outputs.version }}", "appVersion": "${{ needs.check_versions.outputs.app_version }}"}' release_new_version: runs-on: ubuntu-latest @@ -65,19 +70,10 @@ jobs: contents: write steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Extract App Version - id: app_version - run: | - app_version=$(yq e '.appVersion' ./deployments/chart/Chart.yaml) - echo "app_version=$app_version" >> $GITHUB_ENV - - name: Dispatch Event to create new release uses: peter-evans/repository-dispatch@v3 with: token: ${{ secrets.GITHUB_TOKEN }} repository: caas-team/GoKubeDownscaler event-type: release-new-version - client-payload: '{"appVersion": "${{ env.app_version }}"}' + client-payload: '{"appVersion": "${{ needs.check_versions.outputs.app_version }}", "setLatest": true}' diff --git a/.github/workflows/create_dev_build.yaml b/.github/workflows/create_dev_build.yaml index 8c6a0be..81520ee 100644 --- a/.github/workflows/create_dev_build.yaml +++ b/.github/workflows/create_dev_build.yaml @@ -25,4 +25,4 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} repository: caas-team/GoKubeDownscaler event-type: create-dev-build - client-payload: '{"version": "${{ env.version }}-dev"}' + client-payload: '{"version": "${{ env.version }}-dev","appVersion": "dev", "setLatest": false}' diff --git a/.github/workflows/docker_build.yaml b/.github/workflows/docker_build.yaml index e249e3d..ce294b5 100644 --- a/.github/workflows/docker_build.yaml +++ b/.github/workflows/docker_build.yaml @@ -20,19 +20,9 @@ jobs: mtr.devops.telekom.de/caas/go-kube-downscaler ghcr.io/caas-team/gokubedownscaler tags: | - latest + ${{ github.event.client_payload.setLatest && 'latest' }} ${{ github.event.client_payload.appVersion }} - - name: Dev docker meta - id: dev-meta - if: github.event.action == 'create-dev-build' - uses: docker/metadata-action@v5 - with: - images: | - mtr.devops.telekom.de/caas/go-kube-downscaler - ghcr.io/caas-team/gokubedownscaler - tags: dev - - name: Install Cosign uses: sigstore/cosign-installer@main with: @@ -65,9 +55,7 @@ jobs: context: . platforms: linux/amd64 push: true - tags: | - ${{ steps.meta.outputs.tags }} - ${{ steps.dev-meta.outputs.tags }} + tags: ${{ steps.meta.outputs.tags }} - name: Sign Push run: | diff --git a/.github/workflows/helm_build.yaml b/.github/workflows/helm_build.yaml index cc480dc..8f803ff 100644 --- a/.github/workflows/helm_build.yaml +++ b/.github/workflows/helm_build.yaml @@ -26,23 +26,10 @@ jobs: MTR: mtr.devops.telekom.de - name: Helm Lint, Package, and Push - if: github.event.action == 'release-new-version' run: | cd deployments/chart helm lint . - helm package . - helm push $(ls *.tgz | head -1) oci://ghcr.io/caas-team/charts - helm push $(ls *.tgz | head -1) oci://${MTR}/${REPO}/charts - env: - MTR: mtr.devops.telekom.de - REPO: caas - - - name: Helm Lint, Package, and Push Dev Build - if: github.event.action == 'create-dev-build' - run: | - cd deployments/chart - helm lint . - helm package . --version ${{ github.event.client_payload.version }} --app-version dev + helm package . --version ${{ github.event.client_payload.version }} --app-version --version ${{ github.event.client_payload.appVersion }} helm push $(ls *.tgz | head -1) oci://ghcr.io/caas-team/charts helm push $(ls *.tgz | head -1) oci://${MTR}/${REPO}/charts env: