Skip to content

Commit fc9dbab

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

7 files changed

Lines changed: 175 additions & 39 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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ jobs:
136136
runner: linux-arm64-cpu8
137137
cli-artifact-prefix: rust-binary-cli
138138
gateway-artifact-prefix: rust-binary-gateway
139+
sandbox-artifact-prefix: rust-binary-sandbox
139140
vm-driver-artifact-name: driver-vm-linux-amd64
140141

141142
gpu-e2e:

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

Lines changed: 34 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,20 @@ 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+
args=(
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+
--suite smoke
209+
)
210+
211+
mise x -- e2e/run.sh "${args[@]}"
179212
180213
e2e-vm:
181214
name: E2E (rust-vm-${{ matrix.suite }})

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

Lines changed: 12 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,9 @@ 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+
sandbox-artifact-prefix: rust-binary-sandbox
8293

8394
tag-ghcr-dev:
8495
name: Tag GHCR Images as Dev

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

Lines changed: 14 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,9 @@ 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+
sandbox-artifact-prefix: rust-binary-sandbox
107120

108121
tag-ghcr-release:
109122
name: Tag GHCR Images for Release

‎e2e/run.sh‎

Lines changed: 75 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ Usage:
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
3033
--suite NAME Rust suite at e2e/rust/tests/NAME.rs
@@ -92,6 +95,9 @@ catalog_has_entry() {
9295

9396
vm=
9497
gateway_config=
98+
gateway_bin=
99+
host_cli_bin=
100+
sandbox_bin=
95101
suite_name=
96102
with_configurations=()
97103

@@ -107,6 +113,21 @@ while [ "$#" -gt 0 ]; do
107113
with_configurations+=("$2")
108114
shift 2
109115
;;
116+
--host-cli-bin)
117+
require_value "$1" "$#" "${2:-}"
118+
host_cli_bin="$(resolve_file "$2")" || die "--host-cli-bin does not name a file: $2"
119+
shift 2
120+
;;
121+
--gateway-bin)
122+
require_value "$1" "$#" "${2:-}"
123+
gateway_bin="$(resolve_file "$2")" || die "--gateway-bin does not name a file: $2"
124+
shift 2
125+
;;
126+
--sandbox-bin)
127+
require_value "$1" "$#" "${2:-}"
128+
sandbox_bin="$(resolve_file "$2")" || die "--sandbox-bin does not name a file: $2"
129+
shift 2
130+
;;
110131
--gateway-config)
111132
require_value "$1" "$#" "${2:-}"
112133
gateway_config=$2
@@ -230,49 +251,68 @@ target_dir="$(e2e_cargo_target_dir "${ROOT}" mise x -- cargo)"
230251
231252
ensure_build_nofile_limit
232253
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
254+
if [ -n "${host_cli_bin}" ]; then
255+
echo "==> Using host openshell CLI: ${host_cli_bin}"
256+
else
257+
echo "==> Building native host openshell CLI"
258+
mise x -- cargo build "${cargo_jobs[@]+"${cargo_jobs[@]}"}" -p openshell-cli --bin openshell
259+
host_cli_bin="${target_dir}/debug/openshell"
260+
fi
239261
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"
262+
if [ -n "${sandbox_bin}" ]; then
263+
echo "==> Using Linux openshell-sandbox: ${sandbox_bin}"
264+
linux_sandbox_bin="${sandbox_bin}"
265+
else
266+
echo "==> Preparing ${linux_musl_target} build target"
267+
mise x -- rustup target add "${linux_musl_target}" >/dev/null
268+
269+
echo "==> Building Linux openshell-sandbox (${linux_musl_target})"
270+
mise x -- cargo zigbuild "${cargo_jobs[@]+"${cargo_jobs[@]}"}" \
271+
--release \
272+
--target "${linux_musl_target}" \
273+
-p openshell-sandbox \
274+
--bin openshell-sandbox
275+
linux_sandbox_bin="${target_dir}/${linux_musl_target}/release/openshell-sandbox"
276+
fi
247277
248278
host_gateway_bin=
249279
guest_gateway_bin=
250280
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}" \
281+
if [ -n "${gateway_bin}" ]; then
282+
echo "==> Using host openshell-gateway: ${gateway_bin}"
283+
host_gateway_bin="${gateway_bin}"
284+
else
285+
echo "==> Building native host openshell-gateway"
286+
mise x -- cargo build "${cargo_jobs[@]+"${cargo_jobs[@]}"}" \
271287
-p openshell-server \
272288
--bin openshell-gateway \
273289
--features bundled-z3
274-
)
275-
guest_gateway_bin="${target_dir}/${linux_gateway_rust_target}/release/openshell-gateway"
290+
host_gateway_bin="${target_dir}/debug/openshell-gateway"
291+
fi
292+
else
293+
if [ -n "${gateway_bin}" ]; then
294+
echo "==> Using Linux openshell-gateway: ${gateway_bin}"
295+
guest_gateway_bin="${gateway_bin}"
296+
else
297+
echo "==> Preparing ${linux_gateway_rust_target} build target"
298+
mise x -- rustup target add "${linux_gateway_rust_target}" >/dev/null
299+
echo "==> Building Linux openshell-gateway (${linux_gateway_zig_target})"
300+
(
301+
eval "$(
302+
"${ROOT}/tasks/scripts/setup-zig-cc-wrapper.sh" \
303+
"${linux_gateway_zig_target}" \
304+
"${linux_gateway_zig_target}" \
305+
"${target_dir}/zig-gnu-wrapper/e2e"
306+
)"
307+
mise x -- cargo zigbuild "${cargo_jobs[@]+"${cargo_jobs[@]}"}" \
308+
--release \
309+
--target "${linux_gateway_zig_target}" \
310+
-p openshell-server \
311+
--bin openshell-gateway \
312+
--features bundled-z3
313+
)
314+
guest_gateway_bin="${target_dir}/${linux_gateway_rust_target}/release/openshell-gateway"
315+
fi
276316
fi
277317
278318
expected_binaries=("${host_cli_bin}" "${linux_sandbox_bin}")

‎nix/test-guest/configuration/podman.yml‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,16 @@
2727
name: podman
2828
state: present
2929

30-
- name: Verify Podman
30+
- name: Enable the rootless Podman API socket
31+
ansible.builtin.systemd_service:
32+
name: podman.socket
33+
scope: user
34+
enabled: true
35+
state: started
36+
become: false
37+
38+
- name: Verify rootless Podman
3139
ansible.builtin.command:
3240
cmd: podman info
41+
become: false
3342
changed_when: false

0 commit comments

Comments
 (0)