mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-08-08 21:43:12 +00:00
a424dd18ac
Restructures the integration test workflow from a monolithic sequential job into separate provision → test → cleanup stages: - provision: creates ALL nested PVE VMs in a single terraform apply (parallel), waits for APIs, creates tokens, passes outputs to tests - test: matrix [pve9, pve8] consumes provision outputs, no provisioning - cleanup: always runs, API-only teardown for all VMs Terraform refactored to for_each with pve_instances map variable, enabling parallel ISO upload and VM creation. New caching scripts reduce redundant downloads: - ensure-base-iso.sh: downloads PVE ISOs to /opt/pve-isos if missing - ensure-cloud-images.sh: caches cloud image + OVA with 7-day TTL - prepare-auto-iso.sh: --cache-dir flag with hash-based skip Runner no longer needs manual ISO provisioning (zero-touch setup). cleanup-images bumped to min-versions-to-keep: 3 to survive overlapping runs. All jobs gated against dependabot. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
37 lines
1.1 KiB
Bash
Executable File
37 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Downloads a PVE base ISO to the cache directory if not already present.
|
|
#
|
|
# Usage: ensure-base-iso.sh <iso-filename> <cache-dir>
|
|
# iso-filename: e.g. proxmox-ve_9.1-1.iso
|
|
# cache-dir: e.g. /opt/pve-isos
|
|
set -euo pipefail
|
|
|
|
ISO_FILENAME="${1:?Usage: ensure-base-iso.sh <iso-filename> <cache-dir>}"
|
|
CACHE_DIR="${2:?Cache directory required}"
|
|
|
|
CACHED_PATH="${CACHE_DIR}/${ISO_FILENAME}"
|
|
|
|
if [ -f "${CACHED_PATH}" ] && [ -s "${CACHED_PATH}" ]; then
|
|
echo "Base ISO already cached: ${CACHED_PATH} ($(du -h "${CACHED_PATH}" | cut -f1))"
|
|
exit 0
|
|
fi
|
|
|
|
# Ensure cache directory exists and is writable
|
|
mkdir -p "${CACHE_DIR}"
|
|
|
|
DOWNLOAD_URL="http://download.proxmox.com/iso/${ISO_FILENAME}"
|
|
TMP_PATH="${CACHED_PATH}.downloading"
|
|
|
|
echo "Downloading PVE base ISO: ${DOWNLOAD_URL}"
|
|
echo " Target: ${CACHED_PATH}"
|
|
|
|
# Download to temp file, then atomic move
|
|
if curl -fSL --progress-bar -o "${TMP_PATH}" "${DOWNLOAD_URL}"; then
|
|
mv "${TMP_PATH}" "${CACHED_PATH}"
|
|
echo "Downloaded: ${CACHED_PATH} ($(du -h "${CACHED_PATH}" | cut -f1))"
|
|
else
|
|
rm -f "${TMP_PATH}"
|
|
echo "ERROR: Failed to download ${DOWNLOAD_URL}" >&2
|
|
exit 1
|
|
fi
|