test(01-05): add minimal ISO build test profile and script
- Minimal archiso profile (base + linux only) - Test script runs build in container sandbox - Verifies end-to-end ISO generation pipeline Usage: ./scripts/test-iso-build.sh Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
70003ef892
commit
4587740df1
4 changed files with 104 additions and 0 deletions
75
scripts/test-iso-build.sh
Executable file
75
scripts/test-iso-build.sh
Executable file
|
|
@ -0,0 +1,75 @@
|
|||
#!/bin/bash
|
||||
# Test ISO build using the container sandbox
|
||||
# Creates a minimal Arch ISO to verify the build pipeline works
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
||||
|
||||
# Configuration
|
||||
PROFILE_DIR="$PROJECT_ROOT/tests/fixtures/archiso-test-profile"
|
||||
OUTPUT_DIR="$PROJECT_ROOT/tmp/iso-test-output"
|
||||
BUILD_IMAGE="debate-archiso-builder:latest"
|
||||
|
||||
log() {
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1"
|
||||
}
|
||||
|
||||
# Detect container runtime
|
||||
if command -v podman &> /dev/null; then
|
||||
RUNTIME="podman"
|
||||
elif command -v docker &> /dev/null; then
|
||||
RUNTIME="docker"
|
||||
else
|
||||
log "ERROR: No container runtime found. Install podman or docker."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "Using runtime: $RUNTIME"
|
||||
|
||||
# Check if build image exists
|
||||
if ! $RUNTIME image inspect "$BUILD_IMAGE" &> /dev/null; then
|
||||
log "Build image not found. Run: ./scripts/setup-sandbox.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create output directory
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
log "Output directory: $OUTPUT_DIR"
|
||||
|
||||
# Run the build
|
||||
log "Starting ISO build (this may take several minutes)..."
|
||||
log "Profile: $PROFILE_DIR"
|
||||
|
||||
$RUNTIME run \
|
||||
--name debate-test-build \
|
||||
--rm \
|
||||
--network=none \
|
||||
--privileged \
|
||||
--tmpfs=/tmp:exec,mode=1777 \
|
||||
--tmpfs=/var/tmp:exec,mode=1777 \
|
||||
-v "$PROFILE_DIR:/build/profile:ro" \
|
||||
-v "$OUTPUT_DIR:/build/output:rw" \
|
||||
-e SOURCE_DATE_EPOCH=1704067200 \
|
||||
-e LC_ALL=C \
|
||||
-e TZ=UTC \
|
||||
"$BUILD_IMAGE" \
|
||||
mkarchiso -v -w /tmp/archiso-work -o /build/output /build/profile
|
||||
|
||||
# Check result
|
||||
if ls "$OUTPUT_DIR"/*.iso &> /dev/null; then
|
||||
ISO_FILE=$(ls "$OUTPUT_DIR"/*.iso | head -1)
|
||||
ISO_SIZE=$(du -h "$ISO_FILE" | cut -f1)
|
||||
log "SUCCESS! ISO created: $ISO_FILE ($ISO_SIZE)"
|
||||
log ""
|
||||
log "To verify the ISO:"
|
||||
log " sha256sum $ISO_FILE"
|
||||
log ""
|
||||
log "To test in a VM:"
|
||||
log " qemu-system-x86_64 -cdrom $ISO_FILE -m 2G -enable-kvm"
|
||||
else
|
||||
log "ERROR: No ISO file found in output directory"
|
||||
log "Check the build output above for errors"
|
||||
exit 1
|
||||
fi
|
||||
3
tests/fixtures/archiso-test-profile/packages.x86_64
vendored
Normal file
3
tests/fixtures/archiso-test-profile/packages.x86_64
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
base
|
||||
linux
|
||||
mkinitcpio
|
||||
11
tests/fixtures/archiso-test-profile/pacman.conf
vendored
Normal file
11
tests/fixtures/archiso-test-profile/pacman.conf
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[options]
|
||||
Architecture = auto
|
||||
CheckSpace
|
||||
SigLevel = Required DatabaseOptional
|
||||
LocalFileSigLevel = Optional
|
||||
|
||||
[core]
|
||||
Include = /etc/pacman.d/mirrorlist
|
||||
|
||||
[extra]
|
||||
Include = /etc/pacman.d/mirrorlist
|
||||
15
tests/fixtures/archiso-test-profile/profiledef.sh
vendored
Normal file
15
tests/fixtures/archiso-test-profile/profiledef.sh
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
# Minimal test profile for Debate ISO builds
|
||||
|
||||
iso_name="debate-test"
|
||||
iso_label="DEBATE_TEST"
|
||||
iso_publisher="Debate Platform <https://debate.example.com>"
|
||||
iso_application="Debate Test ISO"
|
||||
iso_version="test"
|
||||
install_dir="arch"
|
||||
buildmodes=('iso')
|
||||
bootmodes=('bios.syslinux.mbr' 'bios.syslinux.eltorito')
|
||||
arch="x86_64"
|
||||
pacman_conf="pacman.conf"
|
||||
airootfs_image_type="squashfs"
|
||||
airootfs_image_tool_options=('-comp' 'xz' '-b' '1M')
|
||||
Loading…
Add table
Reference in a new issue