`cloud_environment_name` not taken into account
Opened this issue · 1 comments
aurel333 commented
Environment
- Make target:
make build-azure-sig-ubuntu-2004
- Run using container image? (Y/N): Y
- Environment vars:
AZURE_CLIENT_ID: XXX
AZURE_TENANT_ID: XXX
AZURE_SUBSCRIPTION_ID: XXX
RESOURCE_GROUP_NAME: XXX
AZURE_LOCATION: XXX
BUILD_RESOURCE_GROUP_NAME: XXX
BUILD_VNET_NAME: XXX
BUILD_SUBNET_NAME: XXX
SIG_PUBLISHER: XXX
SIG_OFFER: XXX
GALLERY_NAME: XXX
IMAGE_VERSION: XXX
BUILD_VM_FLAVOR: XXX
PACKER_VAR_FILES: "/home/imagebuilder/packer-conf.json"
- Vars file (values are populated from environment variables):
{
"extra_debs": "linux-cloud-tools-common",
"vm_size": "${BUILD_VM_FLAVOR}",
"private_virtual_network_with_public_ip": "false",
"virtual_network_name": "${BUILD_VNET_NAME}",
"virtual_network_subnet_name": "${BUILD_SUBNET_NAME}",
"virtual_network_resource_group_name": "${BUILD_RESOURCE_GROUP_NAME}",
"resource_group_name": "${RESOURCE_GROUP_NAME}",
"kubernetes_deb_version": "${KUBERNETES_DEB_VERSION}",
"kubernetes_semver": "${KUBERNETES_SEMVER}",
"kubernetes_series": "${KUBERNETES_SERIES}",
"pause_image": "${PAUSE_IMAGE}",
"pip_conf_file": "${PIP_CONF_FILE}",
"sig_image_version": "${IMAGE_VERSION}",
"cloud_environment_name": "AzureChinaCloud",
"metadata_host": "management.core.chinacloudapi.cn"
}
What steps did you take and what happened?
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
/kind bug
aurel333 commented
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.