From a2b98398e16e496751d569beea649c73b2e40d75 Mon Sep 17 00:00:00 2001 From: hc-github-team-secure-vault-core <82990506+hc-github-team-secure-vault-core@users.noreply.github.com> Date: Tue, 4 Jul 2023 11:07:05 -0400 Subject: [PATCH] backport of commit eecae3a827f523a25359068ad6714af8f28c6ced (#21550) (#21556) Co-authored-by: miagilepner --- .github/workflows/build.yml | 4 +++- .github/workflows/ci.yml | 11 +++++++++-- .github/workflows/test-go.yml | 8 ++++---- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ccf4a3519..8827e2291 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,9 @@ on: branches: - main - release/** - +concurrency: + group: ${{ github.head_ref || github.run_id }}-build + cancel-in-progress: true jobs: # verify-changes determines if the changes are only for docs (website) verify-changes: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a6feac24c..1df832f3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,9 @@ on: - main - release/** workflow_dispatch: - +concurrency: + group: ${{ github.head_ref || github.run_id }}-ci + cancel-in-progress: true jobs: setup: name: Setup @@ -295,7 +297,12 @@ jobs: - setup-go-cache - test-go - test-ui - if: always() + # 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() && (cancelled() || + contains(needs.*.result, 'cancelled') || + contains(needs.*.result, 'failure')) runs-on: ${{ fromJSON(needs.setup.outputs.compute-tiny) }} steps: - run: | diff --git a/.github/workflows/test-go.yml b/.github/workflows/test-go.yml index afd28ebb3..b5dbbb079 100644 --- a/.github/workflows/test-go.yml +++ b/.github/workflows/test-go.yml @@ -222,7 +222,7 @@ jobs: \ ${test_packages[${{ matrix.runner-index }}]} - name: Prepare datadog-ci - if: github.repository == 'hashicorp/vault' && always() + if: github.repository == 'hashicorp/vault' && (success() || failure()) continue-on-error: true run: | curl -L --fail "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_linux-x64" --output "/usr/local/bin/datadog-ci" @@ -236,16 +236,16 @@ jobs: export DATADOG_API_KEY=${{ secrets.DATADOG_API_KEY }} fi datadog-ci junit upload --service "$GITHUB_REPOSITORY" test-results/go-test/results.xml - if: always() + if: success() || failure() - name: Archive test results uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 with: name: test-results-${{ matrix.runner-index }} path: test-results/ - if: always() + if: success() || failure() - name: Create a summary of tests uses: test-summary/action@62bc5c68de2a6a0d02039763b8c754569df99e3f # TSCCR: no entry for repository "test-summary/action" with: paths: "test-results/go-test/results.xml" show: "fail" - if: always() + if: success() || failure()