furtka/ops/forgejo-runner/bootstrap.sh
Daniel Maksymilian Syrnicki d499907613
Some checks failed
Build ISO / smoke-vm (push) Blocked by required conditions
Build ISO / build-iso (push) Successful in 24m28s
CI / test (push) Successful in 3m1s
CI / validate-json (push) Successful in 55s
CI / markdown-links (push) Successful in 37s
CI / lint (push) Failing after 13m19s
feat(ci): auto-boot every main-ISO in smoke VM on .165 Proxmox
After build-iso, a new smoke-vm job uploads the freshly built ISO to
the test Proxmox at 192.168.178.165 via PVE API token, boots it in a
fresh VM (VMID range 9000-9099, MAC derived from commit SHA so the
runner can find the DHCP IP by scanning the LAN), and curls :5000 to
confirm the webinstaller answers HTTP 200. Last 5 smoke VMs + their
ISOs are kept for post-mortem; older ones are purged. continue-on-error
on the smoke job so a VM-side flake doesn't mark the ISO build red.

Shortens the feedback loop on ISO regressions from "next manual VM
test session" (days) to "next push" (minutes) — the 2026-04-15/16 VM
sessions each found real boot-time bugs that unit tests missed.

Docs at docs/smoke-vm.md. Requires Forgejo secrets PVE_TEST_HOST and
PVE_TEST_TOKEN (dedicated smoke@pve!ci PVE token, privilege-separated).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 11:41:44 +02:00

46 lines
1.7 KiB
Bash
Executable file

#!/usr/bin/env bash
# Install Docker Engine + Compose plugin on a fresh Ubuntu 24.04 VM
# and prepare it to host a Forgejo Actions runner.
#
# Run as the target user (needs sudo). Idempotent.
set -euo pipefail
if [[ "$(. /etc/os-release && echo "$ID")" != "ubuntu" ]]; then
echo "This script targets Ubuntu. Aborting." >&2
exit 1
fi
echo "==> Updating apt and installing prerequisites"
sudo apt-get update -y
# arp-scan + iputils: needed by scripts/smoke-vm.sh for MAC→IP discovery
# of the test VM on the Proxmox test host (live ISO has no guest agent,
# so we scan the LAN and match on the MAC we assigned at VM creation).
sudo apt-get install -y ca-certificates curl gnupg arp-scan iputils-arping
echo "==> Adding Docker's official GPG key"
sudo install -m 0755 -d /etc/apt/keyrings
if [[ ! -f /etc/apt/keyrings/docker.asc ]]; then
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
fi
echo "==> Adding Docker apt repository"
ARCH="$(dpkg --print-architecture)"
CODENAME="$(. /etc/os-release && echo "$VERSION_CODENAME")"
echo "deb [arch=${ARCH} signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu ${CODENAME} stable" \
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
echo "==> Installing Docker Engine + Compose plugin"
sudo apt-get update -y
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
echo "==> Adding $USER to docker group"
sudo usermod -aG docker "$USER"
echo "==> Enabling docker service"
sudo systemctl enable --now docker
echo
echo "Done. Log out and back in (or run 'newgrp docker') so group membership takes effect."
docker --version
docker compose version