generated from Azure/terraform-azurerm-avm-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b7d0a34
commit 91b865a
Showing
34 changed files
with
150 additions
and
314 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# AVM core team owns key files | ||
.github/policies/ @Azure/avm-core-team-technical | ||
.github/CODEOWNERS @Azure/avm-core-team-technical | ||
.github/policies/ @Azure/avm-core-team-technical-terraform | ||
.github/CODEOWNERS @Azure/avm-core-team-technical-terraform |
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
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
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 |
---|---|---|
@@ -1,71 +1,29 @@ | ||
--- | ||
name: e2e test | ||
name: test examples | ||
on: | ||
pull_request: | ||
types: ['opened', 'reopened', 'synchronize'] | ||
merge_group: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checking for Fork | ||
shell: pwsh | ||
run: | | ||
$isFork = "${{ github.event.pull_request.head.repo.fork }}" | ||
if($isFork -eq "true") { | ||
echo "### WARNING: This workflow is disabled for forked repositories. Please follow the [release branch process](https://azure.github.io/Azure-Verified-Modules/contributing/terraform/terraform-contribution-flow/#5-create-a-pull-request-to-the-upstream-repository) if end to end tests are required." >> $env:GITHUB_STEP_SUMMARY | ||
} | ||
on: | ||
pull_request: | ||
types: ['opened', 'reopened', 'synchronize'] | ||
merge_group: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
jobs: | ||
getexamples: | ||
if: github.event.repository.name != 'terraform-azurerm-avm-template' | ||
runs-on: ubuntu-latest | ||
outputs: | ||
examples: ${{ steps.getexamples.outputs.examples }} | ||
steps: | ||
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 #v4.1.2 | ||
- name: get examples | ||
id: getexamples | ||
uses: Azure/terraform-azurerm-avm-template/.github/actions/e2e-getexamples@main | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
testexamples: | ||
if: github.event.repository.name != 'terraform-azurerm-avm-template' | ||
runs-on: [ self-hosted, 1ES.Pool=terraform-azurerm-avm-res-cdn-profile ] | ||
needs: getexamples | ||
environment: test | ||
env: | ||
TF_IN_AUTOMATION: 1 | ||
TF_VAR_enable_telemetry: false | ||
strategy: | ||
matrix: | ||
example: ${{ fromJson(needs.getexamples.outputs.examples) }} | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 #v4.1.2 | ||
|
||
- name: Test example | ||
shell: bash | ||
run: | | ||
set -e | ||
MAX_RETRIES=10 | ||
RETRY_COUNT=0 | ||
until [ $RETRY_COUNT -ge $MAX_RETRIES ] | ||
do | ||
az login --identity --username $MSI_ID > /dev/null && break | ||
RETRY_COUNT=$[$RETRY_COUNT+1] | ||
sleep 10 | ||
done | ||
if [ $RETRY_COUNT -eq $MAX_RETRIES ]; then | ||
echo "Failed to login after $MAX_RETRIES attempts." | ||
exit 1 | ||
fi | ||
export ARM_SUBSCRIPTION_ID=$(az login --identity --username $MSI_ID | jq -r '.[0] | .id') | ||
export ARM_TENANT_ID=$(az login --identity --username $MSI_ID | jq -r '.[0] | .tenantId') | ||
export ARM_CLIENT_ID=$(az identity list | jq -r --arg MSI_ID "$MSI_ID" '.[] | select(.principalId == $MSI_ID) | .clientId') | ||
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v $(pwd):/src -w /src --network=host -e TF_IN_AUTOMATION -e TF_VAR_enable_telemetry -e AVM_MOD_PATH=/src -e AVM_EXAMPLE=${{ matrix.example }} -e MSI_ID -e ARM_SUBSCRIPTION_ID -e ARM_TENANT_ID -e ARM_CLIENT_ID -e ARM_USE_MSI=true mcr.microsoft.com/azterraform:latest make test-example | ||
# This job is only run when all the previous jobs are successful. | ||
# We can use it for PR validation to ensure all examples have completed. | ||
testexamplescomplete: | ||
if: github.event.repository.name != 'terraform-azurerm-avm-template' | ||
runs-on: ubuntu-latest | ||
needs: testexamples | ||
steps: | ||
- run: echo "All tests passed" | ||
run-e2e-tests: | ||
if: github.event.repository.name != 'terraform-azurerm-avm-template' && github.event.pull_request.head.repo.fork == false | ||
uses: Azure/terraform-azurerm-avm-template/.github/workflows/test-examples-template.yml@main | ||
name: end to end | ||
secrets: inherit | ||
permissions: | ||
id-token: write | ||
contents: read | ||
|
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
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.