parent
bfeeb94948
commit
80137d3fb3
52
.github/workflows/install-test.yml
vendored
52
.github/workflows/install-test.yml
vendored
@ -1,52 +0,0 @@
|
|||||||
name: Test Patches - Post Build
|
|
||||||
|
|
||||||
# Runs automatically after every "Test Release Build" run completes (that build
|
|
||||||
# is itself triggered by the 'make-test-build' label on a PR). Reuses the .deb
|
|
||||||
# that build produced — no rebuild — installs it on a runner seeded with the
|
|
||||||
# latest upstream Proxmox files, and verifies that every mod's patches (and
|
|
||||||
# post-apply hooks) apply and revert cleanly. Fails if any mod fails.
|
|
||||||
#
|
|
||||||
# Wired via workflow_run, so it fires for builds on ANY branch/PR. (GitHub always
|
|
||||||
# runs the default-branch copy of this file, so it activates once merged to main.)
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_run:
|
|
||||||
workflows: ["Test Release Build"]
|
|
||||||
types: [completed]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
actions: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
patch-install-test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container:
|
|
||||||
image: debian:trixie
|
|
||||||
if: github.event.workflow_run.conclusion == 'success'
|
|
||||||
steps:
|
|
||||||
- name: Install base tools
|
|
||||||
run: |
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y --no-install-recommends \
|
|
||||||
ca-certificates git sudo wget xz-utils dpkg
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Download deb from the build run
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
run-id: ${{ github.event.workflow_run.id }}
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
pattern: pve-mods-test-build-*
|
|
||||||
merge-multiple: true
|
|
||||||
path: deb
|
|
||||||
|
|
||||||
- name: Fetch upstream Proxmox files
|
|
||||||
run: bash src/Scripts/test/fetch-proxmox-files.sh
|
|
||||||
|
|
||||||
- name: Install built package
|
|
||||||
run: apt-get install -y ./deb/*.deb
|
|
||||||
|
|
||||||
- name: Test all mods
|
|
||||||
run: bash src/Scripts/test/test-mods.sh all
|
|
||||||
41
.github/workflows/test-patches.yml
vendored
Normal file
41
.github/workflows/test-patches.yml
vendored
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
name: Test Patches - Post Build
|
||||||
|
|
||||||
|
# Called by Test Release Build after a successful .deb build.
|
||||||
|
# Installs the artifact on a Proxmox-seeded runner and verifies
|
||||||
|
# that every mod's patches apply and revert cleanly.
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
patch-install-test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: debian:trixie
|
||||||
|
steps:
|
||||||
|
- name: Install base tools
|
||||||
|
run: |
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
ca-certificates git sudo wget xz-utils dpkg
|
||||||
|
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Download deb artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
pattern: pve-mods-test-build-*
|
||||||
|
merge-multiple: true
|
||||||
|
path: deb
|
||||||
|
|
||||||
|
- name: Fetch upstream Proxmox files
|
||||||
|
run: bash src/Scripts/test/fetch-proxmox-files.sh
|
||||||
|
|
||||||
|
- name: Install built package
|
||||||
|
run: apt-get install -y ./deb/*.deb
|
||||||
|
|
||||||
|
- name: Test all mods
|
||||||
|
run: bash src/Scripts/test/test-mods.sh all
|
||||||
5
.github/workflows/test-release.yml
vendored
5
.github/workflows/test-release.yml
vendored
@ -73,4 +73,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: pve-mods-test-build-pr${{ github.event.pull_request.number }}-${{ steps.version.outputs.short_sha }}
|
name: pve-mods-test-build-pr${{ github.event.pull_request.number }}-${{ steps.version.outputs.short_sha }}
|
||||||
path: artifacts/*.deb
|
path: artifacts/*.deb
|
||||||
retention-days: 3
|
retention-days: 3
|
||||||
|
patch-install-test:
|
||||||
|
needs: test-release-build
|
||||||
|
uses: ./.github/workflows/test-patches.yml
|
||||||
@ -1,16 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# src/Scripts/test/fetch-proxmox-files.sh
|
# Downloads upstream Proxmox VE packages and extracts all their files to real
|
||||||
#
|
# system paths, so the patch engine can be exercised on a plain CI runner.
|
||||||
# Downloads the upstream Proxmox VE files that pve-mod patches and installs them
|
|
||||||
# at their real system paths, so the patch engine can be exercised on a plain
|
|
||||||
# (non-Proxmox) CI runner.
|
|
||||||
#
|
|
||||||
# Pulls pve-manager and proxmox-widget-toolkit from the Proxmox no-subscription
|
|
||||||
# repository (default: PVE 9 / Debian trixie) and extracts the target files.
|
|
||||||
#
|
|
||||||
# CI-only helper. The repo is added with [trusted=yes]: we are only fetching
|
|
||||||
# public, unmodified UI files to patch against, not installing Proxmox, so
|
|
||||||
# managing the signing key would add nothing.
|
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
@ -18,15 +8,6 @@ SUITE="${PVE_SUITE:-trixie}"
|
|||||||
WORKDIR="$(mktemp -d)"
|
WORKDIR="$(mktemp -d)"
|
||||||
trap 'rm -rf "$WORKDIR"' EXIT
|
trap 'rm -rf "$WORKDIR"' EXIT
|
||||||
|
|
||||||
# Files provided by the two packages, relative to the filesystem root. These are
|
|
||||||
# exactly the paths the .patch files (and the nag_screen post-apply hook) touch.
|
|
||||||
FILES=(
|
|
||||||
usr/share/perl5/PVE/API2/Nodes.pm
|
|
||||||
usr/share/pve-manager/js/pvemanagerlib.js
|
|
||||||
usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
|
|
||||||
usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.min.js
|
|
||||||
)
|
|
||||||
|
|
||||||
echo "[fetch] Configuring Proxmox no-subscription repo ($SUITE)..."
|
echo "[fetch] Configuring Proxmox no-subscription repo ($SUITE)..."
|
||||||
echo "deb [trusted=yes] http://download.proxmox.com/debian/pve $SUITE pve-no-subscription" \
|
echo "deb [trusted=yes] http://download.proxmox.com/debian/pve $SUITE pve-no-subscription" \
|
||||||
| sudo tee /etc/apt/sources.list.d/pve-test.list >/dev/null
|
| sudo tee /etc/apt/sources.list.d/pve-test.list >/dev/null
|
||||||
@ -36,20 +17,10 @@ echo "[fetch] Downloading pve-manager and proxmox-widget-toolkit..."
|
|||||||
cd "$WORKDIR"
|
cd "$WORKDIR"
|
||||||
apt-get download pve-manager proxmox-widget-toolkit
|
apt-get download pve-manager proxmox-widget-toolkit
|
||||||
|
|
||||||
|
echo "[fetch] Extracting to system paths..."
|
||||||
for deb in *.deb; do
|
for deb in *.deb; do
|
||||||
echo "[fetch] Extracting $deb"
|
echo "[fetch] $deb"
|
||||||
dpkg-deb -x "$deb" extract
|
sudo dpkg-deb -x "$deb" /
|
||||||
done
|
done
|
||||||
|
|
||||||
for rel in "${FILES[@]}"; do
|
echo "[fetch] Done."
|
||||||
src="extract/$rel"
|
|
||||||
dst="/$rel"
|
|
||||||
if [[ ! -f "$src" ]]; then
|
|
||||||
echo "[fetch] ERROR: expected file not found in packages: $rel" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
sudo install -Dm644 "$src" "$dst"
|
|
||||||
echo "[fetch] Installed $dst"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "[fetch] Done."
|
|
||||||
@ -15,7 +15,6 @@
|
|||||||
# so all of the mod's patches are exercised (e.g. node_info's gpu_history)
|
# so all of the mod's patches are exercised (e.g. node_info's gpu_history)
|
||||||
# 3. runs apply-patches.sh and asserts it exits 0
|
# 3. runs apply-patches.sh and asserts it exits 0
|
||||||
# 4. runs revert-patches.sh and asserts it reports no unclean reversions
|
# 4. runs revert-patches.sh and asserts it reports no unclean reversions
|
||||||
# 5. restores the pristine Proxmox files before moving to the next mod
|
|
||||||
#
|
#
|
||||||
# Failure detection relies on the apply exit code: the patch engine performs an
|
# Failure detection relies on the apply exit code: the patch engine performs an
|
||||||
# atomic preflight dry-run and exits non-zero if any mod cannot apply cleanly.
|
# atomic preflight dry-run and exits non-zero if any mod cannot apply cleanly.
|
||||||
@ -30,18 +29,6 @@ PATCHES_DIR="${PVE_MOD_PATCHES_DIR:-/usr/lib/pve-mod/patches}"
|
|||||||
APPLY="${PVE_MOD_APPLY:-/usr/lib/pve-mod/apply-patches.sh}"
|
APPLY="${PVE_MOD_APPLY:-/usr/lib/pve-mod/apply-patches.sh}"
|
||||||
REVERT="${PVE_MOD_REVERT:-/usr/lib/pve-mod/revert-patches.sh}"
|
REVERT="${PVE_MOD_REVERT:-/usr/lib/pve-mod/revert-patches.sh}"
|
||||||
|
|
||||||
# Proxmox files touched by the patches; snapshotted before and restored after
|
|
||||||
# each mod so every mod is tested from a pristine baseline.
|
|
||||||
PROXMOX_FILES=(
|
|
||||||
/usr/share/perl5/PVE/API2/Nodes.pm
|
|
||||||
/usr/share/pve-manager/js/pvemanagerlib.js
|
|
||||||
/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
|
|
||||||
/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.min.js
|
|
||||||
)
|
|
||||||
|
|
||||||
SNAP_DIR="$(mktemp -d)"
|
|
||||||
trap 'rm -rf "$SNAP_DIR"' EXIT
|
|
||||||
|
|
||||||
info() { echo "[test] $*"; }
|
info() { echo "[test] $*"; }
|
||||||
warn() { echo "[test] WARNING: $*" >&2; }
|
warn() { echo "[test] WARNING: $*" >&2; }
|
||||||
|
|
||||||
@ -106,28 +93,6 @@ enable_conditions() {
|
|||||||
done < "$manifest"
|
done < "$manifest"
|
||||||
}
|
}
|
||||||
|
|
||||||
snapshot_files() {
|
|
||||||
rm -rf "$SNAP_DIR"/*; mkdir -p "$SNAP_DIR"
|
|
||||||
local i=0 f
|
|
||||||
for f in "${PROXMOX_FILES[@]}"; do
|
|
||||||
if [[ -e "$f" || -L "$f" ]]; then
|
|
||||||
cp -a "$f" "$SNAP_DIR/$i"
|
|
||||||
fi
|
|
||||||
i=$((i+1))
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
restore_files() {
|
|
||||||
local i=0 f
|
|
||||||
for f in "${PROXMOX_FILES[@]}"; do
|
|
||||||
if [[ -e "$SNAP_DIR/$i" || -L "$SNAP_DIR/$i" ]]; then
|
|
||||||
rm -f "$f"
|
|
||||||
cp -a "$SNAP_DIR/$i" "$f"
|
|
||||||
fi
|
|
||||||
i=$((i+1))
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# Test a single mod end to end. Returns 0 on success, 1 on failure.
|
# Test a single mod end to end. Returns 0 on success, 1 on failure.
|
||||||
test_one_mod() {
|
test_one_mod() {
|
||||||
local mod="$1"
|
local mod="$1"
|
||||||
@ -143,7 +108,6 @@ test_one_mod() {
|
|||||||
disable_all_modules
|
disable_all_modules
|
||||||
set_conf "$MAIN_CONF" modules "$mod" 1
|
set_conf "$MAIN_CONF" modules "$mod" 1
|
||||||
enable_conditions "$mod"
|
enable_conditions "$mod"
|
||||||
snapshot_files
|
|
||||||
|
|
||||||
info "Applying patches for '$mod'..."
|
info "Applying patches for '$mod'..."
|
||||||
local apply_log apply_rc
|
local apply_log apply_rc
|
||||||
@ -165,8 +129,6 @@ test_one_mod() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
restore_files
|
|
||||||
|
|
||||||
if [[ $ok -eq 0 ]]; then
|
if [[ $ok -eq 0 ]]; then
|
||||||
info "PASS: $mod"
|
info "PASS: $mod"
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user