Files
PSProxmoxVE/tests/infrastructure/scripts/prepare-auto-iso.sh
T
Clint Branham ddecafee91 feat(ci): automated nested PVE provisioning for integration tests
Workflow now provisions a throwaway nested PVE VM via Terraform, runs
integration tests against it, then destroys it. Uses proxmox-auto-install-assistant
to bake the answer file and a first-boot script (installs qemu-guest-agent)
directly into the ISO. IP is discovered via the QEMU guest agent on the
parent PVE, eliminating the need for static IP configuration.

Supports both PVE 8.x and 9.x via workflow_dispatch version selector.
Skip provisioning with skip_provision=true to test against a pre-existing PVE.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 14:13:41 -05:00

39 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Prepare a PVE auto-install ISO with the answer file and first-boot script baked in.
# Uses --fetch-from iso mode so only a single CD-ROM is needed, no HTTP server required.
#
# Usage: prepare-auto-iso.sh <base-iso> <answer-file> [first-boot-script] [output-iso]
set -euo pipefail
BASE_ISO="$1"
ANSWER_FILE="$2"
FIRST_BOOT="${3:-}"
OUTPUT_ISO="${4:-${BASE_ISO%.iso}-auto.iso}"
for f in "$BASE_ISO" "$ANSWER_FILE"; do
if [ ! -f "$f" ]; then
echo "ERROR: File not found: $f" >&2
exit 1
fi
done
FIRST_BOOT_ARGS=()
if [ -n "$FIRST_BOOT" ] && [ -f "$FIRST_BOOT" ]; then
FIRST_BOOT_ARGS=(--on-first-boot "$FIRST_BOOT")
fi
echo "Preparing auto-install ISO..."
echo " Base ISO: $BASE_ISO"
echo " Answer file: $ANSWER_FILE"
echo " First boot: ${FIRST_BOOT:-none}"
echo " Output: $OUTPUT_ISO"
proxmox-auto-install-assistant prepare-iso \
--fetch-from iso \
--answer-file "$ANSWER_FILE" \
"${FIRST_BOOT_ARGS[@]}" \
--output "$OUTPUT_ISO" \
"$BASE_ISO"
echo "Created: $OUTPUT_ISO"