public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Michael Köppl" <m.koeppl@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH e2e-tests 18/38] plans,scripts: build a minimal OCI image onto pve1
Date: Wed,  4 Nov 2026 20:03:25 +0100	[thread overview]
Message-ID: <20261104190345.2573464-19-m.koeppl@proxmox.com> (raw)
In-Reply-To: <20261104190345.2573464-1-m.koeppl@proxmox.com>

Build the image for the OCI container test during setup instead of
pulling one from a registry. The test then depends neither on the
registry nor on how a third-party image behaves.

The image consists of a static BusyBox and an entrypoint that only
exits on the image's stop signal. Its config sets the fields that
pve-container takes over into the container config, so the entrypoint
and command, environment, user, working directory, stop signal and a
volume.

The image is built on the test runner, so umoci and busybox-static
become dependencies of the test package.

Signed-off-by: Michael Köppl <m.koeppl@proxmox.com>
---
 debian/control             |  4 ++-
 plans/complete.ron         |  1 +
 scripts/build-oci-image.sh | 69 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 73 insertions(+), 1 deletion(-)
 create mode 100755 scripts/build-oci-image.sh

diff --git a/debian/control b/debian/control
index b7abfdf..56a1185 100644
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,9 @@ Depends: ${misc:Depends}, ${perl:Depends},
          libjson-perl,
          libio-socket-ssl-perl,
          libnet-openssh-perl,
-         jq
+         busybox-static,
+         jq,
+         umoci
 Description: Proxmox End-to-End Tests and Helpers
  This package contains the end-to-end test suite and Perl helper
  modules for Proxmox projects. It requires proxmox-test-runner
diff --git a/plans/complete.ron b/plans/complete.ron
index 75cd5b1..dd299fe 100644
--- a/plans/complete.ron
+++ b/plans/complete.ron
@@ -15,6 +15,7 @@ Plan(
             post_setup: [
                 "./scripts/update-packages.sh pve staging",
                 "./scripts/download-container-image.sh local debian-12-standard_12.12-1_amd64.tar.zst",
+                "./scripts/build-oci-image.sh local e2e-oci",
                 "./scripts/setup-pebble.sh",
             ],
         ),
diff --git a/scripts/build-oci-image.sh b/scripts/build-oci-image.sh
new file mode 100755
index 0000000..81ddabc
--- /dev/null
+++ b/scripts/build-oci-image.sh
@@ -0,0 +1,69 @@
+#!/usr/bin/bash
+# Builds a minimal OCI image for the application container tests and stores it as a container
+# template. The image sets various image config fields that pve-container takes over into the
+# container config. It also only exits on the configured stop signal.
+set -e
+
+SSH_KEY=$(jq -r '.ssh_private_keyfile' "$CONFIG_PATH")
+HOST=$(jq -r '.host' "$CONFIG_PATH")
+USER=$(jq -r '.ssh_user' "$CONFIG_PATH")
+
+STORAGE=$1
+FILENAME=$2
+
+workdir=$(mktemp -d)
+trap 'rm -rf "$workdir"' EXIT
+umask 022
+
+# Root filesystem
+rootfs="$workdir/rootfs"
+mkdir -p "$rootfs"/{bin,dev,etc,home/e2e,proc,run,sys,tmp}
+chmod 1777 "$rootfs/tmp"
+cp "$(command -v busybox)" "$rootfs/bin/"
+for applet in $("$rootfs/bin/busybox" --list); do
+    [ "$applet" = busybox ] || ln -s busybox "$rootfs/bin/$applet"
+done
+
+# User database for the image's User field
+cat > "$rootfs/etc/passwd" <<'PASSWD'
+root:x:0:0:root:/root:/bin/sh
+e2e:x:1000:1000:e2e:/home/e2e:/bin/sh
+PASSWD
+cat > "$rootfs/etc/group" <<'GROUP'
+root:x:0:
+e2e:x:1000:
+GROUP
+
+# Entrypoint that exits on the image's stop signal only, so that stopping the container with any
+# other signal times out. The shell ignores all signals it has no trap for
+cat > "$rootfs/entrypoint.sh" <<'ENTRYPOINT'
+#!/bin/sh
+trap 'exit 0' USR1
+while :; do
+    sleep 1
+done
+ENTRYPOINT
+chmod 755 "$rootfs/entrypoint.sh"
+
+umoci init --layout "$workdir/layout"
+umoci new --image "$workdir/layout:e2e"
+umoci unpack --rootless --image "$workdir/layout:e2e" "$workdir/bundle"
+cp -a "$rootfs/." "$workdir/bundle/rootfs/"
+umoci repack --image "$workdir/layout:e2e" "$workdir/bundle"
+umoci config --image "$workdir/layout:e2e" \
+    --config.entrypoint /entrypoint.sh \
+    --config.cmd e2e-cmd \
+    --config.env PATH=/bin \
+    --config.env E2E_IMAGE_ENV=from-image \
+    --config.stopsignal SIGUSR1 \
+    --config.user e2e:e2e \
+    --config.workingdir /home/e2e \
+    --config.volume /data
+umoci gc --layout "$workdir/layout"
+
+# Required for pve-container to detect the archive as OCI format
+tar -C "$workdir/layout" -cf "$workdir/$FILENAME.tar" oci-layout index.json blobs
+
+ssh -i "$SSH_KEY" "$USER"@"$HOST" -o StrictHostKeyChecking=no \
+    "cat > \"\$(pvesm path '$STORAGE:vztmpl/$FILENAME.tar')\"" \
+    < "$workdir/$FILENAME.tar"
-- 
2.47.3





  parent reply	other threads:[~2026-11-04 19:06 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 19:03 [PATCH e2e-tests/test-tools 00/38] tests: add tests for guests, Ceph, PBS and cluster workflows Michael Köppl
2026-11-04 19:03 ` [PATCH test-tools 01/38] ansible: rename snd_test bridge to tt_test as multi-purpose bridge Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 02/38] plans: rename sdn_test bridge to tt_test Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 03/38] debian: add missing jq dependency Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 04/38] test framework: move the default container template to the helper Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 05/38] lib: instance: add helper to check if an address answers ping Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 06/38] lib: pveinstance: look up disks by their SCSI serial Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 07/38] lib: pveinstance: add helper to find a task started by another task Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 08/38] lib: pveinstance: add helpers to start and stop guests Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 09/38] lib: pveinstance: add helper to run commands in containers Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 10/38] lib: pveinstance: add helper to wait for qmeventd's cleanup Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 11/38] lib: pveinstance: add helper to check if guest exists Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 12/38] lib: add helpers to use a PBS datastore as PVE storage Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 13/38] scripts: retry container template download, fail if it fails Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 14/38] tests: container: verify lifecycle and guest setup Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 15/38] tests: container: verify volume and bind mountpoints Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 16/38] tests: container: verify snapshots, clones, templates Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 17/38] tests: container: verify device passthrough Michael Köppl
2026-11-04 19:03 ` Michael Köppl [this message]
2026-11-04 19:03 ` [PATCH e2e-tests 19/38] tests: container: verify application containers from OCI images Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 20/38] tests: vm: verify snapshots, clones, templates Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 21/38] tests: vm: verify adding, resizing, and removing disks Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 22/38] plans,scripts: download a Debian cloud image onto pve1 Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 23/38] tests: vm: verify lifecycle operations and cloud-init guest setup Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 24/38] plans,scripts: install Ceph Tentacle on the cluster nodes Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 25/38] test framework: add Ceph test helpers Michael Köppl
2026-11-06 12:24   ` Kefu Chai
2026-11-06 13:04     ` Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 26/38] tests: ceph: verify setting up a hyper-converged cluster Michael Köppl
2026-11-06 12:50   ` Kefu Chai
2026-11-06 13:05     ` Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 27/38] tests: ceph: verify guests on RBD storage Michael Köppl
2026-11-06 13:01   ` Kefu Chai
2026-11-06 13:07     ` Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 28/38] tests: ceph: verify setting up, using and destroying a CephFS Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 29/38] tests: ceph: verify replacing an OSD Michael Köppl
2026-11-06 13:14   ` Kefu Chai
2026-11-04 19:03 ` [PATCH e2e-tests 30/38] tests: ceph: drop the outdated Ceph setup Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 31/38] tests: pbs: verify container backup and restore Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 32/38] tests: backup: verify VM backup and restore, locally and on PBS Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 33/38] tests: pbs: verify single file restore from a container backup Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 34/38] tests: storage: verify moving guest volumes between storages Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 35/38] tests: migration: verify container migration between nodes Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 36/38] tests: migration: verify VM migration with local disks Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 37/38] tests: ha: verify moving guests off a node for maintenance Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 38/38] tests: migration: verify migrating guests in bulk Michael Köppl
2026-11-06 13:25 ` [PATCH e2e-tests/test-tools 00/38] tests: add tests for guests, Ceph, PBS and cluster workflows Kefu Chai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261104190345.2573464-19-m.koeppl@proxmox.com \
    --to=m.koeppl@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal