From e3f471c0a201e03ba95f2913ed78a197fb065de8 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: Mon, 3 Apr 2023 10:48:05 -0400 Subject: [PATCH] Backport of Update the if conditions for test-go jobs in CI into release/1.13.x (#19872) * Update the if conditions for test-go jobs in CI * Fix errors in comments * Update the if condition for the UI tests --------- Co-authored-by: Kuba Wieczorek --- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a338392563f..cecb2b9cebdc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -115,8 +115,12 @@ jobs: needs: - setup - setup-go-cache - # Don't run this job for branches starting with 'ui/', 'docs/', or 'backport/docs/' - if: ${{ ! (startsWith( github.ref_name, 'ui/' ) || startsWith( github.ref_name, 'docs/' ) || startsWith( github.ref_name, 'backport/docs/') ) }} + # Don't run this job for PR branches starting with 'ui/', 'backport/ui/', 'docs/', or 'backport/docs/' + if: | + !startsWith(github.head_ref, 'ui/') && + !startsWith(github.head_ref, 'backport/ui/') && + !startsWith(github.head_ref, 'docs/') && + !startsWith(github.head_ref, 'backport/docs/') uses: ./.github/workflows/test-go.yml with: total-runners: 16 @@ -130,8 +134,12 @@ jobs: needs: - setup - setup-go-cache - # Don't run this job for branches starting with 'ui/', 'docs/', or 'backport/docs/' - if: ${{ ! (startsWith( github.ref_name, 'ui/' ) || startsWith( github.ref_name, 'docs/' ) || startsWith( github.ref_name, 'backport/docs/') ) }} + # Don't run this job for PR branches starting with 'ui/', 'backport/ui/', 'docs/', or 'backport/docs/' + if: | + !startsWith(github.head_ref, 'ui/') && + !startsWith(github.head_ref, 'backport/ui/') && + !startsWith(github.head_ref, 'docs/') && + !startsWith(github.head_ref, 'backport/docs/') uses: ./.github/workflows/test-go.yml with: total-runners: 16 @@ -147,10 +155,13 @@ jobs: secrets: inherit test-go-fips: name: Run Go tests with FIPS configuration - # Only run this job for the enterprise repo if the branch doesn't start with 'ui/', 'docs/', or 'backport/docs/'. + # Only run this job for the enterprise repo if the PR branch doesn't start with 'ui/', 'backport/ui/', 'docs/', or 'backport/docs/' if: | needs.setup.outputs.enterprise == 1 && - ! (startsWith( github.ref_name, 'ui/' ) || startsWith( github.ref_name, 'docs/' ) || startsWith( github.ref_name, 'backport/docs/')) + !startsWith(github.head_ref, 'ui/') && + !startsWith(github.head_ref, 'backport/ui/') && + !startsWith(github.head_ref, 'docs/') && + !startsWith(github.head_ref, 'backport/docs/') needs: - setup - setup-go-cache @@ -168,8 +179,16 @@ jobs: secrets: inherit test-ui: name: Test UI - # The test-ui Job is only run for pushes to main, ui/*, backport/ui/*, release/*, and merge* - if: github.ref_name == 'main' || startsWith(github.ref_name, 'ui/') || startsWith(github.ref_name, 'backport/ui/') || startsWith(github.ref_name, 'release/') || startsWith(github.ref_name, 'merge') + # The test-ui job is only run on: + # - pushes to main and branches starting with "release/" + # - PRs where the branch starts with "ui/", "backport/ui/", "merge", or when base branch starts with "release/" + if: | + github.ref_name == 'main' || + startsWith(github.ref_name, 'release/') || + startsWith(github.base_ref, 'release/') || + startsWith(github.head_ref, 'ui/') || + startsWith(github.head_ref, 'backport/ui/') || + startsWith(github.head_ref, 'merge') needs: - setup permissions: