From 9331cde1366a5c6436a2f6389b44659f19b0d259 Mon Sep 17 00:00:00 2001 From: Silvestre Zabala Date: Thu, 28 Nov 2024 14:43:23 +0100 Subject: [PATCH] fix(ci): workaround skipped jobs being considered successful # Issue Due to https://github.com/actions/runner/issues/2566 skipped "Result" jobs are considered succesful checks. This breaks our PR validation. # Fix Introduce an ugly workaround: A new Result job that will be always skipped except when a required job fails, in which case it also fails. --- .github/workflows/acceptance_tests_reusable.yaml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/acceptance_tests_reusable.yaml b/.github/workflows/acceptance_tests_reusable.yaml index 23bdd0bd33..c902ab08ef 100644 --- a/.github/workflows/acceptance_tests_reusable.yaml +++ b/.github/workflows/acceptance_tests_reusable.yaml @@ -97,7 +97,7 @@ jobs: deployment_cleanup: needs: [ deploy_autoscaler, acceptance_tests ] if: "!contains(github.event.pull_request.labels.*.name, 'skip-cleanup')" - name: "Result" + name: Cleanup runs-on: ubuntu-latest container: image: "${{ inputs.self_hosted_image }}" @@ -114,3 +114,17 @@ jobs: - name: Perform deployment cleanup run: | make --directory="${AUTOSCALER_DIR}" deploy-cleanup + + # This job will run and fail if any of the jobs it depends on fail or are cancelled. + # It is an "ugly workaround" for an issue on GitHub Actions side, where + # skipped jobs are considered successful. + # See https://github.com/actions/runner/issues/2566#issuecomment-1523814835 + result: + needs: acceptance_tests + if: ${{ cancelled() || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'failure') }} + name: Result + runs-on: ubuntu-latest + steps: + - run: | + echo "Some required workflows have failed!" + exit 1