Skip to content

Commit

Permalink
allow optionally specifying a specific go-version when using reusable…
Browse files Browse the repository at this point in the history
…-unit.yml. pin the 1.20 api tests to use 1.20.5
  • Loading branch information
jmurret committed Jul 13, 2023
1 parent 5164924 commit f4d6ca1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/go-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ jobs:
runs-on: ${{ needs.setup.outputs.compute-xl }}
repository-name: ${{ github.repository }}
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consulprem consuldev' || '' }}"
go-version: "1.19"
permissions:
id-token: write # NOTE: this permission is explicitly required for Vault auth.
contents: read
Expand All @@ -394,6 +395,12 @@ jobs:
runs-on: ${{ needs.setup.outputs.compute-xl }}
repository-name: ${{ github.repository }}
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consulprem consuldev' || '' }}"
# pinning this to 1.20.5 because this issue in go-testcontainers occurs
# in 1.20.6 with the error "http: invalid Host header, host port waiting failed"
# https://github.com/testcontainers/testcontainers-go/issues/1359
# remove setting this when the above issue is fixed so that the reusable
# job will just get the go version from go.mod.
go-version: "1.20.5"
permissions:
id-token: write # NOTE: this permission is explicitly required for Vault auth.
contents: read
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/reusable-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ on:
required: false
type: string
default: ""
go-version:
required: false
type: string
default: ""
secrets:
elevated-github-token:
required: true
Expand All @@ -59,6 +63,12 @@ jobs:
if: ${{ endsWith(inputs.repository-name, '-enterprise') }}
run: git config --global url."https://${{ secrets.elevated-github-token }}:@github.com".insteadOf "https://github.com"
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
if: ${{ inputs.go-version != "" }}
with:
go-version-file: ${{ inputs.go-version }}
cache: true
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
if: ${{ inputs.go-version == "" }}
with:
go-version-file: 'go.mod'
cache: true
Expand Down

0 comments on commit f4d6ca1

Please sign in to comment.