Skip to content

feat(e2e): use xtask for host Linux workflows#2254

Open
krishicks wants to merge 1 commit into
mainfrom
hicks/push-wnynltnmyltl
Open

feat(e2e): use xtask for host Linux workflows#2254
krishicks wants to merge 1 commit into
mainfrom
hicks/push-wnynltnmyltl

Conversation

@krishicks

@krishicks krishicks commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

This adds a cargo xtask entry point for running Podman end-to-end tests locally or on a prepared Linux host, using the scripts that used to be in Github Actions as the basis. The host provider validates typed OS selection and composes focused setup scripts for Ubuntu 24.04 and Ubuntu 26.04.

Related Issue

Changes

Testing

  • mise run pre-commit passes
  • Unit tests added/updated
  • E2E tests added/updated (if applicable)

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable)

@copy-pr-bot

copy-pr-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@krishicks
krishicks marked this pull request as ready for review July 14, 2026 00:29
@krishicks
krishicks force-pushed the hicks/push-wnynltnmyltl branch from 0a09431 to 93c0246 Compare July 14, 2026 17:58
@krishicks krishicks added the test:e2e Requires end-to-end coverage label Jul 22, 2026
@github-actions

Copy link
Copy Markdown

Label test:e2e applied for 93c0246. Open the existing run and click Re-run all jobs to execute with the label set. The run will execute the standard E2E suite after building the required gateway and supervisor images once. The matching required CI gate status on this PR will flip green automatically once the run finishes.

@krishicks
krishicks force-pushed the hicks/push-wnynltnmyltl branch from 93c0246 to f19d8df Compare July 22, 2026 14:49
@drew

drew commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Agent review

Recommendation: request changes. The architecture is sound and closely follows the canonical xtask pattern, but I found four functional/security issues plus required documentation drift. No Critical findings.

Warnings

  1. The release smoke test can report a false success.

    ubuntu-podman-rootless.sh:109 treats every curl failure as policy denial. DNS failure, TLS failure, missing routing, or a broken proxy would all pass. Capture stderr/status and require OpenShell's expected policy-denial signature—such as the CONNECT 403/detail—or verify the corresponding OCSF denial event.

  2. The CI migration removes dedicated rootless-Podman regression coverage.

    The single xtask invocation at e2e-test.yml:169 replaces assertions for:

    • Expected Podman major versions
    • kernel.apparmor_restrict_unprivileged_userns=1
    • The e2e/support/capbset-probe.c check
    • AppArmor/Podman failure diagnostics

    These checks specifically protect still-open issue #2069. Port them into the parameterized host-preparation task rather than dropping them; otherwise CI may stay green after the runner stops exercising the intended security environment.

  3. --provider host destructively overwrites user Podman configuration.

    common.sh:23 truncates ~/.config/containers/containers.conf. That is reasonable in a disposable VM but unsafe for an advertised host workflow. Use a task-owned temporary configuration, or back up and restore the existing file with an EXIT trap.

  4. CWE-494: a mutable remote installer receives a forwarded credential.

    The Lima request forwards MISE_GITHUB_TOKEN at e2e_machine.rs:90, and VM setup then executes https://mise.run directly at common.sh:8. Pin and checksum the installer or release binary, and avoid exposing the token until the trusted bootstrap is complete.

  5. Required agent-infrastructure and developer documentation are missing.

    The full sync-agent-infra audit finds the new crates/xtask absent from AGENTS.md. The commands and prerequisites also exist only in the PR description; add contributor/crate documentation and update test-release-canary to describe the new local Debian smoke path.

Suggestions

  • The Nix shell supplies Lima 2.1.4, but --snapshot fails generically on Lima 1.0.7 because driver detection uses start --list-drivers. Document/enforce a minimum version or feature-detect this capability. The flag exists in current Lima documentation.
  • Fix the malformed provider help text at e2e.rs:16.

cargo-xtask reference comparison

The implementation aligns strongly with matklad's cargo-xtask specification:

  • Workspace member with the canonical run --package xtask -- alias
  • One binary with subcommands
  • Committed workspace lockfile
  • Zero dependencies and minimal compile time
  • Alias works from nested workspace directories
  • Automation and argument validation live in tested Rust

The deliberate departure is that these tasks require Lima, mise, Bash, package managers, systemd, and Podman. That is reasonable for Linux environment orchestration, but it makes explicit prerequisite/version documentation and safe host mutation more important.

Validation

  • cargo test -p xtask: 43 passed
  • Clippy with -D warnings: passed
  • cargo fmt --check: passed
  • ShellCheck on all new scripts: passed
  • git diff --check: passed
  • Live CI on exact head f19d8df6: all non-skipped checks passed, including Ubuntu 24.04 and 26.04 rootless Podman
  • Working tree remains clean

The infrastructure audit also found one pre-existing, unrelated drift item: CONTRIBUTING.md lists nonexistent review-security-changes; this PR did not introduce it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it correct to say that we are both building and testing OpenShell inside these vms?

i think the goal of bringing in these vms is to recreate arbitrary environments so that we can reproduce issues or run e2e tests.

instead of building the artifacts into the vm, can we instead load artifacts (binary or install packages) into the prepared vm? this lets us keep build a test separate concerns.

the flow in my mind is to

  1. build the artifacts using existing flows
  2. load the artifacts into the vm and start openshell
  3. run e2e/conformance tests against the openshell gateway running in the vm

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would second that. In our e2e tests I merged #2311 to use prebuilt binaries for all our e2e tests. The goal state that I would envision is that we build the binaries ONCE for a given git SHA and store these in the ghcr or something similar. The testing pipelines would consume these binaries and test them where applicable. Once tests pass, the release pipelines would consume these binaries to package them.

One could even change the ordering of this so that the artifacts that are tested in the e2e tests are the PACKAGES themselves. This would mean that we produce deb or rpm packages (or snaps) and use these to install the artifacts under test in our test infrastructure. This would have the advantage of covering a lot of what our "canary" tests are currently covering.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of building the artifacts into the vm, can we instead load artifacts (binary or install packages) into the prepared vm? this lets us keep build a test separate concerns.

Codex points out that building in a VM may be useful to test the development flow and could ensure that we're able to build cross-distro binaries locally. So we may want to consider keeping it:

So: the reviewer is correct about separating build from test, and the reply proposes the right end state. The only part I would avoid is eliminating build-in-guest entirely—it has value, but as a deliberate diagnostic mode rather than the primary test pipeline.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have infra to build cross-distro binaries, so I think we punt on this for now to keep the PR simple and focused on one problem.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment from my agent:

  • Building in a VM can diagnose whether a source checkout builds in a particular environment.
  • It should not be part of the normal E2E or release-validation path.
  • “Building cross-distro binaries” is imprecise. OpenShell defines artifact portability through static musl binaries and GNU binaries with a glibc 2.28 floor—not by producing separate binaries on every distro. See architecture/build.md:44.
  • Runtime compatibility should test the same binary or package across Ubuntu, CentOS, and RHEL. Otherwise each environment tests a different artifact.
  • Merged PR ci(e2e): reuse prebuilt CLI and gateway artifacts #2311 (ci(e2e): reuse prebuilt CLI and gateway artifacts #2311) already established build-once artifact reuse and reduced E2E wall time by 39%.
  • Testing the resulting .deb and .rpm packages is the strongest end state because the exact artifacts that pass can subsequently be promoted.

If cross-distro development builds are a real supported contract, add them later as an explicitly separate diagnostic workflow

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it correct to say that we are both building and testing OpenShell inside these vms?

Yes and no. In the Github Action we use the prebuilt CLI and gateway binaries via the environment variables OPENSHELL_BIN and OPENSHELL_GATEWAY_BIN that are set by the setup actions setup-e2e-cli/setup-e2e-gateway and honored by e2e_build_gateway_binaries. If that's not set, it builds them as usual in the environment (e.g. the VM or, if we weren't using prebuilt binaries, the Github Action machine). The xtask is here just to set up the environment and run a mise task no different than it ran before.

can we instead load artifacts (binary or install packages) into the prepared vm?

The Debian package test requires a provided artifact, so, yes.

Comment thread crates/xtask/src/lima.rs Outdated

fn driver_available(driver: &str) -> Result<bool, String> {
let output = Command::new("limactl")
.args(["start", "--list-drivers"])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pointed out by agent:

--list-drivers only confirms that Lima registered the QEMU driver; it does not confirm that the
required qemu-system-* executable is installed. For example, Lima 2.0.3 can list qemu on a
Homebrew installation with no QEMU executable available. In that case --snapshot selects
Backend::Qemu and fails during limactl start instead of taking the fallback below. Could we verify
that QEMU is operational, or fail early with an actionable installation message?

I reproed it locally on my mac:

• $ limactl start --list-drivers
  qemu
  vz
  krunkit

  $ limactl --tty=false start \
      --name openshell-qemu-probe \
      --arch aarch64 \
      --cpus 1 \
      --memory 1 \
      --disk 1 \
      --vm-type qemu \
      --plain \
      template:ubuntu-26.04
  time="2026-07-22T17:52:04-07:00" level=info msg="Terminal is not available, proceeding without
  opening an editor"
  time="2026-07-22T17:52:04-07:00" level=info msg="Starting the instance `openshell-qemu-probe` with
  internal VM driver `qemu`"
  time="2026-07-22T17:52:04-07:00" level=fatal msg="failed to find the QEMU binary for the architecture
  `aarch64`: exec: \"qemu-system-aarch64\": executable file not found in $PATH"
``

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I split the local VM/lima stuff out of this PR to reduce the scope. This will be resolved in a separate PR that restores that functionality.

@krishicks
krishicks force-pushed the hicks/push-wnynltnmyltl branch from f19d8df to 3dd56a9 Compare July 23, 2026 16:12
@krishicks krishicks changed the title feat: add xtask for parameterized task workflows feat(xtask): use xtask for host Linux e2e test workflows Jul 23, 2026
@krishicks krishicks changed the title feat(xtask): use xtask for host Linux e2e test workflows feat(e2e): use xtask for host Linux e2e test workflows Jul 23, 2026
@krishicks
krishicks force-pushed the hicks/push-wnynltnmyltl branch 3 times, most recently from 0062365 to 30aaf83 Compare July 23, 2026 16:21
@krishicks krishicks changed the title feat(e2e): use xtask for host Linux e2e test workflows feat(e2e): use xtask for host Linux workflows Jul 23, 2026
@krishicks
krishicks force-pushed the hicks/push-wnynltnmyltl branch from 30aaf83 to 13318fb Compare July 23, 2026 16:42
This adds a cargo xtask entry point for running Podman end-to-end tests locally
or on a prepared Linux host, using the scripts that used to be in GitHub
Actions as the basis. The --setup mode validates an explicit OS selection and
composes focused setup scripts for Ubuntu 24.04 and Ubuntu 26.04.

Signed-off-by: Kris Hicks <khicks@nvidia.com>
@krishicks
krishicks force-pushed the hicks/push-wnynltnmyltl branch from 13318fb to 57d7be3 Compare July 23, 2026 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:e2e Requires end-to-end coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants