Skip to content

Commit 7f83bda

Browse files
authored
Migrate az tests to OpenID Connect (#680)
* Migrate `az` tests to OpenID Connect * Update smoke.yml
1 parent 4576c41 commit 7f83bda

File tree

1 file changed

+26
-41
lines changed

1 file changed

+26
-41
lines changed

.github/workflows/smoke.yml

Lines changed: 26 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,24 @@ on:
1414
default: 'gpu+spot'
1515
type: choice
1616
options:
17-
- quick
18-
- quick+spot
19-
- gpu
20-
- gpu+spot
17+
- quick
18+
- quick+spot
19+
- gpu
20+
- gpu+spot
2121
concurrency:
2222
group: ${{ github.workflow }}-${{ github.ref_name }}
2323
cancel-in-progress: true
2424
env:
2525
SMOKE_TEST_TARGET: ${{ github.event_name == 'pull_request_target' && 'quick' || inputs.test_target || 'gpu+spot' }}
26+
SMOKE_TEST_IDENTIFIER: smoke-test-${{ github.run_id }}
2627
jobs:
2728
authorize:
2829
environment: ${{ (github.event_name == 'pull_request_target' &&
2930
github.event.pull_request.head.repo.full_name != github.repository) &&
3031
'manual' || 'automatic' }}
3132
runs-on: ubuntu-latest
3233
steps:
33-
- run: echo ✓
34+
- run: echo ✓
3435
test:
3536
needs: authorize
3637
environment: automatic
@@ -42,10 +43,6 @@ jobs:
4243
provider: [AWS, AZ, GCP]
4344
concurrency: ${{ github.workflow }}-${{ matrix.provider }}
4445
env:
45-
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
46-
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
47-
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
48-
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
4946
GOOGLE_APPLICATION_CREDENTIALS_DATA: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_DATA }}
5047
SMOKE_TEST_ENABLE_${{ matrix.provider }}: true
5148
steps:
@@ -60,6 +57,12 @@ jobs:
6057
with:
6158
aws-region: us-west-1
6259
role-to-assume: arn:aws:iam::342840881361:role/SandboxUser
60+
- if: matrix.provider == 'AZ'
61+
uses: azure/login@v1
62+
with:
63+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
64+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
65+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
6366
- run: go test ./task -v -timeout=30m -count=1 -tags=smoke
6467
- if: always()
6568
uses: actions/checkout@v3
@@ -76,31 +79,19 @@ jobs:
7679
runs-on: ubuntu-latest
7780
timeout-minutes: 60
7881
concurrency: ${{ github.workflow }}-K8S
79-
env:
80-
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
81-
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
82-
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
83-
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
8482
steps:
8583
- uses: actions/checkout@v3
8684
with:
8785
ref: ${{ github.event.pull_request.head.sha || github.ref }}
8886
- uses: actions/setup-go@v3
8987
with:
9088
go-version-file: go.mod
91-
- run: |
92-
az login \
93-
--service-principal \
94-
--user="$AZURE_CLIENT_ID" \
95-
--password="$AZURE_CLIENT_SECRET" \
96-
--tenant="$AZURE_TENANT_ID"
97-
az account set \
98-
--subscription="$AZURE_SUBSCRIPTION_ID"
99-
az group create \
100-
--name="tpiSmokeTestCluster$GITHUB_RUN_ID" \
101-
--location=eastus
102-
- id: cluster_gpu
103-
if: ${{ contains(env.SMOKE_TEST_TARGET, 'gpu') }}
89+
- uses: azure/login@v1
90+
with:
91+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
92+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
93+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
94+
- if: contains(env.SMOKE_TEST_TARGET, 'gpu')
10495
run: |
10596
az extension add \
10697
--name=aks-preview
@@ -109,23 +100,19 @@ jobs:
109100
az feature register \
110101
--namespace=Microsoft.ContainerService \
111102
--name=GPUDedicatedVHDPreview
112-
az aks create \
113-
--resource-group="tpiSmokeTestCluster$GITHUB_RUN_ID" \
103+
- run: |
104+
az group create \
114105
--name="tpiSmokeTestCluster$GITHUB_RUN_ID" \
115-
--node-vm-size=Standard_NC4as_T4_v3 \
116-
--node-count=1 \
117-
--aks-custom-headers=UseGPUDedicatedVHD=true \
118-
--generate-ssh-keys
119-
- id: cluster
120-
if: ${{ !contains(env.SMOKE_TEST_TARGET, 'gpu') }}
121-
run: |
106+
--location=westus2
122107
az aks create \
123108
--resource-group="tpiSmokeTestCluster$GITHUB_RUN_ID" \
124109
--name="tpiSmokeTestCluster$GITHUB_RUN_ID" \
125-
--node-vm-size=Standard_A2_v2 \
110+
--node-vm-size=${{ contains(env.SMOKE_TEST_TARGET, 'gpu') && 'Standard_NC6' || 'Standard_A2_v2' }} \
126111
--node-count=1 \
112+
--aks-custom-headers=${{ contains(env.SMOKE_TEST_TARGET, 'gpu') && 'UseGPUDedicatedVHD=true' || '' }} \
127113
--generate-ssh-keys
128-
- run: |
114+
- id: credentials
115+
run: |
129116
az aks get-credentials \
130117
--resource-group="tpiSmokeTestCluster$GITHUB_RUN_ID" \
131118
--name="tpiSmokeTestCluster$GITHUB_RUN_ID" \
@@ -137,12 +124,10 @@ jobs:
137124
-e 's/(.+)/::add-mask::\1\n::set-output name=kubeconfig::\1\n/g'
138125
- run: go test ./task -v -timeout=60m -count=1 -tags=smoke
139126
env:
140-
KUBECONFIG_DATA: ${{ steps.cluster.outputs.kubeconfig }}
127+
KUBECONFIG_DATA: ${{ steps.credentials.outputs.kubeconfig }}
141128
SMOKE_TEST_ENABLE_K8S: true
142129
- if: always()
143130
run: |
144131
az group delete \
145132
--name="tpiSmokeTestCluster$GITHUB_RUN_ID" \
146133
--yes
147-
env:
148-
SMOKE_TEST_IDENTIFIER: smoke test ${{ github.run_id }}

0 commit comments

Comments
 (0)