From 2fba79880f0d362cb492df22cce2f8fa0b84632c Mon Sep 17 00:00:00 2001 From: Jaymala Sinha Date: Tue, 25 Apr 2023 16:09:37 -0400 Subject: [PATCH 1/2] Force required completed-successfully check to fail when builds or tests fail Signed-off-by: Jaymala Sinha --- .github/workflows/build.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9a6c3ff8b8f7..d52de20397a6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -211,6 +211,16 @@ jobs: secrets: inherit completed-successfully: + # We force a failure if any of the dependent jobs fail, + # this is a workaround for the issue reported https://github.com/actions/runner/issues/2566 + if: | + always() && (needs.test.result == 'failure' || + needs.test-docker-k8s.result == 'failure' || + needs.build-other.result == 'failure' || + needs.build-linux.result == 'failure' || + needs.build-darwin.result == 'failure' || + needs.build-docker.result == 'failure' || + needs.build-ubi.result == 'failure') runs-on: ubuntu-latest needs: - build-other @@ -221,4 +231,6 @@ jobs: - test - test-docker-k8s steps: - - run: echo "All required build and test workflows have succeeded!" + - run: | + echo "Some of the required build and test workflows have failed!" + exit 1 From fd1332f9f09c244dd863da0080ea625bddcb41eb Mon Sep 17 00:00:00 2001 From: Jaymala Sinha Date: Wed, 26 Apr 2023 13:52:50 -0400 Subject: [PATCH 2/2] Update to fail cancelled workflows Signed-off-by: Jaymala Sinha --- .github/workflows/build.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d52de20397a6..029b64bd440e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -214,13 +214,9 @@ jobs: # We force a failure if any of the dependent jobs fail, # this is a workaround for the issue reported https://github.com/actions/runner/issues/2566 if: | - always() && (needs.test.result == 'failure' || - needs.test-docker-k8s.result == 'failure' || - needs.build-other.result == 'failure' || - needs.build-linux.result == 'failure' || - needs.build-darwin.result == 'failure' || - needs.build-docker.result == 'failure' || - needs.build-ubi.result == 'failure') + always() && (cancelled() || + contains(needs.*.result, 'cancelled') || + contains(needs.*.result, 'failure')) runs-on: ubuntu-latest needs: - build-other