From e3b88e8b60ad1bb0045e872b216430ef7f8968a6 Mon Sep 17 00:00:00 2001 From: Matthew Sevey Date: Mon, 25 Mar 2024 10:39:33 -0400 Subject: [PATCH] ci: further logic clean up --- .github/workflows/reusable_dockerfile_pipeline.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/reusable_dockerfile_pipeline.yml b/.github/workflows/reusable_dockerfile_pipeline.yml index a8fe9ff..13ec696 100644 --- a/.github/workflows/reusable_dockerfile_pipeline.yml +++ b/.github/workflows/reusable_dockerfile_pipeline.yml @@ -179,6 +179,11 @@ jobs: runs-on: "ubuntu-latest" # wait until the jobs are finished. needs: ["prepare-env", "logic-check", "docker-security"] + # Don't run if both logic flags are false. This is the case for push events + # on PR commits. + if: | + needs.prepare-env.outputs.build_for_pr != 'false' + && needs.prepare-env.outputs.build_for_merge != 'false' permissions: contents: write packages: write @@ -217,11 +222,9 @@ jobs: run: exit 0 - name: Checkout - if: ${{ steps.run_check.outputs.run == 'true'}} uses: "actions/checkout@v4" - name: Login to ${{ matrix.registry.name }} - if: ${{ steps.run_check.outputs.run == 'true'}} uses: docker/login-action@v3 with: registry: ${{ matrix.registry.registry-url }} @@ -229,7 +232,6 @@ jobs: password: ${{ secrets[matrix.registry.token-secret] }} - name: Extract Docker Metadata - if: ${{ steps.run_check.outputs.run == 'true'}} id: meta uses: docker/metadata-action@v5 env: @@ -253,11 +255,9 @@ jobs: # yamllint enable - name: Set up QEMU - if: ${{ steps.run_check.outputs.run == 'true'}} uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - if: ${{ steps.run_check.outputs.run == 'true'}} uses: docker/setup-buildx-action@v3 # Build and Publish images on main, master, and versioned branches. @@ -267,7 +267,7 @@ jobs: # the amd64 image since building the arm64 image takes significantly # longer. - name: "Merge on Main Trigger: Build and Push All Docker Images" - if: ${{ needs.prepare-env.outputs.build_for_merge == 'true' && steps.run_check.outputs.run == 'true'}} + if: ${{ needs.prepare-env.outputs.build_for_merge == 'true' }} uses: docker/build-push-action@v5 env: OUTPUT_SHORT_SHA: ${{ needs.prepare-env.outputs.output_short_sha }} @@ -287,7 +287,7 @@ jobs: # 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: "Pull Request Trigger: Build and Push amd64 Docker Image" - if: ${{ needs.prepare-env.outputs.build_for_pr == 'true' && steps.run_check.outputs.run == 'true'}} + if: ${{ needs.prepare-env.outputs.build_for_pr == 'true' }} uses: docker/build-push-action@v5 env: OUTPUT_SHORT_SHA: ${{ needs.prepare-env.outputs.output_short_sha }}