From 3bead17c3163583d14b065245473cfb51ae1793a Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 25 Jul 2024 12:15:29 +0100 Subject: [PATCH 1/7] feat: trigger internal CI on master commit --- .github/workflows/on-master-commit.yaml | 1 + .github/workflows/publish-docker-images.yaml | 30 +++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/.github/workflows/on-master-commit.yaml b/.github/workflows/on-master-commit.yaml index c962abf8d..95addefd4 100644 --- a/.github/workflows/on-master-commit.yaml +++ b/.github/workflows/on-master-commit.yaml @@ -62,6 +62,7 @@ jobs: tags: | type=raw,value=master-${{ needs.generate-tags.outputs.tag_date }}-${{ needs.generate-tags.outputs.short_sha }} type=raw,value=master-latest + trigger_internal_ci: true notify-slack: name: Notify Slack diff --git a/.github/workflows/publish-docker-images.yaml b/.github/workflows/publish-docker-images.yaml index abd1958b4..95e828716 100644 --- a/.github/workflows/publish-docker-images.yaml +++ b/.github/workflows/publish-docker-images.yaml @@ -15,7 +15,18 @@ on: type: string required: true description: 'The images to publish' + trigger_internal_ci: + description: 'Trigger the internal CI' + required: false + type: boolean + default: false workflow_dispatch: + inputs: + trigger_internal_ci: + description: 'Trigger the internal CI' + required: true + type: boolean + default: false jobs: build-and-push-image: @@ -66,7 +77,7 @@ jobs: tags: ${{ inputs.tags || format('type=raw,value={0}-{1}', github.ref_name, github.sha) }} - name: Push to Registry(s) - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: . platforms: ${{ github.event_name != 'pull_request' && 'linux/amd64,linux/arm64' || 'linux/amd64' }} @@ -84,3 +95,20 @@ jobs: annotations: true severity: LOW dockerfile: ./Dockerfile + + trigger_ci: + runs-on: ubuntu-latest + needs: + - build-and-push-image + if: ${{ inputs.trigger_internal_ci }} + steps: + - name: Internal CI + uses: peter-evans/repository-dispatch@v3 + with: + token: ${{ secrets.INTERNAL_CI_TOKEN }} + repository: vechain/thor-internal-ci + event-type: internal-thor-ci + client-payload: | + { + "thor_image": ${{ fromJSON(steps.build-and-push-image.outputs.meta.json).tags[0] }} + } From ad088fd79e26f22d1ec27ce39b9504b98c58d4d7 Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 25 Jul 2024 12:17:59 +0100 Subject: [PATCH 2/7] refactor: keep in same run --- .github/workflows/publish-docker-images.yaml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/publish-docker-images.yaml b/.github/workflows/publish-docker-images.yaml index 95e828716..82bccaede 100644 --- a/.github/workflows/publish-docker-images.yaml +++ b/.github/workflows/publish-docker-images.yaml @@ -96,14 +96,9 @@ jobs: severity: LOW dockerfile: ./Dockerfile - trigger_ci: - runs-on: ubuntu-latest - needs: - - build-and-push-image - if: ${{ inputs.trigger_internal_ci }} - steps: - name: Internal CI uses: peter-evans/repository-dispatch@v3 + if: ${{ inputs.trigger_internal_ci }} with: token: ${{ secrets.INTERNAL_CI_TOKEN }} repository: vechain/thor-internal-ci From 1056f1f58b23b0b70e0b73a2ab3dd7522b61f666 Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 25 Jul 2024 12:34:19 +0100 Subject: [PATCH 3/7] fix: continue on error --- .github/workflows/publish-docker-images.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish-docker-images.yaml b/.github/workflows/publish-docker-images.yaml index 82bccaede..b28d10dbe 100644 --- a/.github/workflows/publish-docker-images.yaml +++ b/.github/workflows/publish-docker-images.yaml @@ -99,6 +99,7 @@ jobs: - name: Internal CI uses: peter-evans/repository-dispatch@v3 if: ${{ inputs.trigger_internal_ci }} + continue-on-error: true with: token: ${{ secrets.INTERNAL_CI_TOKEN }} repository: vechain/thor-internal-ci From ae635986d8e16ef5e6baf2d5631b3107338490cd Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 25 Jul 2024 12:52:22 +0100 Subject: [PATCH 4/7] fix: client payload --- .github/workflows/publish-docker-images.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/publish-docker-images.yaml b/.github/workflows/publish-docker-images.yaml index b28d10dbe..49eeb7e58 100644 --- a/.github/workflows/publish-docker-images.yaml +++ b/.github/workflows/publish-docker-images.yaml @@ -104,7 +104,4 @@ jobs: token: ${{ secrets.INTERNAL_CI_TOKEN }} repository: vechain/thor-internal-ci event-type: internal-thor-ci - client-payload: | - { - "thor_image": ${{ fromJSON(steps.build-and-push-image.outputs.meta.json).tags[0] }} - } + client-payload: '{"thor_image": "${{ fromJSON(steps.build-and-push-image.outputs.meta.json).tags[0] }}"}' From 0a53bdb78023bee498d09f661b7700dc1f748358 Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 25 Jul 2024 13:03:47 +0100 Subject: [PATCH 5/7] test: CI trigger --- .github/workflows/test-trigger.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/test-trigger.yaml diff --git a/.github/workflows/test-trigger.yaml b/.github/workflows/test-trigger.yaml new file mode 100644 index 000000000..3188d0631 --- /dev/null +++ b/.github/workflows/test-trigger.yaml @@ -0,0 +1,20 @@ +name: Test Trigger + +on: + push: + branches: + - '*' + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Internal CI + uses: peter-evans/repository-dispatch@v3 +# if: ${{ inputs.trigger_internal_ci }} + continue-on-error: true + with: + token: ${{ secrets.INTERNAL_CI_TOKEN }} + repository: vechain/thor-internal-ci + event-type: internal-thor-ci + client-payload: '{"thor_image": "ghcr.io/vechain/thor:master-latest"}' From 659cc7104cd9004b75e2642d58e469efb6254210 Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 25 Jul 2024 13:04:54 +0100 Subject: [PATCH 6/7] test: CI trigger --- .github/workflows/test-trigger.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-trigger.yaml b/.github/workflows/test-trigger.yaml index 3188d0631..6e39220cd 100644 --- a/.github/workflows/test-trigger.yaml +++ b/.github/workflows/test-trigger.yaml @@ -1,9 +1,9 @@ name: Test Trigger on: - push: + pull_request: branches: - - '*' + - master jobs: test: From d450bc8c6c01db9bdad3081c49fd7025468b60b7 Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 25 Jul 2024 13:07:40 +0100 Subject: [PATCH 7/7] fix: remove test trigger --- .github/workflows/test-trigger.yaml | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 .github/workflows/test-trigger.yaml diff --git a/.github/workflows/test-trigger.yaml b/.github/workflows/test-trigger.yaml deleted file mode 100644 index 6e39220cd..000000000 --- a/.github/workflows/test-trigger.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: Test Trigger - -on: - pull_request: - branches: - - master - -jobs: - test: - runs-on: ubuntu-latest - steps: - - name: Internal CI - uses: peter-evans/repository-dispatch@v3 -# if: ${{ inputs.trigger_internal_ci }} - continue-on-error: true - with: - token: ${{ secrets.INTERNAL_CI_TOKEN }} - repository: vechain/thor-internal-ci - event-type: internal-thor-ci - client-payload: '{"thor_image": "ghcr.io/vechain/thor:master-latest"}'