-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(e2e): use xtask for host Linux workflows #2254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
krishicks
wants to merge
1
commit into
main
Choose a base branch
from
hicks/push-wnynltnmyltl
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| [package] | ||
| name = "xtask" | ||
| version.workspace = true | ||
| edition.workspace = true | ||
| rust-version.workspace = true | ||
| license.workspace = true | ||
| repository.workspace = true | ||
| publish = false | ||
|
|
||
| [dependencies] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #!/usr/bin/env bash | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set -Eeuo pipefail | ||
|
|
||
| echo "==> Installing OpenShell development dependencies on Ubuntu" | ||
| sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y \ | ||
| build-essential \ | ||
| ca-certificates \ | ||
| clang \ | ||
| cmake \ | ||
| curl \ | ||
| git \ | ||
| jq \ | ||
| libclang-dev \ | ||
| libssl-dev \ | ||
| libz3-dev \ | ||
| musl-tools \ | ||
| openssh-client \ | ||
| pkg-config \ | ||
| python3 \ | ||
| python3-venv \ | ||
| rsync \ | ||
| socat \ | ||
| unzip \ | ||
| xz-utils \ | ||
| zstd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!/usr/bin/env bash | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set -Eeuo pipefail | ||
|
|
||
| if [ ! -r /etc/os-release ]; then | ||
| echo "cannot detect guest OS: /etc/os-release is missing" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # shellcheck disable=SC1091 | ||
| . /etc/os-release | ||
|
|
||
| if [ "${ID:-}" != "ubuntu" ]; then | ||
| echo "expected an Ubuntu system, found ${ID:-unknown}" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ -n "${OPENSHELL_EXPECTED_OS:-}" ] \ | ||
| && [ "ubuntu-${VERSION_ID:-unknown}" != "${OPENSHELL_EXPECTED_OS}" ]; then | ||
| echo "expected ${OPENSHELL_EXPECTED_OS}, found ubuntu-${VERSION_ID:-unknown}" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "==> Preparing Ubuntu ${VERSION_ID:-unknown}" | ||
| sudo apt-get update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| #!/usr/bin/env bash | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set -Eeuo pipefail | ||
|
|
||
| echo "==> Preparing rootless Podman" | ||
| if ! grep -q "^${USER}:" /etc/subuid; then | ||
| sudo usermod --add-subuids 100000-165535 "${USER}" | ||
| fi | ||
| if ! grep -q "^${USER}:" /etc/subgid; then | ||
| sudo usermod --add-subgids 100000-165535 "${USER}" | ||
| fi | ||
|
|
||
| runtime_dir="/run/user/$(id -u)" | ||
| sudo install -d -m 0700 -o "$(id -u)" -g "$(id -g)" "${runtime_dir}" | ||
| export XDG_RUNTIME_DIR="${runtime_dir}" | ||
|
|
||
| echo "==> Configuring rootless Podman" | ||
| containers_config_dir="${HOME}/.config/containers" | ||
| mkdir -p "${containers_config_dir}" | ||
| cat >"${containers_config_dir}/containers.conf" <<'EOF' | ||
| [containers] | ||
| # Use file-backed logs so Docker-compatible log reads work reliably. | ||
| log_driver = "k8s-file" | ||
|
|
||
| [engine] | ||
| # Use file-backed events so open Libpod streams receive lifecycle events reliably. | ||
| events_logger = "file" | ||
| EOF | ||
|
|
||
| if [ "${OPENSHELL_SKIP_PODMAN_SOCKET:-0}" != "1" ]; then | ||
| echo "==> Enabling the rootless Podman socket" | ||
| sudo loginctl enable-linger "$USER" | ||
| systemctl --user daemon-reload | ||
| systemctl --user enable --now podman.socket | ||
| if ! systemctl --user is-active --quiet podman.socket; then | ||
| echo "rootless Podman socket did not become active" >&2 | ||
| systemctl --user status --no-pager podman.socket >&2 || true | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
| require_podman_info() { | ||
| local format="$1" | ||
| local expected="$2" | ||
| local description="$3" | ||
| local actual | ||
|
|
||
| if ! actual="$(podman info --format "${format}")"; then | ||
| echo "could not inspect Podman ${description}" >&2 | ||
| podman info >&2 || true | ||
| exit 1 | ||
| fi | ||
| if [ "${actual}" != "${expected}" ]; then | ||
| echo "expected Podman ${description} to be ${expected}, found ${actual:-<empty>}" >&2 | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| require_podman_info '{{.Host.Security.Rootless}}' true "rootless mode" | ||
| require_podman_info '{{.Host.LogDriver}}' k8s-file "log driver" | ||
| require_podman_info '{{.Host.EventLogger}}' file "event logger" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #!/usr/bin/env bash | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set -Eeuo pipefail | ||
|
|
||
| echo "==> Installing rootless Podman on Ubuntu" | ||
| sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y \ | ||
| ca-certificates \ | ||
| curl \ | ||
| podman |
9 changes: 9 additions & 0 deletions
9
crates/xtask/scripts/machine/validation/ubuntu-apparmor-diagnostics.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #!/usr/bin/env bash | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| echo "=== recent AppArmor denials ===" | ||
| sudo dmesg \ | ||
| | grep -E 'apparmor=.*DENIED|profile="unprivileged_userns"' \ | ||
| | tail -100 \ | ||
| || true |
55 changes: 55 additions & 0 deletions
55
crates/xtask/scripts/machine/validation/ubuntu-podman-rootless-preflight.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| #!/usr/bin/env bash | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set -Eeuo pipefail | ||
|
|
||
| case "${OPENSHELL_EXPECTED_OS:-}" in | ||
| ubuntu-24.04) expected_podman_major=4 ;; | ||
| ubuntu-26.04) expected_podman_major=5 ;; | ||
| *) | ||
| echo "cannot determine the expected Podman version for ${OPENSHELL_EXPECTED_OS:-unknown OS}" >&2 | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| echo "=== host ===" | ||
| uname -a | ||
| echo "=== AppArmor ===" | ||
| cat /proc/self/attr/current | ||
| sudo aa-status || true | ||
| echo "=== Podman ===" | ||
| podman version | ||
| podman info --debug | ||
|
|
||
| podman_version="$(podman version --format '{{.Client.Version}}')" | ||
| case "${podman_version}" in | ||
| "${expected_podman_major}".*) ;; | ||
| *) | ||
| echo "expected Podman ${expected_podman_major}.x, found ${podman_version}" >&2 | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| apparmor_restrict_userns="$(sudo sysctl -n kernel.apparmor_restrict_unprivileged_userns)" | ||
| if [ "${apparmor_restrict_userns}" != "1" ]; then | ||
| echo "expected kernel.apparmor_restrict_unprivileged_userns=1, found ${apparmor_restrict_userns}" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "==> Probing the rootless capability bounding set" | ||
| capbset_probe="$(mktemp "${TMPDIR:-/tmp}/openshell-capbset-probe.XXXXXX")" | ||
| cleanup_capbset_probe() { | ||
| rm -f "${capbset_probe}" | ||
| } | ||
| trap cleanup_capbset_probe EXIT | ||
| cc -static -O2 -Wall -Wextra -Werror \ | ||
| e2e/support/capbset-probe.c \ | ||
| -o "${capbset_probe}" | ||
| podman run --rm \ | ||
| --cap-add=SETPCAP \ | ||
| --volume "${capbset_probe}:/openshell-capbset-probe:ro" \ | ||
| docker.io/library/alpine:3.22 \ | ||
| /openshell-capbset-probe | ||
| cleanup_capbset_probe | ||
| trap - EXIT |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we avoid replacing the user’s existing
~/.config/containers/containers.confhere? Since--setupoperates on the current host, this can discard unrelated Podman configuration. A task-owned temporary directory withCONTAINERS_CONFexported to the E2E process tree would preserve the required log and event settings without changing the user’s configuration; anEXITtrap can clean it up afterward.