From e7ab20db5efec788811605e9104d65f268a78669 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 20 Mar 2023 22:59:56 +0100 Subject: [PATCH] properly propagate ocelot refs throughat code checkout & workflows --- .github/workflows/deploy.yml | 13 ++++++++++--- .github/workflows/publish.yml | 23 ++++++++++++++++++++++- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ecb0061..f093f5a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -13,6 +13,7 @@ jobs: env: SECRET: ${{ secrets.SECRET }} CONFIGURATION: "this" + GITHUB_OCELOT_REF_JUST_BUILT: ${{ github.event.client_payload.ocelot_ref }} DOCKERHUB_OCELOT_TAG_JUST_BUILT: ${{ github.event.client_payload.BUILD_VERSION }} steps: - name: Checkout code @@ -23,10 +24,10 @@ jobs: uses: aarcangeli/load-dotenv@v1.0.0 with: quiet: true - - name: Set DOCKERHUB_OCELOT_TAG + - name: Set GITHUB_OCELOT_REF run: | - if [ -z ${DOCKERHUB_OCELOT_TAG} ]; then - echo "DOCKERHUB_OCELOT_TAG=${DOCKERHUB_OCELOT_TAG_JUST_BUILT}" >> $GITHUB_ENV + if [ -z ${GITHUB_OCELOT_REF} ]; then + echo "GITHUB_OCELOT_REF=${GITHUB_OCELOT_REF_JUST_BUILT}" >> $GITHUB_ENV fi shell: bash - name: Checkout Ocelot code @@ -40,6 +41,12 @@ jobs: uses: actions/checkout@v3 with: path: "ocelot/deployment/configurations/${{ env.CONFIGURATION }}" + - name: Set DOCKERHUB_OCELOT_TAG + run: | + if [ -z ${DOCKERHUB_OCELOT_TAG} ]; then + echo "DOCKERHUB_OCELOT_TAG=${DOCKERHUB_OCELOT_TAG_JUST_BUILT}" >> $GITHUB_ENV + fi + shell: bash - name: Decrypt all secrets run: ocelot/deployment/scripts/secrets.decrypt.sh - name: Upgrade Cluster diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0398e4e..5dc9886 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -75,6 +75,7 @@ jobs: SECRET: ${{ secrets.SECRET }} DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + GITHUB_OCELOT_REF_JUST_BUILT: ${{ github.event.client_payload.ref }} steps: - name: Checkout code uses: actions/checkout@v3 @@ -84,6 +85,12 @@ jobs: uses: aarcangeli/load-dotenv@v1.0.0 with: quiet: true + - name: Set GITHUB_OCELOT_REF + run: | + if [ -z ${GITHUB_OCELOT_REF} ]; then + echo "GITHUB_OCELOT_REF=${GITHUB_OCELOT_REF_JUST_BUILT}" >> $GITHUB_ENV + fi + shell: bash - name: Checkout Ocelot code uses: actions/checkout@v3 with: @@ -125,6 +132,7 @@ jobs: needs: [upload_to_dockerhub] env: SECRET: ${{ secrets.SECRET }} + GITHUB_OCELOT_REF_JUST_BUILT: ${{ github.event.client_payload.ref }} steps: - name: Checkout code uses: actions/checkout@v3 @@ -134,6 +142,12 @@ jobs: uses: aarcangeli/load-dotenv@v1.0.0 with: quiet: true + - name: Set GITHUB_OCELOT_REF + run: | + if [ -z ${GITHUB_OCELOT_REF} ]; then + echo "GITHUB_OCELOT_REF=${GITHUB_OCELOT_REF_JUST_BUILT}" >> $GITHUB_ENV + fi + shell: bash - name: Checkout Ocelot code uses: actions/checkout@v3 with: @@ -180,6 +194,7 @@ jobs: needs: [github_tag] env: SECRET: ${{ secrets.SECRET }} + GITHUB_OCELOT_REF_JUST_BUILT: ${{ github.event.client_payload.ref }} steps: - name: Checkout code uses: actions/checkout@v3 @@ -189,6 +204,12 @@ jobs: uses: aarcangeli/load-dotenv@v1.0.0 with: quiet: true + - name: Set GITHUB_OCELOT_REF + run: | + if [ -z ${GITHUB_OCELOT_REF} ]; then + echo "GITHUB_OCELOT_REF=${GITHUB_OCELOT_REF_JUST_BUILT}" >> $GITHUB_ENV + fi + shell: bash - name: Checkout Ocelot code uses: actions/checkout@v3 with: @@ -209,4 +230,4 @@ jobs: token: ${{ github.token }} event-type: trigger-ocelot-brand-build-success repository: ${{ github.repository }} - client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "OCELOT_VERSION": "${{ env.OCELOT_VERSION }}", "BRANDED_VERSION": "${{ env.BRANDED_VERSION }}", "BUILD_DATE": "${{ env.BUILD_DATE }}", "BUILD_COMMIT": "${{ env.BUILD_COMMIT }}", "BUILD_VERSION": "${{ env.BUILD_VERSION }}"}' \ No newline at end of file + client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", ref_ocelot: "${{ github.event.client_payload.ref }}", sha_ocelot: "${{ github.event.client_payload.sha }}", "OCELOT_VERSION": "${{ env.OCELOT_VERSION }}", "BRANDED_VERSION": "${{ env.BRANDED_VERSION }}", "BUILD_DATE": "${{ env.BUILD_DATE }}", "BUILD_COMMIT": "${{ env.BUILD_COMMIT }}", "BUILD_VERSION": "${{ env.BUILD_VERSION }}"}' \ No newline at end of file