-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20570 from hashicorp/tests/provider-auth
Tests: Provider authentication
- Loading branch information
Showing
112 changed files
with
544 additions
and
28,841 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--- | ||
name: Provider Tests | ||
on: | ||
pull_request: | ||
types: ["opened", "synchronize"] | ||
paths: | ||
- ".github/workflows/provider-test.yml" | ||
- 'internal/**.go' | ||
- 'vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/**' | ||
- 'vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/**' | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
pull-requests: read | ||
|
||
jobs: | ||
secrets-check: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
available: "${{ steps.check-secrets.outputs.available }}" | ||
steps: | ||
# we check for the ACTIONS_ID_TOKEN_REQUEST_URL variable as a proxy for other secrets | ||
# it will be unset when running for a PR from a fork, in which case we don't run these tests | ||
- id: check-secrets | ||
run: | | ||
if [[ "${ACTIONS_ID_TOKEN_REQUEST_URL}" == "" ]]; then | ||
echo "available=false" | tee ${GITHUB_OUTPUT} | ||
else | ||
echo "available=true" | tee ${GITHUB_OUTPUT} | ||
fi | ||
provider-tests: | ||
runs-on: [custom, linux, large] | ||
needs: [secrets-check] | ||
if: needs.secrets-check.outputs.available == 'true' | ||
steps: | ||
- name: Azure CLI login | ||
run: az login --output none --username="${{ secrets.AZCLI_USERNAME }}" --password="${{ secrets.AZCLI_PASSWORD }}" | ||
|
||
- name: Set OIDC Token | ||
run: | | ||
echo "ARM_OIDC_TOKEN=$(curl -H "Accept: application/json; api-version=2.0" -H "Authorization: Bearer ${ACTIONS_ID_TOKEN_REQUEST_TOKEN}" -H "Content-Type: application/json" -G --data-urlencode "audience=api://AzureADTokenExchange" "${ACTIONS_ID_TOKEN_REQUEST_URL}" | jq -r '.value')" >>${GITHUB_ENV} | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: ./.go-version | ||
|
||
- name: Run provider tests | ||
run: make testacc TEST=./internal/provider TESTARGS="-run '^TestAcc'" | ||
env: | ||
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} | ||
ARM_CLIENT_CERTIFICATE: ${{ secrets.ARM_CLIENT_CERTIFICATE }} | ||
ARM_CLIENT_CERTIFICATE_PASSWORD: ${{ secrets.ARM_CLIENT_CERTIFICATE_PASSWORD }} | ||
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }} | ||
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }} | ||
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} | ||
|
||
# vim: set ts=2 sts=2 sw=2 et: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.