Skip to content

Commit ae04160

Browse files
committed
ci(e2e): pass prebuilt artifacts to rootless podman vm
Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent 6ce59f4 commit ae04160

9 files changed

Lines changed: 210 additions & 58 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Setup E2E Sandbox
2+
description: Download an architecture-matched prebuilt OpenShell sandbox binary for E2E tests
3+
4+
inputs:
5+
artifact-prefix:
6+
description: Artifact name prefix; linux-<arch> is appended automatically
7+
required: true
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- name: Download prebuilt sandbox
13+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
14+
with:
15+
name: ${{ format('{0}-linux-{1}', inputs.artifact-prefix, runner.arch == 'X64' && 'amd64' || 'arm64') }}
16+
path: .e2e/prebuilt-sandbox
17+
18+
- name: Configure prebuilt sandbox
19+
shell: bash
20+
run: |
21+
set -euo pipefail
22+
sandbox="$GITHUB_WORKSPACE/.e2e/prebuilt-sandbox/openshell-sandbox"
23+
if [[ ! -f "$sandbox" ]]; then
24+
echo "downloaded artifact is missing $sandbox" >&2
25+
exit 1
26+
fi
27+
chmod +x "$sandbox"
28+
"$sandbox" --version
29+
echo "OPENSHELL_SANDBOX_BIN=$sandbox" >> "$GITHUB_ENV"

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ jobs:
136136
runner: linux-arm64-cpu8
137137
cli-artifact-prefix: rust-binary-cli
138138
gateway-artifact-prefix: rust-binary-gateway
139+
# The supervisor build uploads the openshell-sandbox binary artifact.
140+
sandbox-artifact-prefix: rust-binary-supervisor
139141
vm-driver-artifact-name: driver-vm-linux-amd64
140142

141143
gpu-e2e:

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

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ on:
2727
required: false
2828
type: string
2929
default: ""
30+
sandbox-artifact-prefix:
31+
description: "Optional prebuilt sandbox artifact prefix (artifact suffix is linux-<arch>)"
32+
required: false
33+
type: string
34+
default: ""
3035
vm-driver-artifact-name:
3136
description: "Optional prebuilt VM driver artifact name"
3237
required: false
@@ -144,6 +149,21 @@ jobs:
144149
ref: ${{ inputs['checkout-ref'] || github.sha }}
145150
persist-credentials: false
146151

152+
- name: Use prebuilt OpenShell CLI
153+
uses: ./.github/actions/setup-e2e-cli
154+
with:
155+
artifact-prefix: ${{ inputs.cli-artifact-prefix }}
156+
157+
- name: Use prebuilt OpenShell gateway
158+
uses: ./.github/actions/setup-e2e-gateway
159+
with:
160+
artifact-prefix: ${{ inputs.gateway-artifact-prefix }}
161+
162+
- name: Use prebuilt OpenShell sandbox
163+
uses: ./.github/actions/setup-e2e-sandbox
164+
with:
165+
artifact-prefix: ${{ inputs.sandbox-artifact-prefix }}
166+
147167
- uses: cachix/install-nix-action@13d8dd58da0234aa297dedd986986ccb8e7f3e24 # v31.11.1
148168
with:
149169
github_access_token: ${{ secrets.GITHUB_TOKEN }}
@@ -175,7 +195,17 @@ jobs:
175195
pkg-config
176196
177197
- name: Run rootless Podman E2E
178-
run: mise run --no-deps --skip-deps e2e:podman:rootless
198+
run: |
199+
set -euo pipefail
200+
201+
mise x -- e2e/run.sh \
202+
--vm ubuntu-26-04 \
203+
--with podman-rootless \
204+
--host-cli-bin "$OPENSHELL_BIN" \
205+
--gateway-bin "$OPENSHELL_GATEWAY_BIN" \
206+
--sandbox-bin "$OPENSHELL_SANDBOX_BIN" \
207+
--gateway-config e2e/configs/gateway/podman.toml \
208+
--features e2e-podman
179209
180210
e2e-vm:
181211
name: E2E (rust-vm-${{ matrix.suite }})

‎.github/workflows/release-dev.yml‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,16 @@ jobs:
6969
cargo-version: ${{ needs.compute-versions.outputs.cargo_version }}
7070
auditable: true
7171

72+
build-cli:
73+
needs: [compute-versions]
74+
uses: ./.github/workflows/docker-build.yml
75+
with:
76+
component: cli
77+
cargo-version: ${{ needs.compute-versions.outputs.cargo_version }}
78+
auditable: true
79+
7280
e2e:
73-
needs: [build-gateway, build-supervisor]
81+
needs: [build-gateway, build-supervisor, build-cli]
7482
permissions:
7583
actions: read
7684
contents: read
@@ -79,6 +87,10 @@ jobs:
7987
with:
8088
image-tag: ${{ github.sha }}
8189
runner: linux-arm64-cpu8
90+
cli-artifact-prefix: rust-binary-cli
91+
gateway-artifact-prefix: rust-binary-gateway
92+
# The supervisor build uploads the openshell-sandbox binary artifact.
93+
sandbox-artifact-prefix: rust-binary-supervisor
8294

8395
tag-ghcr-dev:
8496
name: Tag GHCR Images as Dev

‎.github/workflows/release-tag.yml‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,18 @@ jobs:
9393
checkout-ref: ${{ inputs.tag || github.ref }}
9494
auditable: true
9595

96+
build-cli:
97+
needs: [compute-versions]
98+
uses: ./.github/workflows/docker-build.yml
99+
with:
100+
component: cli
101+
cargo-version: ${{ needs.compute-versions.outputs.cargo_version }}
102+
image-tag: ${{ needs.compute-versions.outputs.source_sha }}
103+
checkout-ref: ${{ inputs.tag || github.ref }}
104+
auditable: true
105+
96106
e2e:
97-
needs: [compute-versions, build-gateway, build-supervisor]
107+
needs: [compute-versions, build-gateway, build-supervisor, build-cli]
98108
permissions:
99109
actions: read
100110
contents: read
@@ -104,6 +114,10 @@ jobs:
104114
image-tag: ${{ needs.compute-versions.outputs.source_sha }}
105115
checkout-ref: ${{ inputs.tag || github.ref }}
106116
runner: linux-arm64-cpu8
117+
cli-artifact-prefix: rust-binary-cli
118+
gateway-artifact-prefix: rust-binary-gateway
119+
# The supervisor build uploads the openshell-sandbox binary artifact.
120+
sandbox-artifact-prefix: rust-binary-supervisor
107121

108122
tag-ghcr-release:
109123
name: Tag GHCR Images for Release

‎TESTING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ 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:
178+
Run the rootless Podman suite in an Ubuntu 26.04 Nix test guest:
179179

180180
```shell
181181
mise run e2e:podman:rootless

‎e2e/run.sh‎

Lines changed: 107 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: Apache-2.0
44

55
# Build the current checkout, run its gateway on the host or in a disposable
6-
# Nix test guest, and execute one named host-side E2E suite against that gateway.
6+
# Nix test guest, and execute host-side E2E tests against that gateway.
77

88
set -Eeuo pipefail
99

@@ -20,13 +20,17 @@ usage() {
2020
cat <<'EOF'
2121
Usage:
2222
e2e/run.sh [--vm DISTRO] [--with CONFIG ...] \
23-
--gateway-config PATH --suite NAME
23+
--gateway-config PATH [--features FEATURES] [--suite NAME]
2424
2525
Options:
2626
--vm DISTRO Run the gateway in a Nix test guest
2727
--with CONFIG Apply a Nix test-guest configuration; repeatable
28+
--host-cli-bin PATH Use a prebuilt host openshell CLI instead of building it
29+
--gateway-bin PATH Use a prebuilt openshell-gateway instead of building it
30+
--sandbox-bin PATH Use a prebuilt openshell-sandbox instead of building it
2831
--gateway-config PATH
2932
Fully resolved gateway TOML
33+
--features FEATURES Rust e2e feature set to enable (default: e2e)
3034
--suite NAME Rust suite at e2e/rust/tests/NAME.rs
3135
-h, --help Show this help
3236
@@ -92,6 +96,10 @@ catalog_has_entry() {
9296

9397
vm=
9498
gateway_config=
99+
gateway_bin=
100+
host_cli_bin=
101+
sandbox_bin=
102+
e2e_features=e2e
95103
suite_name=
96104
with_configurations=()
97105

@@ -107,11 +115,31 @@ while [ "$#" -gt 0 ]; do
107115
with_configurations+=("$2")
108116
shift 2
109117
;;
118+
--host-cli-bin)
119+
require_value "$1" "$#" "${2:-}"
120+
host_cli_bin="$(resolve_file "$2")" || die "--host-cli-bin does not name a file: $2"
121+
shift 2
122+
;;
123+
--gateway-bin)
124+
require_value "$1" "$#" "${2:-}"
125+
gateway_bin="$(resolve_file "$2")" || die "--gateway-bin does not name a file: $2"
126+
shift 2
127+
;;
128+
--sandbox-bin)
129+
require_value "$1" "$#" "${2:-}"
130+
sandbox_bin="$(resolve_file "$2")" || die "--sandbox-bin does not name a file: $2"
131+
shift 2
132+
;;
110133
--gateway-config)
111134
require_value "$1" "$#" "${2:-}"
112135
gateway_config=$2
113136
shift 2
114137
;;
138+
--features)
139+
require_value "$1" "$#" "${2:-}"
140+
e2e_features=$2
141+
shift 2
142+
;;
115143
--suite)
116144
require_value "$1" "$#" "${2:-}"
117145
suite_name=$2
@@ -130,9 +158,6 @@ done
130158
if [ -z "${gateway_config}" ]; then
131159
die "--gateway-config is required"
132160
fi
133-
if [ -z "${suite_name}" ]; then
134-
die "--suite is required"
135-
fi
136161
if ! command -v python3 >/dev/null 2>&1; then
137162
die "python3 is required"
138163
fi
@@ -144,12 +169,17 @@ gateway_driver="$(python3 -c '
144169
import sys, tomllib
145170
print(tomllib.load(open(sys.argv[1], "rb"))["openshell"]["gateway"]["compute_drivers"][0])
146171
' "${gateway_config}")"
147-
if [[ ! ${suite_name} =~ ^[a-z0-9][a-z0-9-]*$ ]]; then
148-
die "suite name must contain only lowercase letters, digits, and hyphens: ${suite_name}"
172+
if [ -z "${e2e_features}" ]; then
173+
die "--features must not be empty"
149174
fi
150-
suite_path="${ROOT}/e2e/rust/tests/${suite_name}.rs"
151-
if [ ! -f "${suite_path}" ]; then
152-
die "unknown suite: ${suite_name}"
175+
if [ -n "${suite_name}" ]; then
176+
if [[ ! ${suite_name} =~ ^[a-z0-9][a-z0-9_-]*$ ]]; then
177+
die "suite name must contain only lowercase letters, digits, underscores, and hyphens: ${suite_name}"
178+
fi
179+
suite_path="${ROOT}/e2e/rust/tests/${suite_name}.rs"
180+
if [ ! -f "${suite_path}" ]; then
181+
die "unknown suite: ${suite_name}"
182+
fi
153183
fi
154184
mode=host
155185
if [ -n "${vm}" ] || [ "${#with_configurations[@]}" -gt 0 ]; then
@@ -230,49 +260,68 @@ target_dir="$(e2e_cargo_target_dir "${ROOT}" mise x -- cargo)"
230260
231261
ensure_build_nofile_limit
232262
233-
echo "==> Building native host openshell CLI"
234-
mise x -- cargo build "${cargo_jobs[@]+"${cargo_jobs[@]}"}" -p openshell-cli --bin openshell
235-
host_cli_bin="${target_dir}/debug/openshell"
236-
237-
echo "==> Preparing ${linux_musl_target} build target"
238-
mise x -- rustup target add "${linux_musl_target}" >/dev/null
263+
if [ -n "${host_cli_bin}" ]; then
264+
echo "==> Using host openshell CLI: ${host_cli_bin}"
265+
else
266+
echo "==> Building native host openshell CLI"
267+
mise x -- cargo build "${cargo_jobs[@]+"${cargo_jobs[@]}"}" -p openshell-cli --bin openshell
268+
host_cli_bin="${target_dir}/debug/openshell"
269+
fi
239270
240-
echo "==> Building Linux openshell-sandbox (${linux_musl_target})"
241-
mise x -- cargo zigbuild "${cargo_jobs[@]+"${cargo_jobs[@]}"}" \
242-
--release \
243-
--target "${linux_musl_target}" \
244-
-p openshell-sandbox \
245-
--bin openshell-sandbox
246-
linux_sandbox_bin="${target_dir}/${linux_musl_target}/release/openshell-sandbox"
271+
if [ -n "${sandbox_bin}" ]; then
272+
echo "==> Using Linux openshell-sandbox: ${sandbox_bin}"
273+
linux_sandbox_bin="${sandbox_bin}"
274+
else
275+
echo "==> Preparing ${linux_musl_target} build target"
276+
mise x -- rustup target add "${linux_musl_target}" >/dev/null
277+
278+
echo "==> Building Linux openshell-sandbox (${linux_musl_target})"
279+
mise x -- cargo zigbuild "${cargo_jobs[@]+"${cargo_jobs[@]}"}" \
280+
--release \
281+
--target "${linux_musl_target}" \
282+
-p openshell-sandbox \
283+
--bin openshell-sandbox
284+
linux_sandbox_bin="${target_dir}/${linux_musl_target}/release/openshell-sandbox"
285+
fi
247286
248287
host_gateway_bin=
249288
guest_gateway_bin=
250289
if [ "${mode}" = host ]; then
251-
echo "==> Building native host openshell-gateway"
252-
mise x -- cargo build "${cargo_jobs[@]+"${cargo_jobs[@]}"}" \
253-
-p openshell-server \
254-
--bin openshell-gateway \
255-
--features bundled-z3
256-
host_gateway_bin="${target_dir}/debug/openshell-gateway"
257-
else
258-
echo "==> Preparing ${linux_gateway_rust_target} build target"
259-
mise x -- rustup target add "${linux_gateway_rust_target}" >/dev/null
260-
echo "==> Building Linux openshell-gateway (${linux_gateway_zig_target})"
261-
(
262-
eval "$(
263-
"${ROOT}/tasks/scripts/setup-zig-cc-wrapper.sh" \
264-
"${linux_gateway_zig_target}" \
265-
"${linux_gateway_zig_target}" \
266-
"${target_dir}/zig-gnu-wrapper/e2e"
267-
)"
268-
mise x -- cargo zigbuild "${cargo_jobs[@]+"${cargo_jobs[@]}"}" \
269-
--release \
270-
--target "${linux_gateway_zig_target}" \
290+
if [ -n "${gateway_bin}" ]; then
291+
echo "==> Using host openshell-gateway: ${gateway_bin}"
292+
host_gateway_bin="${gateway_bin}"
293+
else
294+
echo "==> Building native host openshell-gateway"
295+
mise x -- cargo build "${cargo_jobs[@]+"${cargo_jobs[@]}"}" \
271296
-p openshell-server \
272297
--bin openshell-gateway \
273298
--features bundled-z3
274-
)
275-
guest_gateway_bin="${target_dir}/${linux_gateway_rust_target}/release/openshell-gateway"
299+
host_gateway_bin="${target_dir}/debug/openshell-gateway"
300+
fi
301+
else
302+
if [ -n "${gateway_bin}" ]; then
303+
echo "==> Using Linux openshell-gateway: ${gateway_bin}"
304+
guest_gateway_bin="${gateway_bin}"
305+
else
306+
echo "==> Preparing ${linux_gateway_rust_target} build target"
307+
mise x -- rustup target add "${linux_gateway_rust_target}" >/dev/null
308+
echo "==> Building Linux openshell-gateway (${linux_gateway_zig_target})"
309+
(
310+
eval "$(
311+
"${ROOT}/tasks/scripts/setup-zig-cc-wrapper.sh" \
312+
"${linux_gateway_zig_target}" \
313+
"${linux_gateway_zig_target}" \
314+
"${target_dir}/zig-gnu-wrapper/e2e"
315+
)"
316+
mise x -- cargo zigbuild "${cargo_jobs[@]+"${cargo_jobs[@]}"}" \
317+
--release \
318+
--target "${linux_gateway_zig_target}" \
319+
-p openshell-server \
320+
--bin openshell-gateway \
321+
--features bundled-z3
322+
)
323+
guest_gateway_bin="${target_dir}/${linux_gateway_rust_target}/release/openshell-gateway"
324+
fi
276325
fi
277326
278327
expected_binaries=("${host_cli_bin}" "${linux_sandbox_bin}")
@@ -588,10 +637,17 @@ wait_for_gateway() {
588637
589638
wait_for_gateway
590639
591-
echo "==> Running E2E suite: ${suite_name}"
640+
test_args=(
641+
cargo test
642+
--manifest-path e2e/rust/Cargo.toml
643+
--features "${e2e_features}"
644+
)
645+
echo "==> Running E2E features: ${e2e_features}"
646+
if [ -n "${suite_name}" ]; then
647+
echo "==> Running E2E suite: ${suite_name}"
648+
test_args+=(--test "${suite_name}")
649+
fi
650+
test_args+=(-- --nocapture)
651+
592652
cd "${ROOT}"
593-
cargo test \
594-
--manifest-path e2e/rust/Cargo.toml \
595-
--features e2e \
596-
--test "${suite_name}" \
597-
-- --nocapture
653+
"${test_args[@]}"

0 commit comments

Comments
 (0)