From 22b2e39335e6e9b3aeaf37119b2fa2ca3a099cd5 Mon Sep 17 00:00:00 2001 From: hezijie Date: Wed, 3 Jan 2024 17:08:44 +0800 Subject: [PATCH] fix 201vmsspacker jumpbox, MSI_ID is object id not client id, we need az cli to retrieve client id --- .github/workflows/weekly-e2e.yaml | 3 ++- test/e2e/quickstart_test.go | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/weekly-e2e.yaml b/.github/workflows/weekly-e2e.yaml index 1241c506..faed5664 100644 --- a/.github/workflows/weekly-e2e.yaml +++ b/.github/workflows/weekly-e2e.yaml @@ -21,7 +21,8 @@ jobs: az login --identity --username $MSI_ID > /dev/null 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') - 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 run: | docker run --rm -v $(pwd):/src -w /src mcr.microsoft.com/azterraform sh scripts/update-test-record.sh diff --git a/test/e2e/quickstart_test.go b/test/e2e/quickstart_test.go index 89d83687..54ad1237 100644 --- a/test/e2e/quickstart_test.go +++ b/test/e2e/quickstart_test.go @@ -116,8 +116,7 @@ func test201VmssPackerJumpbox(t *testing.T) { if clientId := os.Getenv("ARM_CLIENT_ID"); clientId != "" { packerVars["client_id"] = clientId } - if identityId := os.Getenv("MSI_ID"); identityId != "" { - packerVars["client_id"] = identityId + if os.Getenv("MSI_ID") != "" { useMsi = true } if clientSecret := os.Getenv("ARM_CLIENT_SECRET"); clientSecret != "" {