diff --git a/scripts/smoke-vm.sh b/scripts/smoke-vm.sh index a05527f..5166b89 100755 --- a/scripts/smoke-vm.sh +++ b/scripts/smoke-vm.sh @@ -69,22 +69,21 @@ echo "==> node=$NODE sha=$SHORT_SHA iso=$(basename "$ISO_PATH")" ISO_NAME="furtka-${SHORT_SHA}.iso" VOLID="${ISO_STORAGE}:iso/${ISO_NAME}" -# --- Step 1: upload ISO ---------------------------------------------------- -# PVE's upload endpoint errors if the file exists. Delete first so re-runs -# on the same SHA (e.g. workflow re-dispatch) work. +# --- Step 1: upload ISO (or reuse if same SHA already on PVE) --------------- +# For a given commit SHA the ISO bytes are reproducible, so if furtka-.iso +# is already in PVE storage from a prior smoke run we reuse it and skip the +# upload. Avoids DELETE-permission friction and shaves ~2 min off re-runs. if api "$API/nodes/$NODE/storage/$ISO_STORAGE/content/$VOLID" \ --output /dev/null 2>/dev/null; then - echo "==> removing stale ISO $VOLID" - api --request DELETE "$API/nodes/$NODE/storage/$ISO_STORAGE/content/$VOLID" \ - --output /dev/null + echo "==> reusing existing ISO $VOLID" +else + echo "==> uploading ISO as $ISO_NAME" + api --request POST "$API/nodes/$NODE/storage/$ISO_STORAGE/upload" \ + --form "content=iso" \ + --form "filename=@${ISO_PATH};filename=${ISO_NAME}" \ + > /dev/null fi -echo "==> uploading ISO as $ISO_NAME" -api --request POST "$API/nodes/$NODE/storage/$ISO_STORAGE/upload" \ - --form "content=iso" \ - --form "filename=@${ISO_PATH};filename=${ISO_NAME}" \ - > /dev/null - # --- Step 2: pick a free VMID in the reserved range ------------------------ # List VMs on the node, filter by range, pick the lowest integer not in use. USED="$(api "$API/nodes/$NODE/qemu" | python3 -c '