properly propagate ocelot refs throughat code checkout & workflows

This commit is contained in:
Ulf Gebhardt 2023-03-20 22:59:56 +01:00
parent 57519c2011
commit e7ab20db5e
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
2 changed files with 32 additions and 4 deletions

View File

@ -13,6 +13,7 @@ jobs:
env: env:
SECRET: ${{ secrets.SECRET }} SECRET: ${{ secrets.SECRET }}
CONFIGURATION: "this" CONFIGURATION: "this"
GITHUB_OCELOT_REF_JUST_BUILT: ${{ github.event.client_payload.ocelot_ref }}
DOCKERHUB_OCELOT_TAG_JUST_BUILT: ${{ github.event.client_payload.BUILD_VERSION }} DOCKERHUB_OCELOT_TAG_JUST_BUILT: ${{ github.event.client_payload.BUILD_VERSION }}
steps: steps:
- name: Checkout code - name: Checkout code
@ -23,10 +24,10 @@ jobs:
uses: aarcangeli/load-dotenv@v1.0.0 uses: aarcangeli/load-dotenv@v1.0.0
with: with:
quiet: true quiet: true
- name: Set DOCKERHUB_OCELOT_TAG - name: Set GITHUB_OCELOT_REF
run: | run: |
if [ -z ${DOCKERHUB_OCELOT_TAG} ]; then if [ -z ${GITHUB_OCELOT_REF} ]; then
echo "DOCKERHUB_OCELOT_TAG=${DOCKERHUB_OCELOT_TAG_JUST_BUILT}" >> $GITHUB_ENV echo "GITHUB_OCELOT_REF=${GITHUB_OCELOT_REF_JUST_BUILT}" >> $GITHUB_ENV
fi fi
shell: bash shell: bash
- name: Checkout Ocelot code - name: Checkout Ocelot code
@ -40,6 +41,12 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
path: "ocelot/deployment/configurations/${{ env.CONFIGURATION }}" 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 - name: Decrypt all secrets
run: ocelot/deployment/scripts/secrets.decrypt.sh run: ocelot/deployment/scripts/secrets.decrypt.sh
- name: Upgrade Cluster - name: Upgrade Cluster

View File

@ -75,6 +75,7 @@ jobs:
SECRET: ${{ secrets.SECRET }} SECRET: ${{ secrets.SECRET }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
GITHUB_OCELOT_REF_JUST_BUILT: ${{ github.event.client_payload.ref }}
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -84,6 +85,12 @@ jobs:
uses: aarcangeli/load-dotenv@v1.0.0 uses: aarcangeli/load-dotenv@v1.0.0
with: with:
quiet: true 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 - name: Checkout Ocelot code
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
@ -125,6 +132,7 @@ jobs:
needs: [upload_to_dockerhub] needs: [upload_to_dockerhub]
env: env:
SECRET: ${{ secrets.SECRET }} SECRET: ${{ secrets.SECRET }}
GITHUB_OCELOT_REF_JUST_BUILT: ${{ github.event.client_payload.ref }}
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -134,6 +142,12 @@ jobs:
uses: aarcangeli/load-dotenv@v1.0.0 uses: aarcangeli/load-dotenv@v1.0.0
with: with:
quiet: true 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 - name: Checkout Ocelot code
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
@ -180,6 +194,7 @@ jobs:
needs: [github_tag] needs: [github_tag]
env: env:
SECRET: ${{ secrets.SECRET }} SECRET: ${{ secrets.SECRET }}
GITHUB_OCELOT_REF_JUST_BUILT: ${{ github.event.client_payload.ref }}
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -189,6 +204,12 @@ jobs:
uses: aarcangeli/load-dotenv@v1.0.0 uses: aarcangeli/load-dotenv@v1.0.0
with: with:
quiet: true 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 - name: Checkout Ocelot code
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
@ -209,4 +230,4 @@ jobs:
token: ${{ github.token }} token: ${{ github.token }}
event-type: trigger-ocelot-brand-build-success event-type: trigger-ocelot-brand-build-success
repository: ${{ github.repository }} 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 }}"}' 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 }}"}'