Skip to content

Commit 4ca4f9c

Browse files
committed
ci: add Azure workflow scoping OIDC tests via azureoidc build tag
Addresses review feedback on PR #1794: #1794 (comment) Replaces the brittle enumerated `-run '^(TestA|TestB)$'` regex with a new `azureoidc` build tag. Tests opt in by adding the tag, so adding or removing OIDC-compatible tests no longer requires editing the workflow. - TerraformAzureContainerAppExample and TerraformAzureKeyVaultExample carry `azure || azureoidc`, so they remain part of the default `azure` build while also being selectable via the narrower OIDC tag. - Workflow runs `go test -tags azureoidc ./test/azure/...`.
1 parent c048882 commit 4ca4f9c

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

.github/workflows/azure-integration-tests.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ on:
2424

2525
concurrency:
2626
group: azure-integration-tests-${{ github.ref }}
27-
cancel-in-progress: true
27+
# Don't cancel in-flight runs; tests provision real resources and rely
28+
# on `defer terraform.Destroy` for cleanup.
29+
cancel-in-progress: false
2830

2931
jobs:
3032
azure-integration-tests:
@@ -78,11 +80,10 @@ jobs:
7880
run: |
7981
set -o pipefail
8082
mkdir -p /tmp/logs
81-
# Scope: OIDC-compatible examples only (AzureRM provider >= 3.7).
82-
# Examples on AzureRM 2.x cannot authenticate via OIDC and are
83-
# gated behind a follow-up provider-upgrade effort.
84-
go test -v -p 1 -tags azure -count=1 -timeout 45m \
85-
-run '^(TestTerraformAzureContainerAppExample|TestTerraformAzureKeyVaultExample)$' \
83+
# Runs only tests tagged `azureoidc`. Opt a test in by adding
84+
# `//go:build azure || azureoidc` to its file. AzureRM 2.x examples
85+
# cannot use OIDC and stay on the default `azure` tag.
86+
go test -v -p 1 -tags azureoidc -count=1 -timeout 45m \
8687
./test/azure/... 2>&1 | tee /tmp/logs/azure-integration-tests.log
8788
8889
- name: Upload test logs

test/azure/terraform_azure_container_apps_example_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//go:build azure
2-
// +build azure
1+
//go:build azure || azureoidc
2+
// +build azure azureoidc
33

44
package test_test
55

test/azure/terraform_azure_keyvault_example_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//go:build azure
2-
// +build azure
1+
//go:build azure || azureoidc
2+
// +build azure azureoidc
33

44
package test_test
55

0 commit comments

Comments
 (0)