From c7b96685d2692e4bb8f97900e0fd5f6d7644c009 Mon Sep 17 00:00:00 2001 From: hc-github-team-consul-core Date: Mon, 19 Aug 2024 14:33:54 -0400 Subject: [PATCH] Backport of update goldenfile checker for running in ent repo into release/1.19.x (#21618) backport of commit 678d74518bf97a7637486f212753bbee91473a17 Co-authored-by: jm96441n --- .github/scripts/goldenfile_checker.sh | 2 +- .github/workflows/goldenfile-checker.yml | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/scripts/goldenfile_checker.sh b/.github/scripts/goldenfile_checker.sh index 61eb8e57243a..0bdcfa35d0e4 100755 --- a/.github/scripts/goldenfile_checker.sh +++ b/.github/scripts/goldenfile_checker.sh @@ -6,7 +6,7 @@ set -euo pipefail # check if there is a diff in the xds testdata directory after running `make envoy-regen` echo "regenerating xds files" -make envoy-regen &>/dev/null +make envoy-regen echo "calculating changed files" changed_xds_files=$(git --no-pager diff --name-only HEAD "$(git merge-base HEAD "origin/$GITHUB_BRANCH_REF")" | egrep "agent/xds/testdata/.*" || true) diff --git a/.github/workflows/goldenfile-checker.yml b/.github/workflows/goldenfile-checker.yml index fed1f30471dc..6f3d1ca68112 100644 --- a/.github/workflows/goldenfile-checker.yml +++ b/.github/workflows/goldenfile-checker.yml @@ -15,16 +15,29 @@ on: - release/* jobs: + get-go-version: + uses: ./.github/workflows/reusable-get-go-version.yml # checks that there is no diff between the existing golden files goldenfile-check: runs-on: ubuntu-latest - + needs: + - get-go-version steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 with: ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 0 # by default the checkout action doesn't checkout all branches + # NOTE: This step is specifically needed for ENT. It allows us to access the required private HashiCorp repos. + - name: Setup Git + if: ${{ endsWith(github.repository, '-enterprise') }} + run: git config --global url."https://${{ secrets.ELEVATED_GITHUB_TOKEN }}:@github.com".insteadOf "https://github.com" + - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 + with: + go-version: ${{ needs.get-go-version.outputs.go-version }} + - name: Download Modules + run: go mod download - name: Check for golden file xds tests in diff run: ./.github/scripts/goldenfile_checker.sh env: GITHUB_BRANCH_REF: ${{ github.event.pull_request.head.ref }} + CONSUL_LICENSE: ${{ secrets.CONSUL_LICENSE }}