Skip to content

Commit

Permalink
fix(ci): workaround skipped jobs being considered successful
Browse files Browse the repository at this point in the history
# Issue

Due to actions/runner#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.
  • Loading branch information
silvestre committed Nov 28, 2024
1 parent 8af0d7f commit 5db2e1c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion .github/workflows/acceptance_tests_reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand All @@ -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

0 comments on commit 5db2e1c

Please sign in to comment.