diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index c2c83a675bb..3c8093ed657 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -222,7 +222,7 @@ jobs: tag-suffix: "" cache-scope: core # todo: optimize this conditional - should-build: >- + any-should-run: >- ${{ needs.run-core-e2e-tests-setup.outputs.should-run == 'true' || needs.run-ccip-e2e-tests-setup.outputs.should-run == 'true' || @@ -236,7 +236,7 @@ jobs: tag-suffix: -plugins cache-scope: plugins # todo: optimize this conditional - should-build: >- + any-should-run: >- ${{ needs.run-core-e2e-tests-setup.outputs.should-run == 'true' || needs.run-ccip-e2e-tests-setup.outputs.should-run == 'true' || @@ -257,24 +257,31 @@ jobs: tag: ${{ inputs.evm-ref || env.CHAINLINK_REF }}${{ matrix.image.tag-suffix }} aws-role-arn: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }} - - name: Explain + - name: Explain build/no-build decision + id: explain env: - SHOULD_BUILD: ${{ matrix.image.should-build }} + EVENT_NAME: ${{ github.event_name }} + REF_NAME: ${{ github.ref_name }} + ANY_SHOULD_RUN: ${{ matrix.image.any-should-run }} IMAGE_EXISTS: ${{ steps.check-image-exists.outputs.exists }} run: | - if [[ "${SHOULD_BUILD}" == 'true' && "${IMAGE_EXISTS}" == 'false' ]]; then - echo "We will build the image because the matrix's should-build is true and the image does not already exist in ECR." - echo "Should build is true when:" - echo "- For the non-plugins image: the core tests, ccip tests, or solana tests will be run." - echo "- For the plugins image: the core cre e2e tests will be run." + if [[ "${EVENT_NAME}" == "push" && "${REF_NAME}" == "develop" ]]; then + echo "We force build on pushes to develop to populate the docker layer cache." + echo "build-image=true" | tee -a "$GITHUB_OUTPUT" + elif [[ "${ANY_SHOULD_RUN}" == "true" && "${IMAGE_EXISTS}" != "true" ]]; then + echo "We will build the image because the matrix's any-should-run is true and the image does not already exist in ECR." + echo "any-should-run is true when:" + echo " - For the non-plugins image: the core tests, ccip tests, or solana tests will be run." + echo " - For the plugins image: the core cre e2e tests will be run." + + echo "build-image=true" | tee -a "$GITHUB_OUTPUT" else - echo "We will not build the image because either the matrix's should-build is false or the image already exists in ECR." - echo "should-build: ${SHOULD_BUILD}" - echo "image-exists: ${IMAGE_EXISTS}" + echo "We will not build the image because either the matrix's any-should-run is false or the image already exists in ECR." + echo "build-image=false" | tee -a "$GITHUB_OUTPUT" fi - name: Checkout the repo - if: matrix.image.should-build && steps.check-image-exists.outputs.exists != 'true' + if: steps.explain.outputs.build-image == 'true' uses: actions/checkout@v6 with: persist-credentials: false @@ -282,7 +289,7 @@ jobs: ref: ${{ env.CHAINLINK_REF }} - name: Build Chainlink Image - if: matrix.image.should-build && steps.check-image-exists.outputs.exists != 'true' + if: steps.explain.outputs.build-image == 'true' uses: smartcontractkit/.github/actions/ctf-build-image@ctf-build-image/v1 with: image-tag: ${{ inputs.evm-ref || env.CHAINLINK_REF }}${{ matrix.image.tag-suffix }}