Skip to content

Commit 8c67c27

Browse files
test(oci): add a shared Docker and Podman suite for image USER and WORKDIR (#3931)
* test(oci): share OCI image checks across Docker and Podman Add an oci-image feature testsuite that runs against installed artifacts. It covers custom WORKDIR placement, image content and ownership, workspace writes from the main process and exec, file transfer including directory-merge upload, OCI user identity, the managed /sandbox fallback, and rejection of an unwritable WORKDIR. CI runs the suite on the Docker rootful, Podman rootful, and Podman rootless tmachine guests. Replace the Docker-only custom_image e2e with the shared suite. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> Signed-off-by: Evan Lezar <elezar@nvidia.com> * test(oci): require WorkspaceValidationFailed and cover image USER fallback The unwritable WORKDIR scenario now requires the WorkspaceValidationFailed reason, so unrelated provisioning failures cannot pass it. The numeric USER scenario supplies a policy without a process section, so the image USER is the only source of the sandbox identity. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> Signed-off-by: Evan Lezar <elezar@nvidia.com> * test(podman): leave shared OCI identity checks to the oci-image suite The oci-image feature suite covers the sandbox identity seen by the main process and sandbox exec on Docker and Podman. The Podman e2e keeps the checks only it can make: the pinned image ID and the isolated workload/supervisor container pair. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> Signed-off-by: Evan Lezar <elezar@nvidia.com> * test(oci): accept existing workspace rejection diagnostics Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> Signed-off-by: Evan Lezar <elezar@nvidia.com> * test(oci): fix cleanup ordering and restore coverage parity Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> Signed-off-by: Evan Lezar <elezar@nvidia.com> * test(oci): remove migrated legacy workspace helpers and checks Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> * fix(drivers): report rejected OCI working directories as WorkspaceValidationFailed The supervisor exits with the reserved status when the sandbox rejects the image working directory. Docker maps that exit during readiness and monitoring and records it before removing the supervisor container, and Podman maps the supervisor companion's exit instead of the workload's. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> * test(oci): require WorkspaceValidationFailed for unwritable WORKDIR Unrelated provisioning failures can no longer pass the rejection scenario. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> * fix(oci): keep exit 78 reserved and report fixed workspace diagnostics The supervisor no longer passes on a workload's own exit status 78, so drivers cannot misreport it as a workspace rejection after a runtime restart. The rejection is recognized once at agent start and carried as a typed error. Docker reports the same fixed condition message as Podman and logs the supervisor output instead, and its monitor removes the supervisor container when a stop overlaps diagnostics collection. The OCI image suite registers images for cleanup only after they build. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> * refactor(oci): simplify workspace failure handling and OCI image tests Report a recorded Docker workspace rejection once, where supervisor readiness fails, and match its fixed message exactly. Read the Podman supervisor exit status once per inspection. Choose the supervisor exit status in one function and derive the workspace error type. The OCI image suite shares step helpers, checks that a custom workspace does not also create /sandbox, and its playbook waits for a connected gateway and collects failure diagnostics through the shared role. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> * test(oci): replace podman_oci_identity with shared and driver suite checks The oci-image feature suite now checks, on Docker and Podman, that the image user has no capabilities, has no_new_privs set, and cannot read the sandbox control credentials, and that a custom WORKDIR is not a mount. The checks that need container inspection (pinned image ID, network=none, supervisor user and capabilities) move to a small test in the Podman driver suite. Remove the legacy podman_oci_identity e2e test. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> * test(oci): keep podman_oci_identity for Podman-only isolation checks Restore the Podman e2e test removed in the previous commit and drop only the checks the shared oci-image suite now runs on Docker and Podman: workload capabilities, no_new_privs, credential readability, and the workspace and /sandbox mount checks. The pinned image ID and the workload/supervisor isolation checks stay, as does the Podman driver suite unchanged. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> * refactor(oci): simplify workspace failure reporting and OCI image suite Carry the Docker control supervisor's failure reason in a typed error instead of matching status text, build the fixed workspace message where the wait result is classified, and drop the fake Docker server test. Inline image cleanup ordering in the suite, read the container engine once, share sandbox naming, and stop granting a literal /sandbox in the image identity policy. Add e2e:oci-image mise tasks and use them from the ARM64 Docker workflow and TESTING.md. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> * test(oci): move shared container checks into the OCI image suite Inspect the containers the driver created through the gateway's engine in the shared suite: the workload runs the inspected image ID as the OCI identity without a network or supervisor credential mounts, and the supervisor is a separate non-root container. Keep only the Podman-specific supervisor identity and capability checks in podman_oci_identity. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> * test(oci): check the workspace rejection reason from sandbox JSON Read the WorkspaceValidationFailed condition reason from sandbox get --output json instead of matching CLI output, and restore the Docker driver's original workspace failure helpers. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> * test(oci): capture fixture image identity before sandbox creation Signed-off-by: Evan Lezar <elezar@nvidia.com> --------- Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> Signed-off-by: Evan Lezar <elezar@nvidia.com> Co-authored-by: Evan Lezar <elezar@nvidia.com>
1 parent a9a635a commit 8c67c27

27 files changed

Lines changed: 1182 additions & 489 deletions

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,10 @@ jobs:
276276
test-matrix: >-
277277
[
278278
{"environment":"fedora-podman-rootful","installer":"rpm","testsuite":"provider-refresh"},
279-
{"environment":"fedora-podman-rootless","installer":"rpm","testsuite":"provider-refresh"}
279+
{"environment":"fedora-podman-rootless","installer":"rpm","testsuite":"provider-refresh"},
280+
{"environment":"ubuntu-docker-rootful","installer":"deb","testsuite":"oci-image"},
281+
{"environment":"fedora-podman-rootful","installer":"rpm","testsuite":"oci-image"},
282+
{"environment":"fedora-podman-rootless","installer":"rpm","testsuite":"oci-image"}
280283
]
281284
282285
# Run driver-specific integration tests:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ on:
2929
required: false
3030
type: string
3131
default: >-
32-
[{"suite":"python","cmd":"mise run --no-deps --skip-deps e2e:python","apt_packages":"","python_proto":true,"mcp":false},{"suite":"oidc-python","cmd":"mise run --no-deps --skip-deps e2e:oidc-python:docker","apt_packages":"","python_proto":true,"mcp":false},{"suite":"oidc-pkce-docker","cmd":"mise run --no-deps --skip-deps e2e:oidc-pkce:docker","apt_packages":"openssh-client","python_proto":false,"mcp":false},{"suite":"rust-docker","cmd":"mise run --no-deps --skip-deps e2e:rust","apt_packages":"openssh-client","python_proto":false,"mcp":false},{"suite":"mcp","cmd":"mise run --no-deps --skip-deps e2e:mcp","apt_packages":"","python_proto":false,"mcp":true}]
32+
[{"suite":"python","cmd":"mise run --no-deps --skip-deps e2e:python","apt_packages":"","python_proto":true,"mcp":false},{"suite":"oidc-python","cmd":"mise run --no-deps --skip-deps e2e:oidc-python:docker","apt_packages":"","python_proto":true,"mcp":false},{"suite":"oidc-pkce-docker","cmd":"mise run --no-deps --skip-deps e2e:oidc-pkce:docker","apt_packages":"openssh-client","python_proto":false,"mcp":false},{"suite":"rust-docker","cmd":"mise run --no-deps --skip-deps e2e:rust","apt_packages":"openssh-client","python_proto":false,"mcp":false},{"suite":"oci-image","cmd":"mise run --no-deps --skip-deps e2e:oci-image","apt_packages":"openssh-client","python_proto":false,"mcp":false},{"suite":"mcp","cmd":"mise run --no-deps --skip-deps e2e:mcp","apt_packages":"","python_proto":false,"mcp":true}]
3333
3434
permissions:
3535
actions: read

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ jobs:
146146
test-matrix: >-
147147
[
148148
{"environment":"fedora-podman-rootful","installer":"rpm","testsuite":"provider-refresh"},
149-
{"environment":"fedora-podman-rootless","installer":"rpm","testsuite":"provider-refresh"}
149+
{"environment":"fedora-podman-rootless","installer":"rpm","testsuite":"provider-refresh"},
150+
{"environment":"ubuntu-docker-rootful","installer":"deb","testsuite":"oci-image"},
151+
{"environment":"fedora-podman-rootful","installer":"rpm","testsuite":"oci-image"},
152+
{"environment":"fedora-podman-rootless","installer":"rpm","testsuite":"oci-image"}
150153
]
151154
152155
docker-e2e:

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,10 @@ jobs:
196196
test-matrix: >-
197197
[
198198
{"environment":"fedora-podman-rootful","installer":"rpm","testsuite":"provider-refresh"},
199-
{"environment":"fedora-podman-rootless","installer":"rpm","testsuite":"provider-refresh"}
199+
{"environment":"fedora-podman-rootless","installer":"rpm","testsuite":"provider-refresh"},
200+
{"environment":"ubuntu-docker-rootful","installer":"deb","testsuite":"oci-image"},
201+
{"environment":"fedora-podman-rootful","installer":"rpm","testsuite":"oci-image"},
202+
{"environment":"fedora-podman-rootless","installer":"rpm","testsuite":"oci-image"}
200203
]
201204
202205
docker-e2e:

‎Cargo.lock‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎TESTING.md‎

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,32 @@ binary. `tests/artifacts.nix` keeps the follow-up exclusions explicit and uses
320320
the same filter for the generated inventory, so excluded binaries cannot appear
321321
as false passes or silently re-enter the archive.
322322

323+
The `oci-image` feature testsuite (`tests/suites/features/oci-image`) checks
324+
OCI image identity and working-directory behavior shared by the Docker and
325+
Podman drivers against installed deb packages on Ubuntu and rpm packages on
326+
Fedora. CI runs it on Docker rootful, Podman rootful, and Podman rootless guests:
327+
328+
```shell
329+
nix run .#tmachine -- test ubuntu-docker-rootful deb oci-image
330+
```
331+
332+
The shared suite also runs in the existing ARM64 Docker E2E workflow for
333+
branch checks and both release workflows. That interim lane compiles the same
334+
test crate natively and uses the architecture-matched prebuilt candidate CLI
335+
and gateway plus the candidate multi-architecture sandbox and supervisor
336+
images through `e2e/with-docker-gateway.sh`. The tmachine lanes still use
337+
x86_64 artifacts; they do not replace ARM64 image coverage.
338+
339+
Run it against a local Docker or Podman gateway:
340+
341+
```shell
342+
mise run e2e:oci-image
343+
mise run e2e:oci-image:podman
344+
```
345+
346+
Both tasks set `OPENSHELL_TEST_CONTAINER_ENGINE`, the command that builds test
347+
images into the gateway's image store.
348+
323349
Run the VM-backed Rust CLI e2e suite:
324350

325351
```shell
@@ -499,7 +525,7 @@ cargo test --manifest-path e2e/rust/Cargo.toml --features e2e --test sync
499525
Run a single Docker-only test directly with cargo:
500526

501527
```shell
502-
cargo test --manifest-path e2e/rust/Cargo.toml --features e2e-docker --test custom_image
528+
cargo test --manifest-path e2e/rust/Cargo.toml --features e2e-docker --test docker_preflight
503529
```
504530

505531
The harness (`e2e/rust/src/harness/`) provides:

‎crates/openshell-core/src/driver_utils.rs‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,22 @@ pub const CONDITION_WORKSPACE_VALIDATION_FAILED: &str = "WorkspaceValidationFail
5858

5959
/// Supervisor exit status reserved for OCI workspace validation failures.
6060
///
61-
/// Local container drivers translate this status into
61+
/// Local container drivers translate a supervisor exit with this status into
6262
/// [`CONDITION_WORKSPACE_VALIDATION_FAILED`] so users receive the specific
6363
/// provisioning failure rather than a generic container exit.
6464
pub const SUPERVISOR_EXIT_WORKSPACE_VALIDATION_FAILED: i32 = 78;
6565

66+
/// Error context for a rejected image-provided OCI working directory.
67+
///
68+
/// The supervisor recognizes it in a failed agent start and exits with
69+
/// [`SUPERVISOR_EXIT_WORKSPACE_VALIDATION_FAILED`].
70+
pub const WORKSPACE_VALIDATION_ERROR_CONTEXT: &str = "image workspace validation failed";
71+
72+
/// Driver condition message for [`CONDITION_WORKSPACE_VALIDATION_FAILED`].
73+
/// Fixed text, because supervisor output may contain secrets.
74+
pub const WORKSPACE_VALIDATION_FAILED_MESSAGE: &str =
75+
"OCI WorkingDir is not usable by the sandbox identity";
76+
6677
/// Ready-condition reason when a container was terminated by an external signal.
6778
///
6879
/// SIGKILL/SIGTERM (exit 137/143) is what a Podman/Docker machine or daemon

0 commit comments

Comments
 (0)