Skip to content

Commit bc72a37

Browse files
committed
fix(ci): azure-test: unique per-leg VM name and dedicated VNet
The standalone Azure test workflow named the VM azure-test-<version>-<datestamp>-<arch>-<run_id> and let `az vm create` auto-create/reuse a resource-group VNet. Two problems surface when more than one test runs against the same resource group at once (concurrent dispatches, or the unified azure-build-release-test-publish pipeline's parallel test matrix): - aarch64 and aarch64-64k images share version, datestamp and arch, so their VM names collided -> ARM DeploymentFailed / "concurrent request" Conflict, and "Subnet ... failed to create ... address prefix conflict". - Without --vnet-name, az vm create reuses any existing VNet in the resource group, so parallel launches raced on the same VNet/subnet writes. Mirror the fixes already applied to the azure-test-steps composite action: - Build VM_NAME from VM_IMAGE_DEFINITION (unique per leg); longest case stays within the 64-char Linux VM name limit. - Create an explicit per-VM VNet/subnet (${VM_NAME}VNet / Subnet) and delete the VNet during teardown so nothing is stranded.
1 parent aa8dcec commit bc72a37

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

.github/workflows/azure-test.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,20 @@ jobs:
204204
205205
- name: Launch test VM
206206
run: |
207-
VM_NAME="azure-test-${ALMA_VERSION}-${DATESTAMP_ITERATION}-${ALMA_ARCH}-${GITHUB_RUN_ID}"
207+
# The name must be unique per matrix leg within the run: version +
208+
# datestamp + arch is NOT enough (aarch64 and aarch64-64k images
209+
# share all three and would race to create identically-named
210+
# VM/VNet/subnet resources -> ARM Conflict). The image definition
211+
# is unique per leg, so build the name from it. Longest case
212+
# ("azure-test-almalinux-ci-kitten-10-arm64-64k-gen2-<run id>")
213+
# stays within the 64-character Linux VM name limit.
214+
VM_NAME="azure-test-${VM_IMAGE_DEFINITION}-${GITHUB_RUN_ID}"
208215
echo "VM Name: ${VM_NAME}"
209216
217+
# Explicit per-VM VNet/subnet names: without --vnet-name, az vm
218+
# create REUSES any existing VNet in the resource group, and
219+
# parallel runs (or matrix legs) then race on the same VNet/subnet
220+
# writes -> ARM DeploymentFailed / Conflict ("concurrent request").
210221
VM_ID=$(az vm create \
211222
--resource-group "${RESOURCE_GROUP}" \
212223
--location "${AZURE_LOCATION}" \
@@ -218,6 +229,8 @@ jobs:
218229
--public-ip-sku Standard \
219230
--os-disk-size-gb 100 \
220231
--nsg-rule SSH \
232+
--vnet-name "${VM_NAME}VNet" \
233+
--subnet "${VM_NAME}Subnet" \
221234
--query id --output tsv)
222235
223236
echo "VM ID: ${VM_ID}"
@@ -359,8 +372,10 @@ jobs:
359372
--resource-group "${RESOURCE_GROUP}" \
360373
--name "${VM_NAME}VMNic" || true
361374
362-
# 3. Public IP, NSG, and OS disk are now unreferenced and can be
363-
# deleted concurrently.
375+
# 3. Public IP, NSG, OS disk, and the per-VM VNet are now
376+
# unreferenced and can be deleted concurrently. (The VNet is
377+
# per-VM - created explicitly at launch to keep parallel test
378+
# legs from contending on a shared VNet.)
364379
az network public-ip delete \
365380
--resource-group "${RESOURCE_GROUP}" \
366381
--name "${VM_NAME}PublicIP" \
@@ -371,6 +386,10 @@ jobs:
371386
--name "${VM_NAME}NSG" \
372387
--no-wait || true
373388
389+
az network vnet delete \
390+
--resource-group "${RESOURCE_GROUP}" \
391+
--name "${VM_NAME}VNet" || true
392+
374393
if [ -n "${OS_DISK}" ]; then
375394
az disk delete \
376395
--resource-group "${RESOURCE_GROUP}" \

0 commit comments

Comments
 (0)