Skip to content

Commit 7bd83fe

Browse files
committed
test(e2e): add rootless podman nix vm lane
Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent bcd517b commit 7bd83fe

13 files changed

Lines changed: 158 additions & 212 deletions

File tree

‎.github/workflows/e2e-test.yml‎

Lines changed: 16 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -130,65 +130,27 @@ jobs:
130130
run: ${{ matrix.cmd }}
131131

132132
e2e-podman-rootless:
133-
name: E2E (rust-podman-${{ matrix.suite }}, ${{ matrix.runner }})
134-
# Run directly on the Ubuntu host so the test observes the host's AppArmor
135-
# and unprivileged-user-namespace policy. A privileged job container masks
136-
# the restrictions that production rootless Podman installations enforce.
137-
# Ubuntu 26.04 provides the supported Podman 5.x and pasta combination.
138-
# Re-add older/slirp4netns environments when direct callbacks through a
139-
# rootless-network namespace relay are supported.
140-
runs-on: ${{ matrix.runner }}
141-
timeout-minutes: 30
142-
strategy:
143-
fail-fast: false
144-
matrix:
145-
include:
146-
# Keep package versions explicit so hosted-runner tool overrides
147-
# cannot silently change the supported test environment.
148-
- suite: rootless
149-
runner: ubuntu-26.04
150-
podman_major: "5"
151-
podman_package_version: "5.7.0+ds2-3build1"
152-
conmon_package_version: "2.1.13+ds1-2"
153-
cmd: "mise run --no-deps --skip-deps e2e:podman:rootless"
154-
- suite: external-driver
155-
runner: ubuntu-26.04
156-
podman_major: "5"
157-
podman_package_version: "5.7.0+ds2-3build1"
158-
conmon_package_version: "2.1.13+ds1-2"
159-
cmd: "env -u OPENSHELL_GATEWAY_BIN mise run --no-deps --skip-deps e2e:podman:external-driver"
160-
- suite: provider-refresh-keycloak
161-
runner: ubuntu-26.04
162-
podman_major: "5"
163-
podman_package_version: "5.7.0+ds2-3build1"
164-
conmon_package_version: "2.1.13+ds1-2"
165-
cmd: "mise run --no-deps --skip-deps e2e:provider-refresh-keycloak"
133+
name: E2E (rust-podman-rootless, Ubuntu 26.04 Nix VM)
134+
# Run rootless Podman inside a Nix-managed Ubuntu guest so Podman, pasta,
135+
# and user-namespace setup are provisioned by versioned repository tooling
136+
# rather than mutable hosted-runner packages.
137+
runs-on: linux-amd64-cpu8
138+
timeout-minutes: 60
166139
env:
167-
IMAGE_TAG: ${{ inputs.image-tag }}
168140
MISE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
169-
OPENSHELL_REGISTRY: ghcr.io/nvidia/openshell
170-
OPENSHELL_REGISTRY_HOST: ghcr.io
171-
OPENSHELL_REGISTRY_NAMESPACE: nvidia/openshell
172-
OPENSHELL_REGISTRY_USERNAME: ${{ github.actor }}
173-
OPENSHELL_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
174-
OPENSHELL_SUPERVISOR_IMAGE: ${{ format('ghcr.io/nvidia/openshell/supervisor:{0}', inputs.image-tag) }}
175141
steps:
176142
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
177143
with:
178144
ref: ${{ inputs['checkout-ref'] || github.sha }}
179145
persist-credentials: false
180146

181-
- name: Use prebuilt OpenShell CLI
182-
if: inputs.cli-artifact-prefix != ''
183-
uses: ./.github/actions/setup-e2e-cli
147+
- uses: cachix/install-nix-action@13d8dd58da0234aa297dedd986986ccb8e7f3e24 # v31.11.1
184148
with:
185-
artifact-prefix: ${{ inputs.cli-artifact-prefix }}
149+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
186150

187-
- name: Use prebuilt OpenShell gateway
188-
if: inputs.gateway-artifact-prefix != ''
189-
uses: ./.github/actions/setup-e2e-gateway
151+
- uses: cachix/cachix-action@5f2d7c5294214f71b873db4b969586b980625e71 # v17
190152
with:
191-
artifact-prefix: ${{ inputs.gateway-artifact-prefix }}
153+
name: openshell
192154

193155
- name: Install mise
194156
run: |
@@ -199,117 +161,21 @@ jobs:
199161
- name: Install tools
200162
run: mise install --locked
201163

202-
- name: Install Podman and build dependencies
164+
- name: Install system dependencies
203165
run: |
204166
sudo apt-get update
205167
sudo apt-get install -y --no-install-recommends \
206-
apparmor \
207168
build-essential \
208169
clang \
209-
fuse-overlayfs \
170+
cmake \
171+
libclang-dev \
210172
libssl-dev \
211173
libz3-dev \
212174
openssh-client \
213-
passt \
214-
pkg-config \
215-
"conmon=${{ matrix.conmon_package_version }}" \
216-
"podman=${{ matrix.podman_package_version }}" \
217-
uidmap
218-
# Hosted runners can place newer Podman and conmon binaries under
219-
# /usr/local ahead of Ubuntu's packages. Select the distro CLI and
220-
# use Podman's supported final config override for its conmon path.
221-
podman_config="${RUNNER_TEMP}/openshell-containers.conf"
222-
printf '%s\n' \
223-
'[engine]' \
224-
'conmon_path = ["/usr/bin/conmon"]' \
225-
> "${podman_config}"
226-
echo "/usr/bin" >> "${GITHUB_PATH}"
227-
echo "CONTAINERS_CONF_OVERRIDE=${podman_config}" >> "${GITHUB_ENV}"
175+
pkg-config
228176
229-
- name: Allow pasta to receive Podman stop signals
230-
# Ubuntu's packaged pasta profile currently blocks this signal, forcing
231-
# Podman to wait for its SIGKILL fallback. Keep this narrow allowance
232-
# until the distribution package includes the upstream profile fix.
233-
run: |
234-
set -euo pipefail
235-
profile=/etc/apparmor.d/usr.bin.pasta
236-
rule=' signal (receive) peer=podman,'
237-
if ! sudo grep -Fqx "${rule}" "${profile}"; then
238-
sudo sed -i '\|^ include <abstractions/pasta>$|a\ signal (receive) peer=podman,' "${profile}"
239-
fi
240-
sudo grep -Fqx "${rule}" "${profile}"
241-
sudo apparmor_parser --replace "${profile}"
242-
243-
- name: Configure rootless Podman
244-
run: |
245-
set -euo pipefail
246-
if ! grep -q "^${USER}:" /etc/subuid; then
247-
sudo usermod --add-subuids 100000-165535 "$USER"
248-
fi
249-
if ! grep -q "^${USER}:" /etc/subgid; then
250-
sudo usermod --add-subgids 100000-165535 "$USER"
251-
fi
252-
runtime_dir="/run/user/$(id -u)"
253-
sudo install -d -m 0700 -o "$(id -u)" -g "$(id -g)" "$runtime_dir"
254-
echo "XDG_RUNTIME_DIR=$runtime_dir" >> "$GITHUB_ENV"
255-
256-
- name: Verify rootless Podman environment
257-
run: |
258-
set -euo pipefail
259-
podman_version="$(podman version --format '{{.Client.Version}}')"
260-
case "$podman_version" in
261-
"${{ matrix.podman_major }}".*) ;;
262-
*) echo "ERROR: expected Podman ${{ matrix.podman_major }}.x, found $podman_version" >&2; exit 1 ;;
263-
esac
264-
test "$(dpkg-query -W -f='${Version}' podman)" = "${{ matrix.podman_package_version }}"
265-
test "$(dpkg-query -W -f='${Version}' conmon)" = "${{ matrix.conmon_package_version }}"
266-
test "$(command -v podman)" = "/usr/bin/podman"
267-
test "$(podman info --format '{{.Host.Conmon.Path}}')" = "/usr/bin/conmon"
268-
test "$(podman info --format '{{.Host.Security.Rootless}}')" = "true"
269-
test "$(podman info --format '{{.Host.RootlessNetworkCmd}}')" = "pasta"
270-
test "$(sudo sysctl -n kernel.apparmor_restrict_unprivileged_userns)" = "1"
271-
echo "=== host ==="
272-
uname -a
273-
echo "=== AppArmor ==="
274-
cat /proc/self/attr/current
275-
sudo aa-status || true
276-
echo "=== Podman ==="
277-
podman version
278-
podman info --debug
279-
280-
- name: Probe rootless capability bounding set
281-
run: |
282-
set -euo pipefail
283-
probe="$RUNNER_TEMP/openshell-capbset-probe"
284-
cc -static -O2 -Wall -Wextra -Werror \
285-
e2e/support/capbset-probe.c \
286-
-o "$probe"
287-
podman run --rm \
288-
--cap-add=SETPCAP \
289-
--volume "$probe:/openshell-capbset-probe:ro" \
290-
docker.io/library/alpine:3.22 \
291-
/openshell-capbset-probe
292-
293-
- name: Log in to GHCR with Podman
294-
run: echo "${{ secrets.GITHUB_TOKEN }}" | podman login ghcr.io -u "${{ github.actor }}" --password-stdin
295-
296-
- name: Run Podman E2E
297-
run: ${{ matrix.cmd }}
298-
299-
- name: Print AppArmor denials
300-
if: always()
301-
run: sudo dmesg | grep -E 'apparmor=.*DENIED|profile="unprivileged_userns"' | tail -100 || true
302-
303-
- name: Fail on pasta SIGTERM AppArmor denial
304-
if: always()
305-
run: |
306-
set -euo pipefail
307-
denials="$(sudo dmesg | grep -E 'profile="pasta".*requested_mask="receive".*signal=term.*peer="podman"' || true)"
308-
if [ -n "${denials}" ]; then
309-
echo "::error::pasta denied Podman's SIGTERM; Podman will use its SIGKILL fallback"
310-
printf '%s\n' "${denials}"
311-
exit 1
312-
fi
177+
- name: Run rootless Podman E2E
178+
run: mise run --no-deps --skip-deps e2e:podman:rootless
313179

314180
e2e-vm:
315181
name: E2E (rust-vm-${{ matrix.suite }})

‎TESTING.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@ Run the Podman-backed Rust CLI e2e suite:
175175
mise run e2e:podman
176176
```
177177

178+
Run the rootless Podman smoke suite in an Ubuntu 26.04 Nix test guest:
179+
180+
```shell
181+
mise run e2e:podman:rootless
182+
```
183+
178184
Run the VM-backed Rust CLI e2e suite:
179185

180186
```shell

‎e2e/run.sh‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ if [ -n "${vm}" ] || [ "${#with_configurations[@]}" -gt 0 ]; then
158158
if [ "${gateway_driver}" = podman ]; then
159159
vm=fedora
160160
else
161-
vm=ubuntu
161+
vm=ubuntu-24-04
162162
fi
163163
fi
164164
fi
@@ -171,8 +171,8 @@ if [ "${mode}" = vm ]; then
171171
die "invalid VM configuration name: ${configuration}"
172172
fi
173173
done
174-
if [ "${gateway_driver}" = podman ] && [ "${vm}" = ubuntu ]; then
175-
die "the Ubuntu 24.04 guest lacks the Podman 5 pasta helper required for sandbox callbacks; use --vm fedora --with podman"
174+
if [ "${gateway_driver}" = podman ] && [ "${vm}" = ubuntu-24-04 ]; then
175+
die "the Ubuntu 24.04 guest lacks the Podman 5 pasta helper required for sandbox callbacks; use --vm ubuntu-26-04 --with podman"
176176
fi
177177
if ! command -v nix >/dev/null 2>&1; then
178178
die "Nix is required for VM mode"
@@ -231,14 +231,14 @@ target_dir="$(e2e_cargo_target_dir "${ROOT}" mise x -- cargo)"
231231
ensure_build_nofile_limit
232232
233233
echo "==> Building native host openshell CLI"
234-
mise x -- cargo build "${cargo_jobs[@]}" -p openshell-cli --bin openshell
234+
mise x -- cargo build "${cargo_jobs[@]+"${cargo_jobs[@]}"}" -p openshell-cli --bin openshell
235235
host_cli_bin="${target_dir}/debug/openshell"
236236
237237
echo "==> Preparing ${linux_musl_target} build target"
238238
mise x -- rustup target add "${linux_musl_target}" >/dev/null
239239
240240
echo "==> Building Linux openshell-sandbox (${linux_musl_target})"
241-
mise x -- cargo zigbuild "${cargo_jobs[@]}" \
241+
mise x -- cargo zigbuild "${cargo_jobs[@]+"${cargo_jobs[@]}"}" \
242242
--release \
243243
--target "${linux_musl_target}" \
244244
-p openshell-sandbox \
@@ -249,7 +249,7 @@ host_gateway_bin=
249249
guest_gateway_bin=
250250
if [ "${mode}" = host ]; then
251251
echo "==> Building native host openshell-gateway"
252-
mise x -- cargo build "${cargo_jobs[@]}" \
252+
mise x -- cargo build "${cargo_jobs[@]+"${cargo_jobs[@]}"}" \
253253
-p openshell-server \
254254
--bin openshell-gateway \
255255
--features bundled-z3
@@ -265,7 +265,7 @@ else
265265
"${linux_gateway_zig_target}" \
266266
"${target_dir}/zig-gnu-wrapper/e2e"
267267
)"
268-
mise x -- cargo zigbuild "${cargo_jobs[@]}" \
268+
mise x -- cargo zigbuild "${cargo_jobs[@]+"${cargo_jobs[@]}"}" \
269269
--release \
270270
--target "${linux_gateway_zig_target}" \
271271
-p openshell-server \

‎e2e/rust/e2e-podman-rootless.sh‎

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)