mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-07-28 00:38:57 +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>
42 lines
1.4 KiB
Bash
Executable File
42 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Prepares the test environment on the nested PVE node.
|
|
# Only performs operations that have no PVE API equivalent.
|
|
#
|
|
# Usage: prepare-test-environment.sh <nested-pve-ip> <root-password>
|
|
#
|
|
# Operations:
|
|
# - Enable snippets+import content types on local storage (pvesm set)
|
|
# - Upload cloud-init user-data snippet (SCP — no snippet upload API)
|
|
|
|
set -euo pipefail
|
|
|
|
NESTED_IP="${1:?Usage: prepare-test-environment.sh <ip> <password>}"
|
|
ROOT_PASS="$2"
|
|
|
|
SSH_OPTS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR"
|
|
SSH_CMD="sshpass -p ${ROOT_PASS} ssh ${SSH_OPTS} root@${NESTED_IP}"
|
|
SCP_CMD="sshpass -p ${ROOT_PASS} scp ${SSH_OPTS}"
|
|
|
|
echo "=== Preparing test environment on ${NESTED_IP} ==="
|
|
|
|
# Enable snippets and import content types on local storage
|
|
echo "Configuring local storage content types..."
|
|
${SSH_CMD} "mkdir -p /var/lib/vz/snippets && pvesm set local --content images,iso,vztmpl,snippets,import"
|
|
|
|
# Upload cloud-init user-data snippet (no API for snippet upload)
|
|
echo "Uploading cloud-init user-data snippet..."
|
|
USERDATA=$(mktemp)
|
|
cat > "${USERDATA}" <<'YAML'
|
|
#cloud-config
|
|
package_update: true
|
|
packages:
|
|
- qemu-guest-agent
|
|
runcmd:
|
|
- systemctl enable --now qemu-guest-agent
|
|
YAML
|
|
|
|
${SCP_CMD} "${USERDATA}" "root@${NESTED_IP}:/var/lib/vz/snippets/test-vm-userdata.yml"
|
|
rm -f "${USERDATA}"
|
|
|
|
echo "Environment preparation complete."
|