To reproduce the error, do the following commands:
az cloud set -n AzureChinaCloud
az login --tenant ${AZURE_TENANT_ID} --service-principal -u ${AZURE_CLIENT_ID} -p ${AZURE_CLIENT_SECRET}
cd /home/imagebuilder
/usr/bin/make $AZURE_MAKEFILE_TARGET
This creates the image gallery correctly but fails at the request to Azure China in the builder part because it targets the Azure Public APIs instead of Azure China APIs
What did you expect to happen?
It should have targeted the correct APIs for the cloud environment.
Relevant log output
Log Output (part before the builder was omited)
```
==> azure-arm.sig-ubuntu-2004: Running builder ...
2024/07/10 15:54:09 [INFO] (telemetry) ending sig-ubuntu-2004
==> Wait completed after 7 minutes 30 seconds
2024/07/10 15:54:09 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2024/07/10 15:54:09 machine readable: azure-arm.sig-ubuntu-2004,error []string{"Request failed: subscriptions.Client#Get: Failure sending request: StatusCode=0 -- Original Error: Get \"https://management.azure.com/subscriptions/XXX?api-version=2016-06-01\": EOF"}
==> Builds finished but no artifacts were created.
Build 'azure-arm.sig-ubuntu-2004' errored after 7 minutes 30 seconds: Request failed: subscriptions.Client#Get: Failure sending request: StatusCode=0 -- Original Error: Get "https://management.azure.com/subscriptions/XXX?api-version=2016-06-01": EOF
```
Anything else you would like to add?
Passing the variables with PACKER_FLAGS does not work any better
After troubleshooting it looks like the variable cloud_environment_name is not declared in the images/capi/packer/azure/packer.json file. I will do a PR to add it there.
Environment
make build-azure-sig-ubuntu-2004
What steps did you take and what happened?
To reproduce the error, do the following commands:
This creates the image gallery correctly but fails at the request to Azure China in the builder part because it targets the Azure Public APIs instead of Azure China APIs
What did you expect to happen?
It should have targeted the correct APIs for the cloud environment.
Relevant log output
Log Output (part before the builder was omited)
``` ==> azure-arm.sig-ubuntu-2004: Running builder ... 2024/07/10 15:54:09 [INFO] (telemetry) ending sig-ubuntu-2004 ==> Wait completed after 7 minutes 30 seconds 2024/07/10 15:54:09 machine readable: error-count []string{"1"} ==> Some builds didn't complete successfully and had errors: 2024/07/10 15:54:09 machine readable: azure-arm.sig-ubuntu-2004,error []string{"Request failed: subscriptions.Client#Get: Failure sending request: StatusCode=0 -- Original Error: Get \"https://management.azure.com/subscriptions/XXX?api-version=2016-06-01\": EOF"} ==> Builds finished but no artifacts were created. Build 'azure-arm.sig-ubuntu-2004' errored after 7 minutes 30 seconds: Request failed: subscriptions.Client#Get: Failure sending request: StatusCode=0 -- Original Error: Get "https://management.azure.com/subscriptions/XXX?api-version=2016-06-01": EOF ```Anything else you would like to add?
Passing the variables with
PACKER_FLAGS
does not work any better/kind bug