From 41a7c7b373b776d215d29c5926b5a07c109fb6d5 Mon Sep 17 00:00:00 2001 From: Nhu Viet Nguyen Date: Wed, 20 Sep 2023 14:10:28 +0200 Subject: [PATCH 1/3] fix: make strict rules on amd64 experimental builds --- .github/workflows/reusable_dockerfile_pipeline.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/reusable_dockerfile_pipeline.yml b/.github/workflows/reusable_dockerfile_pipeline.yml index ac298e3..b5b6492 100644 --- a/.github/workflows/reusable_dockerfile_pipeline.yml +++ b/.github/workflows/reusable_dockerfile_pipeline.yml @@ -140,7 +140,15 @@ jobs: # only push if the branch/PR is not generated from a fork. Even though # forks can't push, we still want to try and build the image to catch # bugs. For testing purposes we only need an amd64 image. - - name: Build and Push Docker Image amd64 + - name: Build and Push Experimental Docker Image amd64 + # This will run only when the event is a push to a branch that is not 'main' + # and the ref is not a release candidate or release tag. + if: >- + github.event_name == 'push' && + github.ref != 'refs/heads/main' && + !startsWith(github.ref, 'refs/tags/v') && + !startsWith(github.ref, 'refs/tags/v') && + !contains(github.ref, '-rc') uses: docker/build-push-action@v5 env: OUTPUT_SHORT_SHA: ${{ needs.prepare-env.outputs.output_short_sha }} @@ -150,9 +158,7 @@ jobs: provenance: false platforms: linux/amd64 # Only push if the head and base repos match, meaning it is not a fork - # yamllint disable - push: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }} - # yamllint enable + push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} file: ${{ inputs.dockerfile }} From 62ec4b87bdfc1273d320c392b8dfd061b0df6986 Mon Sep 17 00:00:00 2001 From: Nhu Viet Nguyen Date: Wed, 20 Sep 2023 14:12:03 +0200 Subject: [PATCH 2/3] chore: remove redundant condition --- .github/workflows/reusable_dockerfile_pipeline.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/reusable_dockerfile_pipeline.yml b/.github/workflows/reusable_dockerfile_pipeline.yml index b5b6492..0d19d92 100644 --- a/.github/workflows/reusable_dockerfile_pipeline.yml +++ b/.github/workflows/reusable_dockerfile_pipeline.yml @@ -147,7 +147,6 @@ jobs: github.event_name == 'push' && github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/v') && - !startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-rc') uses: docker/build-push-action@v5 env: From 31b728699a964b4740f5171d1dd7c2b61ca49cc9 Mon Sep 17 00:00:00 2001 From: Nhu Viet Nguyen Date: Tue, 10 Oct 2023 14:03:41 +0200 Subject: [PATCH 3/3] fix: add PR originator --- .github/workflows/reusable_dockerfile_pipeline.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/reusable_dockerfile_pipeline.yml b/.github/workflows/reusable_dockerfile_pipeline.yml index 0d19d92..66a3602 100644 --- a/.github/workflows/reusable_dockerfile_pipeline.yml +++ b/.github/workflows/reusable_dockerfile_pipeline.yml @@ -147,7 +147,8 @@ jobs: github.event_name == 'push' && github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/v') && - !contains(github.ref, '-rc') + !contains(github.ref, '-rc') && + github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name uses: docker/build-push-action@v5 env: OUTPUT_SHORT_SHA: ${{ needs.prepare-env.outputs.output_short_sha }}