fix 201vmsspacker jumpbox, MSI_ID is object id not client id, we need az cli to retrieve client id

This commit is contained in:
hezijie 2024-01-03 17:08:44 +08:00 committed by lonegunmanb
parent b6d3ffd601
commit 22b2e39335
2 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,8 @@ jobs:
az login --identity --username $MSI_ID > /dev/null az login --identity --username $MSI_ID > /dev/null
export ARM_SUBSCRIPTION_ID=$(az login --identity --username $MSI_ID | jq -r '.[0] | .id') 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_TENANT_ID=$(az login --identity --username $MSI_ID | jq -r '.[0] | .tenantId')
docker run --rm -v $(pwd):/src -w /src/test -e MSI_ID -e ARM_SUBSCRIPTION_ID -e ARM_TENANT_ID -e ARM_USE_MSI=true -e CHANGED_FOLDERS mcr.microsoft.com/azterraform sh -c "go mod tidy && go test -timeout=1440m -parallel 10 -v ./e2e" ARM_CLIENT_ID=$(az identity list | jq -r --arg MSI_ID "$MSI_ID" '.[] | select(.principalId == $MSI_ID) | .clientId')
docker run --rm -v $(pwd):/src -w /src/test -e MSI_ID -e ARM_SUBSCRIPTION_ID -e ARM_CLIENT_ID -e ARM_TENANT_ID -e ARM_USE_MSI=true -e CHANGED_FOLDERS mcr.microsoft.com/azterraform sh -c "go mod tidy && go test -timeout=1440m -parallel 10 -v ./e2e"
- name: Update - name: Update
run: | run: |
docker run --rm -v $(pwd):/src -w /src mcr.microsoft.com/azterraform sh scripts/update-test-record.sh docker run --rm -v $(pwd):/src -w /src mcr.microsoft.com/azterraform sh scripts/update-test-record.sh

View File

@ -116,8 +116,7 @@ func test201VmssPackerJumpbox(t *testing.T) {
if clientId := os.Getenv("ARM_CLIENT_ID"); clientId != "" { if clientId := os.Getenv("ARM_CLIENT_ID"); clientId != "" {
packerVars["client_id"] = clientId packerVars["client_id"] = clientId
} }
if identityId := os.Getenv("MSI_ID"); identityId != "" { if os.Getenv("MSI_ID") != "" {
packerVars["client_id"] = identityId
useMsi = true useMsi = true
} }
if clientSecret := os.Getenv("ARM_CLIENT_SECRET"); clientSecret != "" { if clientSecret := os.Getenv("ARM_CLIENT_SECRET"); clientSecret != "" {