diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 120579fe..0a2e1cbc 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -44,7 +44,18 @@ jobs: shell: bash run: | set -e - az login --identity --username $MSI_ID > /dev/null + 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')