diff --git a/.github/actions/restore-native-podman-e2e/action.yaml b/.github/actions/restore-native-podman-e2e/action.yaml index 4fe96616ad2..61721482244 100644 --- a/.github/actions/restore-native-podman-e2e/action.yaml +++ b/.github/actions/restore-native-podman-e2e/action.yaml @@ -212,8 +212,7 @@ runs: cleanup_status=$? set -e if [[ "$cleanup_status" -ne 0 ]]; then - echo "::error::Native Podman runtime cleanup did not complete; preserving Podman and Docker recovery authority" >&2 - exit "$cleanup_status" + echo "::warning::Native Podman runtime cleanup did not complete; attempting Docker restoration before failing" >&2 fi restore_present=false if sudo -n test -e "$restore_root" || sudo -n test -L "$restore_root"; then @@ -327,7 +326,7 @@ runs: sudo -n rm -f -- "$runtime_state_path" sudo -n rmdir -- "$restore_root" fi - if [[ "$cleanup_authorized" == true ]]; then + if [[ "$cleanup_authorized" == true && "$cleanup_status" -eq 0 ]]; then for target in "$toolchain_install_root/bin/podman" "$toolchain_install_root/bin/pasta"; do if sudo -n test -e "$target" || sudo -n test -L "$target"; then sudo -n test -f "$target" @@ -342,3 +341,7 @@ runs: sudo -n rm -f -- "$cleanup_state_path" sudo -n rmdir -- "$toolchain_install_root" fi + if [[ "$cleanup_status" -ne 0 ]]; then + echo "::error::Native Podman runtime cleanup did not complete; preserved Podman recovery authority after restoring Docker" >&2 + exit "$cleanup_status" + fi diff --git a/.github/actions/setup-native-podman-e2e/action.yaml b/.github/actions/setup-native-podman-e2e/action.yaml index a03f0af0ae4..6ed8301fc95 100644 --- a/.github/actions/setup-native-podman-e2e/action.yaml +++ b/.github/actions/setup-native-podman-e2e/action.yaml @@ -9,6 +9,18 @@ inputs: description: Prepare Podman when the E2E dispatch selected the native Podman gateway runtime. required: false default: "false" + toolchain: + description: Select the reviewed Podman toolchain contract. + required: false + default: native-6.1 + isolate-docker-cli: + description: Remove the Docker client after disabling the Docker daemon. + required: false + default: "true" + cleanup-fixture: + description: Optional immutable workflow-owned restore script used if runtime setup is interrupted. + required: false + default: "" runs: using: composite @@ -19,6 +31,7 @@ runs: shell: bash env: RUNNER_ARCH_KIND: ${{ runner.arch }} + TOOLCHAIN_PROFILE: ${{ inputs.toolchain }} run: | set -euo pipefail case "$RUNNER_ARCH_KIND" in @@ -29,8 +42,26 @@ runs: exit 1 ;; esac + case "$TOOLCHAIN_PROFILE" in + native-6.1) + artifact_prefix=native-podman-e2e-toolchain + podman_version=6.1.0 + podman_source_sha=cade97a52ebdf9dbf9e81de8009015776837a074 + ;; + portable-5.7) + artifact_prefix=portable-podman-e2e-toolchain + podman_version=5.7.0 + podman_source_sha=0370128fc8dcae93533334324ef838db8f8da8cb + ;; + *) + echo "::error::Unsupported reviewed Podman toolchain: $TOOLCHAIN_PROFILE" >&2 + exit 1 + ;; + esac printf 'architecture=%s\n' "$architecture" >>"$GITHUB_OUTPUT" - printf 'name=native-podman-e2e-toolchain-%s\n' "$architecture" >>"$GITHUB_OUTPUT" + printf 'name=%s-%s\n' "$artifact_prefix" "$architecture" >>"$GITHUB_OUTPUT" + printf 'podman_version=%s\n' "$podman_version" >>"$GITHUB_OUTPUT" + printf 'podman_source_sha=%s\n' "$podman_source_sha" >>"$GITHUB_OUTPUT" - name: Download native Podman toolchain if: ${{ inputs.enabled == 'true' }} @@ -43,10 +74,44 @@ runs: if: ${{ inputs.enabled == 'true' }} shell: bash env: + CLEANUP_FIXTURE: ${{ inputs.cleanup-fixture }} EXPECTED_ARCHITECTURE: ${{ steps.artifact.outputs.architecture }} + EXPECTED_PODMAN_SOURCE_SHA: ${{ steps.artifact.outputs.podman_source_sha }} + EXPECTED_PODMAN_VERSION: ${{ steps.artifact.outputs.podman_version }} TOOLCHAIN_DIRECTORY: ${{ runner.temp }}/native-podman-e2e-toolchain run: | set -euo pipefail + setup_completed=false + cleanup_interrupted_setup() { + local command_status=$? + local cleanup_status=0 + trap - EXIT INT TERM + if [[ "$setup_completed" != true && -n "$CLEANUP_FIXTURE" ]]; then + set +e + /usr/bin/env -i \ + HOME="$HOME" \ + PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ + RUNNER_TEMP="$RUNNER_TEMP" \ + /bin/bash "$CLEANUP_FIXTURE" + cleanup_status=$? + set -e + fi + if [[ "$cleanup_status" -ne 0 ]]; then + echo "::error::Native Podman setup failed and runner restoration also failed" >&2 + exit "$cleanup_status" + fi + exit "$command_status" + } + if [[ -n "$CLEANUP_FIXTURE" ]]; then + [[ "$CLEANUP_FIXTURE" == /usr/local/libexec/nemoclaw/* ]] + [[ "$CLEANUP_FIXTURE" != *'/../'* && "$CLEANUP_FIXTURE" != */.. ]] + sudo -n test -f "$CLEANUP_FIXTURE" + sudo -n test ! -L "$CLEANUP_FIXTURE" + [[ "$(sudo -n stat -c '%u:%g:%a' "$CLEANUP_FIXTURE")" == "0:0:555" ]] + trap cleanup_interrupted_setup EXIT + trap 'exit 130' INT + trap 'exit 143' TERM + fi [[ "$RUNNER_OS" == "Linux" ]] [[ -d "$TOOLCHAIN_DIRECTORY" && ! -L "$TOOLCHAIN_DIRECTORY" ]] [[ -z "$(find -P "$TOOLCHAIN_DIRECTORY" -type l -print -quit)" ]] @@ -69,12 +134,15 @@ runs: cd "$TOOLCHAIN_DIRECTORY" sha256sum --check --strict SHA256SUMS ) - jq -e --arg architecture "$EXPECTED_ARCHITECTURE" ' + jq -e \ + --arg architecture "$EXPECTED_ARCHITECTURE" \ + --arg podmanSourceSha "$EXPECTED_PODMAN_SOURCE_SHA" \ + --arg podmanVersion "$EXPECTED_PODMAN_VERSION" ' .schemaVersion == 1 and .kind == "nemoclaw-native-podman-toolchain-v1" and .architecture == $architecture and - .podmanVersion == "6.1.0" and - .podmanSourceSha == "cade97a52ebdf9dbf9e81de8009015776837a074" and + .podmanVersion == $podmanVersion and + .podmanSourceSha == $podmanSourceSha and .netavarkVersion == "2.1.0" and .netavarkSourceSha == "8e91ad1d947ed325327b638f0cb906bea1f7d0ab" and .aardvarkDnsVersion == "2.1.0" and @@ -223,7 +291,7 @@ runs: "$TOOLCHAIN_DIRECTORY/libexec/podman/$helper" \ "$helper_install_root/$helper" done - [[ "$("$podman_executable" --version)" == "podman version 6.1.0" ]] + [[ "$("$podman_executable" --version)" == "podman version $EXPECTED_PODMAN_VERSION" ]] [[ -z "$subuid_range" ]] || sudo usermod --add-subuids "$subuid_range" "$execution_user" [[ -z "$subgid_range" ]] || sudo usermod --add-subgids "$subgid_range" "$execution_user" @@ -421,9 +489,11 @@ runs: printf 'PATH=%s:%s\n' "$toolchain_install_root/bin" "$PATH" printf 'XDG_RUNTIME_DIR=%s\n' "$runtime_directory" } >>"$GITHUB_ENV" + setup_completed=true + trap - EXIT INT TERM - name: Remove Docker CLI from native Podman execution - if: ${{ inputs.enabled == 'true' }} + if: ${{ inputs.enabled == 'true' && inputs.isolate-docker-cli == 'true' }} shell: bash run: | set -euo pipefail diff --git a/.github/workflows/e2e-standard-profile.yaml b/.github/workflows/e2e-standard-profile.yaml index 73e5f2033d9..a5623fc4d19 100644 --- a/.github/workflows/e2e-standard-profile.yaml +++ b/.github/workflows/e2e-standard-profile.yaml @@ -435,7 +435,7 @@ jobs: provenance-json: ${{ inputs.cli_artifact_provenance }} - name: Prepare native Podman E2E runtime - uses: NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8 + uses: NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@22789bcaf835db7cf6390781c8d0f454f1e73dec with: enabled: ${{ inputs.runtime_provider == 'podman' && 'true' || 'false' }} @@ -650,7 +650,7 @@ jobs: - name: Restore Docker CLI after native Podman E2E if: ${{ always() && inputs.runtime_provider == 'podman' }} - uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8 + uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@9650336899bf836db5844381a97cbc2b0fe4a2b8 with: enabled: "true" diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 038b03de2ce..f58ac779d6c 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -659,7 +659,7 @@ jobs: name: Generate E2E target matrix env: INFERENCE_MODE: ${{ inputs.inference_mode || 'mock' }} - NEMOCLAW_GATEWAY_RUNTIMES: ${{ inputs.gateway_runtimes || inputs.gateway_runtime || 'docker' }} + NEMOCLAW_GATEWAY_RUNTIMES: ${{ inputs.jobs == 'portable-hermes-finalization' && 'podman' || inputs.gateway_runtimes || inputs.gateway_runtime || 'docker' }} JOBS: ${{ inputs.jobs }} TARGETS: ${{ inputs.targets }} EVENT_NAME: ${{ github.event_name }} @@ -701,7 +701,7 @@ jobs: - name: Stage immutable native Podman E2E toolchains uses: NVIDIA/NemoClaw/.github/actions/stage-native-podman-e2e-toolchains@8d7409d66a0e664829f9ddab177aa8460974291f with: - enabled: ${{ contains(format(',{0},', inputs.gateway_runtimes || inputs.gateway_runtime || 'docker'), ',podman,') && 'true' || 'false' }} + enabled: ${{ (contains(format(',{0},', inputs.gateway_runtimes || inputs.gateway_runtime || 'docker'), ',podman,') || contains(fromJSON(steps.matrix.outputs.selected_jobs), 'portable-hermes-finalization')) && 'true' || 'false' }} github-token: ${{ github.token }} - name: Check out E2E candidate @@ -1222,6 +1222,163 @@ jobs: name: native-runtime-podman-toolchain-${{ matrix.architecture }} path: ${{ runner.temp }}/native-runtime-podman-toolchain/ + portable-podman-toolchain: + name: Build pinned Portable Podman 5.7 toolchain + needs: generate-matrix + if: ${{ contains(fromJSON(needs.generate-matrix.outputs.selected_jobs), 'portable-hermes-finalization') }} + runs-on: ubuntu-24.04 + timeout-minutes: 30 + permissions: + contents: read + steps: + - name: Check out the pinned Podman 5.7 source + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: podman-container-tools/podman + ref: 0370128fc8dcae93533334324ef838db8f8da8cb # v5.7.0 + path: .podman-source + fetch-depth: 1 + persist-credentials: false + + - name: Set up pinned Go for the Podman 5.7 build + uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 + with: + go-version: 1.25.9 + cache: false + + - name: Install pinned Podman build dependencies from the signed Ubuntu snapshot + env: + UBUNTU_SNAPSHOT_ID: 20260911T000000Z + shell: bash + run: | + set -euo pipefail + packages=( + "gcc=4:13.2.0-7ubuntu1" + "git=1:2.43.0-1ubuntu7.3" + "libapparmor-dev=4.0.1really4.0.1-0ubuntu0.24.04.7" + "libbtrfs-dev=6.6.3-1.1build2" + "libc6-dev=2.39-0ubuntu8.9" + "libdevmapper-dev=2:1.02.185-3ubuntu3.2" + "libglib2.0-dev=2.80.0-6ubuntu3.8" + "libprotobuf-c-dev=1.4.1-1ubuntu4" + "libprotobuf-dev=3.21.12-8.2ubuntu0.3" + "libseccomp-dev=2.5.5-1ubuntu3.1" + "libselinux1-dev=3.5-2ubuntu2.1" + "libsqlite3-dev=3.45.1-1ubuntu2.7" + "libsystemd-dev=255.4-1ubuntu8.17" + "make=4.3-4.1build2" + "pkg-config=1.8.1-2build1" + "protobuf-compiler=3.21.12-8.2ubuntu0.3" + ) + apt_sources=( + -o 'Dir::Etc::sourcelist=sources.list.d/ubuntu.sources' + -o 'Dir::Etc::sourceparts=-' + -o 'APT::Get::AllowUnauthenticated=false' + -o 'Acquire::AllowInsecureRepositories=false' + ) + sudo env DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get \ + "${apt_sources[@]}" update --snapshot "$UBUNTU_SNAPSHOT_ID" + sudo env DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get \ + "${apt_sources[@]}" install --yes --no-install-recommends \ + --snapshot "$UBUNTU_SNAPSHOT_ID" "${packages[@]}" + for package_spec in "${packages[@]}"; do + package_name="${package_spec%%=*}" + expected_version="${package_spec#*=}" + actual_version="$(dpkg-query --show --showformat='${Version}' "$package_name")" + [[ "$actual_version" == "$expected_version" ]] + done + + - name: Download the reviewed native helper toolchain + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: native-podman-e2e-toolchain-amd64 + path: ${{ runner.temp }}/portable-podman-e2e-toolchain + + - name: Replace only Podman with the pinned portable runtime + env: + PODMAN_SOURCE_SHA: 0370128fc8dcae93533334324ef838db8f8da8cb + TOOLCHAIN_DIRECTORY: ${{ runner.temp }}/portable-podman-e2e-toolchain + shell: bash + run: | + set -euo pipefail + [[ "$(dpkg --print-architecture)" == amd64 ]] + [[ "$(git -C .podman-source rev-parse --verify 'HEAD^{commit}')" == "$PODMAN_SOURCE_SHA" ]] + [[ -d "$TOOLCHAIN_DIRECTORY" && ! -L "$TOOLCHAIN_DIRECTORY" ]] + [[ -z "$(find -P "$TOOLCHAIN_DIRECTORY" -type l -print -quit)" ]] + ( + cd "$TOOLCHAIN_DIRECTORY" + sha256sum --check --strict SHA256SUMS + ) + jq -e ' + .schemaVersion == 1 and + .kind == "nemoclaw-native-podman-toolchain-v1" and + .architecture == "amd64" and + .podmanVersion == "6.1.0" and + .podmanSourceSha == "cade97a52ebdf9dbf9e81de8009015776837a074" and + .netavarkVersion == "2.1.0" and + .netavarkSourceSha == "8e91ad1d947ed325327b638f0cb906bea1f7d0ab" and + .aardvarkDnsVersion == "2.1.0" and + .aardvarkDnsSourceSha == "cd7417681229219059939bdd9f0b3bd9ac9abb08" and + .pastaVersion == "2026_07_28.f8df3f1" and + .pastaSourceArchiveSha256 == "54fc6a3b39b0fcb13182078662886a629032852e186e47a371fd9d7fd20d3958" and + .pastaSourceSha == "f8df3f1b228fe19a74a269334fdfe6cc7d0605ce" and + .goVersion == "1.25.9" and + .rustVersion == "1.88.0" + ' "$TOOLCHAIN_DIRECTORY/manifest.json" >/dev/null + [[ -z "$(git -C .podman-source status --porcelain --untracked-files=no)" ]] + [[ "$(go version)" == go\ version\ go1.25.9\ * ]] + + SOURCE_DATE_EPOCH=1762886964 \ + BUILD_ORIGIN="NVIDIA/NemoClaw Portable Podman qualification" \ + EXTRA_BUILDTAGS=containers_image_openpgp \ + make --directory=.podman-source --jobs=2 \ + podman rootlessport PREFIX=/usr/local + + podman_dependencies="$(ldd .podman-source/bin/podman)" + printf '%s\n' "$podman_dependencies" + if grep -F "not found" <<<"$podman_dependencies"; then + echo "::error::Pinned Portable Podman build has an unresolved runtime dependency" >&2 + exit 1 + fi + if grep -E "libgpgme|libsubid" <<<"$podman_dependencies"; then + echo "::error::Pinned Portable Podman build must not require an optional host ABI" >&2 + exit 1 + fi + + install -m 0755 .podman-source/bin/podman "$TOOLCHAIN_DIRECTORY/bin/podman" + install -m 0755 .podman-source/bin/rootlessport \ + "$TOOLCHAIN_DIRECTORY/libexec/podman/rootlessport" + install -m 0644 \ + .podman-source/vendor/go.podman.io/common/pkg/config/containers.conf \ + "$TOOLCHAIN_DIRECTORY/share/containers/containers.conf" + [[ "$("$TOOLCHAIN_DIRECTORY/bin/podman" --version)" == "podman version 5.7.0" ]] + jq \ + --arg podmanSourceSha "$PODMAN_SOURCE_SHA" \ + '.podmanVersion = "5.7.0" | .podmanSourceSha = $podmanSourceSha' \ + "$TOOLCHAIN_DIRECTORY/manifest.json" \ + >"$TOOLCHAIN_DIRECTORY/manifest.next.json" + mv "$TOOLCHAIN_DIRECTORY/manifest.next.json" "$TOOLCHAIN_DIRECTORY/manifest.json" + ( + cd "$TOOLCHAIN_DIRECTORY" + sha256sum \ + bin/pasta \ + bin/podman \ + libexec/podman/aardvark-dns \ + libexec/podman/netavark \ + libexec/podman/rootlessport \ + manifest.json \ + share/containers/containers.conf >SHA256SUMS + ) + + - name: Upload the pinned Portable Podman toolchain + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: portable-podman-e2e-toolchain-amd64 + path: ${{ runner.temp }}/portable-podman-e2e-toolchain/ + if-no-files-found: error + retention-days: 3 + compression-level: 0 + native-runtime-qualification-producer: name: ${{ matrix.jobName }} needs: @@ -2847,7 +3004,7 @@ jobs: provenance-json: ${{ needs.generate-matrix.outputs.cli_artifact_provenance }} - name: Prepare native Podman E2E runtime - uses: NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8 + uses: NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@22789bcaf835db7cf6390781c8d0f454f1e73dec with: enabled: ${{ matrix.runtime_provider == 'podman' && 'true' || 'false' }} @@ -3004,7 +3161,7 @@ jobs: - name: Restore Docker CLI after native Podman E2E if: ${{ always() && matrix.runtime_provider == 'podman' }} - uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8 + uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@9650336899bf836db5844381a97cbc2b0fe4a2b8 with: enabled: "true" @@ -3055,7 +3212,7 @@ jobs: provenance-json: ${{ needs.generate-matrix.outputs.cli_artifact_provenance }} - name: Prepare native Podman E2E runtime - uses: NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8 + uses: NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@22789bcaf835db7cf6390781c8d0f454f1e73dec with: enabled: ${{ matrix.runtime_provider == 'podman' && 'true' || 'false' }} @@ -3078,7 +3235,7 @@ jobs: - name: Restore Docker CLI after native Podman E2E if: ${{ always() && matrix.runtime_provider == 'podman' }} - uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8 + uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@9650336899bf836db5844381a97cbc2b0fe4a2b8 with: enabled: "true" @@ -3688,7 +3845,7 @@ jobs: run: npx tsx tools/e2e/runner-comparison.mts initialize - name: Prepare native Podman E2E runtime - uses: NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8 + uses: NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@22789bcaf835db7cf6390781c8d0f454f1e73dec with: enabled: ${{ matrix.runtime_provider == 'podman' && 'true' || 'false' }} @@ -3776,7 +3933,7 @@ jobs: - name: Restore Docker CLI after native Podman E2E if: ${{ always() && matrix.runtime_provider == 'podman' }} - uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8 + uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@9650336899bf836db5844381a97cbc2b0fe4a2b8 with: enabled: "true" @@ -3839,7 +3996,7 @@ jobs: provenance-json: ${{ needs.generate-matrix.outputs.cli_artifact_provenance }} - name: Prepare native Podman E2E runtime - uses: NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8 + uses: NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@22789bcaf835db7cf6390781c8d0f454f1e73dec with: enabled: ${{ matrix.runtime_provider == 'podman' && 'true' || 'false' }} @@ -3919,7 +4076,7 @@ jobs: - name: Restore Docker CLI after native Podman E2E if: ${{ always() && matrix.runtime_provider == 'podman' }} - uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8 + uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@9650336899bf836db5844381a97cbc2b0fe4a2b8 with: enabled: "true" @@ -4122,7 +4279,7 @@ jobs: provenance-json: ${{ needs.generate-matrix.outputs.cli_artifact_provenance }} - name: Prepare native Podman E2E runtime - uses: NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8 + uses: NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@22789bcaf835db7cf6390781c8d0f454f1e73dec with: enabled: ${{ matrix.runtime_provider == 'podman' && 'true' || 'false' }} @@ -4190,7 +4347,7 @@ jobs: - name: Restore Docker CLI after native Podman E2E if: ${{ always() && matrix.runtime_provider == 'podman' }} - uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8 + uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@9650336899bf836db5844381a97cbc2b0fe4a2b8 with: enabled: "true" @@ -5136,7 +5293,7 @@ jobs: run: npx tsx tools/e2e/runner-comparison.mts initialize - name: Prepare native Podman E2E runtime - uses: NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8 + uses: NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@22789bcaf835db7cf6390781c8d0f454f1e73dec with: enabled: ${{ matrix.runtime_provider == 'podman' && 'true' || 'false' }} @@ -5162,10 +5319,193 @@ jobs: - name: Restore Docker CLI after native Podman E2E if: ${{ always() && matrix.runtime_provider == 'podman' }} - uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8 + uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@9650336899bf836db5844381a97cbc2b0fe4a2b8 + with: + enabled: "true" + + - name: Clean up Docker auth + if: always() + shell: bash + run: bash .github/scripts/docker-auth-cleanup.sh + + portable-hermes-finalization: + name: Portable Hermes finalization (Podman 5.7, NVIDIA GPU) + needs: [generate-matrix, portable-podman-toolchain] + if: ${{ contains(fromJSON(needs.generate-matrix.outputs.selected_jobs), 'portable-hermes-finalization') }} + runs-on: linux-amd64-gpu-rtxpro6000-latest-1 + timeout-minutes: 90 + permissions: + contents: read + env: + E2E_JOB: "1" + E2E_DEFAULT_ENABLED: "0" + E2E_GATEWAY_RUNTIMES: podman + E2E_TARGET_ID: portable-hermes-finalization + E2E_AGENT_RUNTIME: hermes + E2E_OBSERVABLE_OUTCOME: "Portable Hermes lifecycle completes on the supported NVIDIA GPU and Podman 5.7 boundary" + E2E_ENVIRONMENT_OR_INFERENCE_ENDPOINT: "x86-64 NVIDIA GPU runner; rootless Podman 5.7; local Ollama" + E2E_ARTIFACT_DIR: ${{ github.workspace }}/e2e-artifacts/live/portable-hermes-finalization + E2E_SOURCE_REVISION: ${{ inputs.checkout_sha || github.sha }} + NEMOCLAW_CLI_BIN: ${{ github.workspace }}/bin/nemoclaw.js + NEMOCLAW_RUN_LIVE_E2E: "1" + NEMOCLAW_GATEWAY_RUNTIME: podman + NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1" + NEMOCLAW_NON_INTERACTIVE: "1" + steps: + - name: Install Portable Podman host dependencies + uses: NVIDIA/NemoClaw/.github/actions/host-dependency-setup@d511d704980d651909b52b18ee42fad41a017b7d + with: + packages: conmon fuse-overlayfs golang-github-containers-common iptables nftables slirp4netns uidmap + + - name: Check out trusted workflow cleanup authority + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ github.workflow_sha }} + fetch-depth: 1 + persist-credentials: false + + - name: Install immutable native Podman cleanup fixture + env: + CLEANUP_FIXTURE: /usr/local/libexec/nemoclaw/native-podman-e2e-restore.${{ github.run_id }}.${{ github.run_attempt }} + TRUSTED_FIXTURE_SHA256: f9b26c07e5b84660a0f2710307cefc9c0c811d3d88628bb0a9500e031ec02ba8 + shell: /bin/bash --noprofile --norc -e -o pipefail {0} + run: | + set -euo pipefail + source_action=.github/actions/restore-native-podman-e2e/action.yaml + extracted_fixture="$(mktemp)" + cleanup_extracted_fixture() { + rm -f -- "$extracted_fixture" + } + trap cleanup_extracted_fixture EXIT + awk ' + found { sub(/^ /, ""); print } + /^ run: \|$/ { found = 1; next } + ' "$source_action" >"$extracted_fixture" + printf '%s %s\n' "$TRUSTED_FIXTURE_SHA256" "$extracted_fixture" | sha256sum --check --strict + sudo install -d --owner=root --group=root --mode=0755 /usr/local/libexec/nemoclaw + sudo install --owner=root --group=root --mode=0555 "$extracted_fixture" "$CLEANUP_FIXTURE" + [[ "$(sudo stat -c '%u:%g:%a' "$CLEANUP_FIXTURE")" == "0:0:555" ]] + sudo cmp -s "$extracted_fixture" "$CLEANUP_FIXTURE" + + - name: Check out the exact candidate + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: ${{ inputs.checkout_repository || github.repository }} + ref: ${{ inputs.checkout_sha || github.sha }} + fetch-depth: 0 + persist-credentials: false + + - *dockerhub-auth + + - name: Prepare E2E workspace + uses: NVIDIA/NemoClaw/.github/actions/prepare-e2e@afffe9cdedd168bfd7116c53846ddffe32eadd4c + with: + build-cli: "false" + + - name: Restore exact-commit CLI artifact + uses: NVIDIA/NemoClaw/.github/actions/restore-e2e-cli-artifact@4e9f579183477b984c009cce0f47a1361e5eddef + with: + provenance-json: ${{ needs.generate-matrix.outputs.cli_artifact_provenance }} + + - name: Compile Portable Hermes authorities + run: | + set -euo pipefail + npm run catalog:compile + npm run build:policy-boundary + + - name: Install pinned OpenShell + run: | + set -euo pipefail + env -u GH_TOKEN -u GITHUB_TOKEN NEMOCLAW_NON_INTERACTIVE=1 bash scripts/install-openshell.sh + for component in openshell openshell-gateway openshell-sandbox; do + resolved="$(command -v "$component")" + sudo install -o root -g root -m 0755 "$resolved" "/usr/bin/$component" + done + echo /usr/bin >>"$GITHUB_PATH" + + - name: Recover stale Docker isolation before Portable Podman E2E + uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@9650336899bf836db5844381a97cbc2b0fe4a2b8 + with: + enabled: "true" + + - name: Prepare Portable Podman 5.7 runtime + uses: NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@22789bcaf835db7cf6390781c8d0f454f1e73dec + with: + cleanup-fixture: /usr/local/libexec/nemoclaw/native-podman-e2e-restore.${{ github.run_id }}.${{ github.run_attempt }} + enabled: "true" + toolchain: portable-5.7 + isolate-docker-cli: "false" + + - name: Run Portable Hermes finalization live Vitest test + shell: /bin/bash --noprofile --norc -e -o pipefail {0} + env: + CLEANUP_FIXTURE: /usr/local/libexec/nemoclaw/native-podman-e2e-restore.${{ github.run_id }}.${{ github.run_attempt }} + E2E_HERMES_BASE_STORAGE_HOME: ${{ runner.temp }}/nemoclaw-hermes-base-storage + NEMOCLAW_HERMES_E2E_BASE_IMAGE: localhost/nemoclaw-hermes-base:portable-e2e + XDG_DATA_HOME: ${{ runner.temp }}/nemoclaw-hermes-base-storage + run: | + set -euo pipefail + restore_runner() { + local command_status=$? + local cleanup_status=0 + trap - EXIT INT TERM + set +e + /usr/bin/env -i \ + HOME="$HOME" \ + PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ + RUNNER_TEMP="$RUNNER_TEMP" \ + /bin/bash "$CLEANUP_FIXTURE" + cleanup_status=$? + set -e + if [[ "$cleanup_status" -ne 0 ]]; then + echo "::error::Portable Podman cleanup failed after restoring Docker" >&2 + exit "$cleanup_status" + fi + exit "$command_status" + } + [[ "$(sudo stat -c '%u:%g:%a' "$CLEANUP_FIXTURE")" == "0:0:555" ]] + trap restore_runner EXIT + trap 'exit 130' INT + trap 'exit 143' TERM + + [[ "$(uname -m)" == x86_64 ]] + gpu_name="$(nvidia-smi --query-gpu=name --format=csv,noheader | sed -n '1p')" + [[ -n "$gpu_name" ]] + mkdir -p "$E2E_ARTIFACT_DIR" + jq -n \ + --arg architecture x86_64 \ + --arg gpuName "$gpu_name" \ + --arg podmanVersion "$(podman --version)" \ + '{schemaVersion: 1, architecture: $architecture, gpuName: $gpuName, podmanVersion: $podmanVersion}' \ + >"$E2E_ARTIFACT_DIR/host-authority.json" + + podman build \ + --file agents/hermes/Dockerfile.base \ + --tag localhost/nemoclaw-hermes-base:portable-e2e \ + . + npx tsx tools/e2e/live-vitest-invocation.mts run \ + --test-path test/e2e/live/portable-profile-rootless-linux.test.ts + + - name: Upload Portable Hermes finalization artifacts + if: always() + uses: NVIDIA/NemoClaw/.github/actions/upload-e2e-artifacts@7768e15eb90d3ee2d33432f481dfe8747e4f6d57 + with: + name: e2e-portable-hermes-finalization + path: e2e-artifacts/live/portable-hermes-finalization/ + + - name: Restore Docker and retire Portable Podman runtime + if: always() + uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@9650336899bf836db5844381a97cbc2b0fe4a2b8 with: enabled: "true" + - name: Remove immutable native Podman cleanup fixture + if: always() + env: + CLEANUP_FIXTURE: /usr/local/libexec/nemoclaw/native-podman-e2e-restore.${{ github.run_id }}.${{ github.run_attempt }} + shell: bash + run: sudo rm -f -- "$CLEANUP_FIXTURE" + - name: Clean up Docker auth if: always() shell: bash @@ -5323,12 +5663,12 @@ jobs: - name: Recover Docker CLI before native Podman E2E if: ${{ matrix.runtime_provider == 'podman' }} - uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8 + uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@9650336899bf836db5844381a97cbc2b0fe4a2b8 with: enabled: "true" - name: Prepare native Podman E2E runtime - uses: NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8 + uses: NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@22789bcaf835db7cf6390781c8d0f454f1e73dec with: enabled: ${{ matrix.runtime_provider == 'podman' && 'true' || 'false' }} @@ -5472,7 +5812,7 @@ jobs: - name: Restore Docker CLI after native Podman E2E if: ${{ always() && matrix.runtime_provider == 'podman' }} - uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8 + uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@9650336899bf836db5844381a97cbc2b0fe4a2b8 with: enabled: "true" @@ -5597,7 +5937,7 @@ jobs: provenance-json: ${{ needs.generate-matrix.outputs.cli_artifact_provenance }} - name: Prepare native Podman E2E runtime - uses: NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8 + uses: NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@22789bcaf835db7cf6390781c8d0f454f1e73dec with: enabled: ${{ matrix.runtime_provider == 'podman' && 'true' || 'false' }} @@ -5681,7 +6021,7 @@ jobs: - name: Restore Docker CLI after native Podman public install if: ${{ always() && matrix.runtime_provider == 'podman' }} - uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8 + uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@9650336899bf836db5844381a97cbc2b0fe4a2b8 with: enabled: "true" @@ -5740,7 +6080,7 @@ jobs: provenance-json: ${{ needs.generate-matrix.outputs.cli_artifact_provenance }} - name: Prepare native Podman E2E runtime - uses: NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8 + uses: NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@22789bcaf835db7cf6390781c8d0f454f1e73dec with: enabled: ${{ matrix.runtime_provider == 'podman' && 'true' || 'false' }} @@ -5773,7 +6113,7 @@ jobs: - name: Restore Docker CLI after native Podman E2E if: ${{ always() && matrix.runtime_provider == 'podman' }} - uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8 + uses: NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@9650336899bf836db5844381a97cbc2b0fe4a2b8 with: enabled: "true" @@ -5810,6 +6150,7 @@ jobs: managed-image-protected-runtime, hermes-e2e, hermes-gpu-startup, + portable-hermes-finalization, messaging-providers, jetson-nvmap-gpu, cloud-onboard, diff --git a/ci/source-shape-test-budget.json b/ci/source-shape-test-budget.json index e8fab9aa30f..14526b20df7 100644 --- a/ci/source-shape-test-budget.json +++ b/ci/source-shape-test-budget.json @@ -111,6 +111,16 @@ "test": "%s rejects duplicate Hermes resolver steps", "category": "security" }, + { + "file": "test/e2e/support/native-podman-setup-action.test.ts", + "test": "builds the Portable Podman toolchain outside candidate execution", + "category": "security" + }, + { + "file": "test/e2e/support/native-podman-setup-action.test.ts", + "test": "runs Portable Hermes only on the explicit Podman 5.7 GPU lane", + "category": "security" + }, { "file": "test/e2e/support/portable-profile-rootless-runtime-workflow.test.ts", "test": "routes rootless job dependency auditing by workflow trigger (#11028)", @@ -171,6 +181,11 @@ "test": "skips Hermes qualification for unrelated documentation", "category": "security" }, + { + "file": "test/e2e/support/shared-e2e-workflow-boundary.test.ts", + "test": "requires Portable Hermes selection to stage its native helper artifact", + "category": "security" + }, { "file": "test/platform/images/node-tar-dockerfile-contract.test.ts", "test": "rejects an isolated unreviewed Deep Agents Code Node base pin", diff --git a/test/e2e/README.md b/test/e2e/README.md index 5524f9b2916..e5648ba0920 100644 --- a/test/e2e/README.md +++ b/test/e2e/README.md @@ -43,6 +43,13 @@ The install refuses package removals, preserving the runner's Docker and contain Its independent macOS live job and WSL shard 1 run live E2E only when the workflow tests `main` and Docker is available. This workflow does not publish or satisfy `Release qualification`. - `.github/workflows/portable-profile-e2e.yaml` publishes experimental portable-profile evidence. +- The explicit-only `portable-hermes-finalization` job in `.github/workflows/e2e.yaml` + runs the portable-profile scenario on the reviewed x86-64 NVIDIA GPU runner with + rootless Podman 5.7. It builds Podman and rootlessport from the pinned v5.7.0 + source commit. It reuses the reviewed native pasta, netavark, and aardvark-dns + components. Select it with + `jobs=portable-hermes-finalization`; the job selects Podman 5.7 regardless of + gateway-runtime inputs. - `.github/workflows/podman-cpu-proof.yaml` publishes PR-only experimental runtime evidence. - `.github/workflows/sandbox-images.yaml` provides reusable sandbox-image build and test evidence. `.github/workflows/e2e.yaml` selects free-standing jobs, including `whatsapp-qr-compact` and `ollama-auth-proxy`. @@ -1927,6 +1934,11 @@ To select native runtime qualification evidence production, set `jobs=native-run Leave `targets` empty and keep `include_staging_brev_launchable=false`. For this producer run, the executing workflow SHA, `workflow_sha` input, and PR base SHA must match. Confirm that the PR comes from `NVIDIA/NemoClaw`, the required ephemeral runner variables are configured, and the workflow has not been rerun. +To run Portable Hermes finalization evidence, set +`jobs=portable-hermes-finalization` and leave `targets` empty. This explicit lane +selects Podman 5.7 itself, uses the exact candidate checkout, and obtains its +runtime binary and helper artifact through trusted workflow jobs before +candidate execution. A trusted `main` workflow step validates the open PR before candidate checkout. It requires `NVIDIA/NemoClaw` as the source repository before authorizing the full ordinary plan and credential profiles. A second validation after checkout rejects a changed selected commit, base commit, repository, or diff --git a/test/e2e/docs/README.md b/test/e2e/docs/README.md index 00c28725a69..3c1d1cf1d4f 100644 --- a/test/e2e/docs/README.md +++ b/test/e2e/docs/README.md @@ -541,6 +541,9 @@ test/e2e/ GitHub invalidates `GITHUB_TOKEN` after the job. `NVIDIA_INFERENCE_API_KEY` remains valid until it expires or is revoked; the workflow does not revoke it. - `.github/workflows/portable-profile-e2e.yaml` provides experimental portable-profile evidence on matching `main` changes or manual dispatches. +- The explicit-only `portable-hermes-finalization` job in `.github/workflows/e2e.yaml` + runs the portable-profile scenario on the reviewed x86-64 NVIDIA GPU runner with + rootless Podman 5.7. The selector stages and uses that runtime directly. - `.github/workflows/podman-cpu-proof.yaml` provides PR-only experimental runtime evidence with Docker disabled. - `.github/workflows/sandbox-images.yaml` provides reusable image build and test evidence through manual dispatch and `workflow_call`. `.github/workflows/e2e.yaml` selects free-standing jobs, including `whatsapp-qr-compact` and `ollama-auth-proxy`. diff --git a/test/e2e/support/native-podman-setup-action.test.ts b/test/e2e/support/native-podman-setup-action.test.ts index 306a53e9335..26a9d40dcfd 100644 --- a/test/e2e/support/native-podman-setup-action.test.ts +++ b/test/e2e/support/native-podman-setup-action.test.ts @@ -25,6 +25,30 @@ const FIXED_RESTORE_ROOT = "/usr/lib/nemoclaw-native-podman-e2e/docker-cli-resto const COMMAND_OUTPUT_LIMIT = 64 * 1024; const OUTPUT_TRUNCATION_MARKER = "\n[output truncated]\n"; +type WorkflowStep = { + env?: Record; + if?: string; + name?: string; + uses?: string; + run?: string; + with?: Record; +}; + +type WorkflowJob = { + env?: Record; + if?: string; + needs?: string | string[]; + "runs-on"?: string; + steps?: WorkflowStep[]; +}; + +function e2eWorkflowJobs(): Record { + const workflow = YAML.parse(fs.readFileSync(".github/workflows/e2e.yaml", "utf8")) as { + jobs: Record; + }; + return workflow.jobs; +} + vi.setConfig({ maxConcurrency: 5 }); function shellQuote(value: string): string { @@ -42,6 +66,72 @@ function restoreRunScript(): string { ); } +function setupRunScript(): string { + const action = YAML.parse(fs.readFileSync(SETUP_ACTION, "utf8")) as { + runs: { steps: Array<{ name?: string; run?: string }> }; + }; + return String( + action.runs.steps.find(({ name }) => name === "Start native Podman runtime")?.run ?? "", + ); +} + +function interruptedSetupHarness(cleanupRoot: string): string { + const source = setupRunScript(); + const start = source.indexOf("setup_completed=false"); + const trapEndMarker = "trap 'exit 143' TERM"; + const trapEnd = source.indexOf("\nfi", source.indexOf(trapEndMarker, start)); + const trapBoundary = source + .slice(start, trapEnd + "\nfi".length) + .replace( + '[[ "$CLEANUP_FIXTURE" == /usr/local/libexec/nemoclaw/* ]]', + `[[ "$CLEANUP_FIXTURE" == ${shellQuote(cleanupRoot)}/* ]]`, + ); + return [ + "sudo() {", + ' if [[ "${1:-}" == "-n" ]]; then shift; fi', + ' if [[ "${1:-}" == "stat" ]]; then printf \'0:0:555\\n\'; return; fi', + ' "$@"', + "}", + trapBoundary, + 'exit "$SETUP_FAILURE_STATUS"', + ].join("\n"); +} + +async function runInterruptedSetupFixture(ownerContext: ProcessOwner, cleanupExitStatus: number) { + const root = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-podman-setup-trap-")); + const cleanupRoot = path.join(root, "cleanup"); + const runnerTemp = path.join(root, "runner-temp"); + const cleanupFixture = path.join(cleanupRoot, "restore"); + const cleanupCount = path.join(runnerTemp, "cleanup-count"); + const dockerState = path.join(runnerTemp, "docker-state"); + fs.mkdirSync(cleanupRoot, { recursive: true }); + fs.mkdirSync(runnerTemp, { recursive: true }); + fs.writeFileSync(dockerState, "isolated\n"); + writeExecutable( + cleanupFixture, + `#!/bin/bash +set -euo pipefail +count=0 +[[ ! -f "$RUNNER_TEMP/cleanup-count" ]] || count="$(cat "$RUNNER_TEMP/cleanup-count")" +printf '%s\n' "$((count + 1))" >"$RUNNER_TEMP/cleanup-count" +printf 'restored\n' >"$RUNNER_TEMP/docker-state" +exit ${String(cleanupExitStatus)} +`, + ); + const result = await runCommand( + ownerContext, + "bash", + ["--noprofile", "--norc", "-c", interruptedSetupHarness(cleanupRoot)], + { + ...process.env, + CLEANUP_FIXTURE: cleanupFixture, + RUNNER_TEMP: runnerTemp, + SETUP_FAILURE_STATUS: "42", + }, + ); + return { cleanupCount, dockerState, result, root }; +} + type RestoreFixtureKind = "valid" | "regular-file" | "symlink"; type CommandResult = { @@ -479,6 +569,223 @@ esac } describe("native Podman E2E setup boundary", () => { + // source-shape-contract: security -- Candidate code may consume only a trusted-main-built Podman 5.7 artifact on the reviewed GPU lane + it("builds the Portable Podman toolchain outside candidate execution", () => { + const toolchain = e2eWorkflowJobs()["portable-podman-toolchain"]!; + const checkout = toolchain.steps?.find( + (step) => step.name === "Check out the pinned Podman 5.7 source", + ); + const dependencyInstall = toolchain.steps?.find( + (step) => + step.name === "Install pinned Podman build dependencies from the signed Ubuntu snapshot", + ); + const replace = toolchain.steps?.find( + (step) => step.name === "Replace only Podman with the pinned portable runtime", + ); + const upload = toolchain.steps?.find( + (step) => step.name === "Upload the pinned Portable Podman toolchain", + ); + + expect(toolchain.needs).toBe("generate-matrix"); + expect(toolchain.if).toBe( + "${{ contains(fromJSON(needs.generate-matrix.outputs.selected_jobs), 'portable-hermes-finalization') }}", + ); + expect(toolchain["runs-on"]).toBe("ubuntu-24.04"); + expect(checkout?.with).toMatchObject({ + repository: "podman-container-tools/podman", + ref: "0370128fc8dcae93533334324ef838db8f8da8cb", + path: ".podman-source", + "fetch-depth": 1, + "persist-credentials": false, + }); + expect(dependencyInstall?.env).toEqual({ + UBUNTU_SNAPSHOT_ID: "20260911T000000Z", + }); + expect(dependencyInstall?.run).toContain("Dir::Etc::sourcelist=sources.list.d/ubuntu.sources"); + expect(dependencyInstall?.run).toContain("Dir::Etc::sourceparts=-"); + expect(dependencyInstall?.run).toContain("APT::Get::AllowUnauthenticated=false"); + expect(dependencyInstall?.run).toContain("Acquire::AllowInsecureRepositories=false"); + expect(dependencyInstall?.run).toContain('--snapshot "$UBUNTU_SNAPSHOT_ID"'); + expect(dependencyInstall?.run).toContain( + [ + ' "gcc=4:13.2.0-7ubuntu1"', + ' "git=1:2.43.0-1ubuntu7.3"', + ' "libapparmor-dev=4.0.1really4.0.1-0ubuntu0.24.04.7"', + ' "libbtrfs-dev=6.6.3-1.1build2"', + ' "libc6-dev=2.39-0ubuntu8.9"', + ' "libdevmapper-dev=2:1.02.185-3ubuntu3.2"', + ' "libglib2.0-dev=2.80.0-6ubuntu3.8"', + ' "libprotobuf-c-dev=1.4.1-1ubuntu4"', + ' "libprotobuf-dev=3.21.12-8.2ubuntu0.3"', + ' "libseccomp-dev=2.5.5-1ubuntu3.1"', + ' "libselinux1-dev=3.5-2ubuntu2.1"', + ' "libsqlite3-dev=3.45.1-1ubuntu2.7"', + ' "libsystemd-dev=255.4-1ubuntu8.17"', + ' "make=4.3-4.1build2"', + ' "pkg-config=1.8.1-2build1"', + ' "protobuf-compiler=3.21.12-8.2ubuntu0.3"', + ].join("\n"), + ); + expect(dependencyInstall?.run).toContain("dpkg-query --show --showformat='${Version}'"); + expect(dependencyInstall?.run).toContain('[[ "$actual_version" == "$expected_version" ]]'); + expect(replace?.run).toContain("sha256sum --check --strict SHA256SUMS"); + expect(replace?.run).toContain('"podman version 5.7.0"'); + expect(replace?.run).toContain('.podmanVersion = "5.7.0"'); + expect(upload?.with).toEqual({ + name: "portable-podman-e2e-toolchain-amd64", + path: "${{ runner.temp }}/portable-podman-e2e-toolchain/", + "if-no-files-found": "error", + "retention-days": 3, + "compression-level": 0, + }); + }); + + // source-shape-contract: security -- The explicit selector must retain the reviewed GPU, runtime, candidate, and cleanup boundaries + it("runs Portable Hermes only on the explicit Podman 5.7 GPU lane", () => { + const setupAction = YAML.parse(fs.readFileSync(SETUP_ACTION, "utf8")) as { + inputs: Record; + runs: { steps: WorkflowStep[] }; + }; + const setupRuntime = setupAction.runs.steps.find( + (step) => step.name === "Start native Podman runtime", + ); + const dockerCliIsolation = setupAction.runs.steps.find( + (step) => step.name === "Remove Docker CLI from native Podman execution", + ); + const liveSource = fs.readFileSync( + "test/e2e/live/portable-profile-rootless-linux.test.ts", + "utf8", + ); + const job = e2eWorkflowJobs()["portable-hermes-finalization"]!; + const trustedCheckout = job.steps?.find( + (step) => step.name === "Check out trusted workflow cleanup authority", + ); + const fixtureInstall = job.steps?.find( + (step) => step.name === "Install immutable native Podman cleanup fixture", + ); + const candidateCheckout = job.steps?.find( + (step) => step.name === "Check out the exact candidate", + ); + const setup = job.steps?.find((step) => step.name === "Prepare Portable Podman 5.7 runtime"); + const live = job.steps?.find( + (step) => step.name === "Run Portable Hermes finalization live Vitest test", + ); + const fixtureRemoval = job.steps?.find( + (step) => step.name === "Remove immutable native Podman cleanup fixture", + ); + const trustedCheckoutIndex = job.steps?.indexOf(trustedCheckout!) ?? -1; + const candidateCheckoutIndex = job.steps?.indexOf(candidateCheckout!) ?? -1; + const setupIndex = job.steps?.indexOf(setup!) ?? -1; + const uploadIndex = + job.steps?.findIndex( + (step) => step.name === "Upload Portable Hermes finalization artifacts", + ) ?? -1; + const restoreIndex = + job.steps?.findIndex( + (step) => step.name === "Restore Docker and retire Portable Podman runtime", + ) ?? -1; + const fixtureRemovalIndex = job.steps?.indexOf(fixtureRemoval!) ?? -1; + + expect(job.needs).toEqual(["generate-matrix", "portable-podman-toolchain"]); + expect(job["runs-on"]).toBe("linux-amd64-gpu-rtxpro6000-latest-1"); + expect(job.env).toMatchObject({ + E2E_DEFAULT_ENABLED: "0", + E2E_GATEWAY_RUNTIMES: "podman", + E2E_TARGET_ID: "portable-hermes-finalization", + E2E_AGENT_RUNTIME: "hermes", + }); + expect(job.env).not.toHaveProperty("E2E_HERMES_BASE_STORAGE_HOME"); + expect(setupAction.inputs["cleanup-fixture"]?.default).toBe(""); + expect(setupAction.inputs["isolate-docker-cli"]?.default).toBe("true"); + expect(dockerCliIsolation?.if).toBe( + "${{ inputs.enabled == 'true' && inputs.isolate-docker-cli == 'true' }}", + ); + expect(setupRuntime?.env).toMatchObject({ + CLEANUP_FIXTURE: "${{ inputs.cleanup-fixture }}", + }); + expect(setupRuntime?.run).toContain("trap cleanup_interrupted_setup EXIT"); + expect(setupRuntime?.run).toContain("trap 'exit 130' INT"); + expect(setupRuntime?.run).toContain("trap 'exit 143' TERM"); + expect(setupRuntime?.run).toContain('== "0:0:555"'); + expect(setupRuntime?.run).toContain("setup_completed=true"); + expect(setupRuntime?.run).toContain("trap - EXIT INT TERM"); + expect(trustedCheckout?.with).toMatchObject({ + ref: "${{ github.workflow_sha }}", + "fetch-depth": 1, + "persist-credentials": false, + }); + expect(fixtureInstall?.env).toMatchObject({ + TRUSTED_FIXTURE_SHA256: "f9b26c07e5b84660a0f2710307cefc9c0c811d3d88628bb0a9500e031ec02ba8", + }); + expect(createHash("sha256").update(restoreRunScript()).digest("hex")).toBe( + "f9b26c07e5b84660a0f2710307cefc9c0c811d3d88628bb0a9500e031ec02ba8", + ); + expect(fixtureInstall?.run).toContain("sha256sum --check --strict"); + expect(fixtureInstall?.run).toContain("--owner=root --group=root --mode=0555"); + expect(setup?.with).toEqual({ + "cleanup-fixture": + "/usr/local/libexec/nemoclaw/native-podman-e2e-restore.${{ github.run_id }}.${{ github.run_attempt }}", + enabled: "true", + toolchain: "portable-5.7", + "isolate-docker-cli": "false", + }); + expect(setup?.uses).toBe( + "NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@22789bcaf835db7cf6390781c8d0f454f1e73dec", + ); + expect(live).toMatchObject({ + env: { + E2E_HERMES_BASE_STORAGE_HOME: "${{ runner.temp }}/nemoclaw-hermes-base-storage", + }, + }); + expect(live?.run).toContain("trap restore_runner EXIT"); + expect(live?.run).toContain("trap 'exit 130' INT"); + expect(live?.run).toContain("trap 'exit 143' TERM"); + expect(live?.run).toContain('[[ "$(uname -m)" == x86_64 ]]'); + expect(live?.run).toContain("nvidia-smi --query-gpu=name"); + expect(live?.run).toContain("podman build"); + expect( + liveSource.indexOf( + "assert.equal(process.env.DOCKER_HOST, `unix://${runtimeDir}/podman/podman.sock`)", + ), + ).toBeGreaterThanOrEqual(0); + expect(liveSource.indexOf('run("docker", ["version"])')).toBeGreaterThan( + liveSource.indexOf( + "assert.equal(process.env.DOCKER_HOST, `unix://${runtimeDir}/podman/podman.sock`)", + ), + ); + expect(live?.run).toMatch( + /live-vitest-invocation\.mts run \\\n\s+--test-path test\/e2e\/live\/portable-profile-rootless-linux\.test\.ts/u, + ); + expect(trustedCheckoutIndex).toBeGreaterThanOrEqual(0); + expect(candidateCheckoutIndex).toBeGreaterThan(trustedCheckoutIndex); + expect(setupIndex).toBeGreaterThanOrEqual(0); + expect(uploadIndex).toBeGreaterThan(setupIndex); + expect(restoreIndex).toBeGreaterThan(uploadIndex); + expect(fixtureRemovalIndex).toBeGreaterThan(restoreIndex); + expect(JSON.stringify(job)).not.toContain("NVIDIA_API_KEY"); + expect(JSON.stringify(job)).not.toContain("NVIDIA_INFERENCE_API_KEY"); + }); + + it.concurrent("runs interrupted setup cleanup once and preserves the authoritative failure status", async (context) => { + const restored = await runInterruptedSetupFixture(context, 0); + const restoreFailed = await runInterruptedSetupFixture(context, 73); + + try { + expect(restored.result.status, restored.result.stderr).toBe(42); + expect(fs.readFileSync(restored.cleanupCount, "utf8").trim()).toBe("1"); + expect(fs.readFileSync(restored.dockerState, "utf8").trim()).toBe("restored"); + expect(restoreFailed.result.status).toBe(73); + expect(restoreFailed.result.stderr).toContain( + "Native Podman setup failed and runner restoration also failed", + ); + expect(fs.readFileSync(restoreFailed.cleanupCount, "utf8").trim()).toBe("1"); + expect(fs.readFileSync(restoreFailed.dockerState, "utf8").trim()).toBe("restored"); + } finally { + fs.rmSync(restored.root, { force: true, recursive: true }); + fs.rmSync(restoreFailed.root, { force: true, recursive: true }); + } + }); + it("provides Podman authority without impersonating Docker", () => { expect(validateNativePodmanSetupAction()).toEqual([]); }); @@ -800,7 +1107,7 @@ describe("native Podman E2E setup boundary", () => { } }); - it.concurrent("preserves recovery authority when the native Podman service survives stop (#11014)", async (context) => { + it.concurrent("restores Docker and preserves Podman recovery authority when Podman cleanup fails (#11014)", async (context) => { const fixture = await runPodmanCleanupFixture(context, true, true); try { @@ -812,11 +1119,16 @@ describe("native Podman E2E setup boundary", () => { expect(fs.existsSync(path.join(fixture.toolchainRoot, "bin", "podman"))).toBe(true); expect(fs.existsSync(fixture.storageDirectory)).toBe(true); expect(fs.existsSync(fixture.serviceUnitDirectory)).toBe(true); - expect(fs.existsSync(fixture.destination)).toBe(false); - expect(fs.existsSync(fixture.restoreRoot)).toBe(true); - expect(fs.existsSync(path.join(fixture.restoreRoot, "docker"))).toBe(true); - expect(fs.existsSync(path.join(fixture.restoreRoot, "metadata"))).toBe(true); - expect(fs.existsSync(path.join(fixture.restoreRoot, "runtime.json"))).toBe(true); + expect(fs.existsSync(fixture.destination)).toBe(true); + expect(fs.existsSync(fixture.restoreRoot)).toBe(false); + expect(createHash("sha256").update(fs.readFileSync(fixture.destination)).digest("hex")).toBe( + fixture.expectedSha256, + ); + const systemctlLog = fs.readFileSync(fixture.systemctlLog, "utf8"); + expect(systemctlLog).toContain("unmask --runtime docker.service"); + expect(systemctlLog).toContain("unmask --runtime docker.socket"); + expect(systemctlLog).toContain("start docker.service"); + expect(systemctlLog).toContain("start docker.socket"); } finally { fs.rmSync(fixture.root, { force: true, recursive: true }); } diff --git a/test/e2e/support/shared-e2e-workflow-boundary.test.ts b/test/e2e/support/shared-e2e-workflow-boundary.test.ts index ecadc8173a4..48db2cbe447 100644 --- a/test/e2e/support/shared-e2e-workflow-boundary.test.ts +++ b/test/e2e/support/shared-e2e-workflow-boundary.test.ts @@ -306,6 +306,31 @@ describe("shared E2E workflow boundary", () => { expect(errors.some((error) => error.includes("native Podman staging"))).toBe(true); }); + // source-shape-contract: security -- Explicit Portable Hermes selection must stage the reviewed native helper artifact before candidate execution + it("requires Portable Hermes selection to stage its native helper artifact", () => { + const workflow = readWorkflow() as Workflow; + const generate = workflow.jobs["generate-matrix"].steps!.find( + (step) => step.name === "Generate E2E target matrix", + )!; + expect((workflow.env as Record).NEMOCLAW_GATEWAY_RUNTIMES).toBe( + "${{ inputs.gateway_runtimes || inputs.gateway_runtime || 'docker' }}", + ); + expect((generate.env as Record).NEMOCLAW_GATEWAY_RUNTIMES).toBe( + "${{ inputs.jobs == 'portable-hermes-finalization' && 'podman' || inputs.gateway_runtimes || inputs.gateway_runtime || 'docker' }}", + ); + + const errors = validateMutatedWorkflow((workflow) => { + const staging = workflow.jobs["generate-matrix"].steps!.find( + (step) => step.name === "Stage immutable native Podman E2E toolchains", + )!; + staging.with!.enabled = + "${{ contains(format(',{0},', inputs.gateway_runtimes || inputs.gateway_runtime || 'docker'), ',podman,') && 'true' || 'false' }}"; + }); + expect(errors).toContain( + "native Podman staging must preserve runtime selection, token, and fail-closed execution", + ); + }); + it.each(stagingReferenceVariants)("rejects renamed staging action alias %s", (uses) => { const errors = validateMutatedWorkflow((workflow) => { const steps = workflow.jobs["generate-matrix"].steps!; diff --git a/test/e2e/support/workflow-plan.test.ts b/test/e2e/support/workflow-plan.test.ts index 1ab61fec263..91263aed9d6 100644 --- a/test/e2e/support/workflow-plan.test.ts +++ b/test/e2e/support/workflow-plan.test.ts @@ -121,6 +121,7 @@ describe("E2E workflow plan", () => { "staging-brev-launchable-identity", "external-gateway-health", "mcp-bridge-dev", + "portable-hermes-finalization", ]); expect(releaseRequiredWorkflowJobs()).toContain("live"); expect(releaseRequiredWorkflowJobs()).toContain("staging-brev-launchable"); diff --git a/tools/e2e/operations-workflow-boundary.mts b/tools/e2e/operations-workflow-boundary.mts index beb479de27c..a19017ccf57 100644 --- a/tools/e2e/operations-workflow-boundary.mts +++ b/tools/e2e/operations-workflow-boundary.mts @@ -26,6 +26,7 @@ const DEFAULT_WORKFLOW_PATH = join(REPO_ROOT, ".github", "workflows", "e2e.yaml" const META_JOBS = new Set([ "package-openshell-sdk", "native-runtime-qualification-podman-toolchain", + "portable-podman-toolchain", "native-runtime-qualification-producer-plan", "release-qualification", "relevant-e2e", @@ -600,6 +601,12 @@ function validateManualPrDispatch(errors: string[], workflow: OperationsWorkflow step.name === "Checkout trusted Hermes GPU runtime fixture" && step.with?.repository === "NVIDIA/NemoClaw" && step.with?.ref === "${{ github.workflow_sha }}"; + const trustedPortablePodmanCleanupCheckout = + jobName === "portable-hermes-finalization" && + step.name === "Check out trusted workflow cleanup authority" && + step.with?.ref === "${{ github.workflow_sha }}" && + step.with?.["fetch-depth"] === 1 && + step.with?.["persist-credentials"] === false; const trustedE2ePlannerCheckout = jobName === "generate-matrix" && step.name === "Check out trusted E2E planner" && @@ -653,6 +660,13 @@ function validateManualPrDispatch(errors: string[], workflow: OperationsWorkflow step.with?.ref === "${{ inputs.workflow_sha || github.workflow_sha }}" && step.with?.path === ".trusted-openshell-dev-artifact"; const nativeRuntimeQualificationCheckout = + (jobName === "portable-podman-toolchain" && + step.name === "Check out the pinned Podman 5.7 source" && + step.with?.repository === "podman-container-tools/podman" && + step.with?.ref === "0370128fc8dcae93533334324ef838db8f8da8cb" && + step.with?.path === ".podman-source" && + step.with?.["fetch-depth"] === 1 && + step.with?.["persist-credentials"] === false) || (jobName === "native-runtime-qualification-podman-toolchain" && step.name === "Check out the pinned Podman source" && step.with?.repository === "podman-container-tools/podman" && @@ -698,6 +712,7 @@ function validateManualPrDispatch(errors: string[], workflow: OperationsWorkflow const trustedCheckout = trustedCompilerCheckout || trustedHermesFixtureCheckout || + trustedPortablePodmanCleanupCheckout || trustedE2ePlannerCheckout || trustedReportHelperCheckout || trustedReleaseQualificationCheckout || diff --git a/tools/e2e/pre-candidate-workflow-contract.mts b/tools/e2e/pre-candidate-workflow-contract.mts index d0f29f32a7c..3d40ec7bb33 100644 --- a/tools/e2e/pre-candidate-workflow-contract.mts +++ b/tools/e2e/pre-candidate-workflow-contract.mts @@ -63,7 +63,7 @@ export const PRE_CANDIDATE_STEP_ENV: Readonly([ path: "e2e-artifacts/live/hermes-gpu-startup/${{ matrix.scenario }}/${{ matrix.runtime_provider }}/", }, ], + [ + "portable-hermes-finalization", + { + name: "e2e-portable-hermes-finalization", + path: "e2e-artifacts/live/portable-hermes-finalization/", + }, + ], [ "openshell-gateway-auth-contract", { @@ -375,6 +399,12 @@ function validateUploadPlacement( ["Restore Docker CLI after native Podman E2E", "Clean up Docker auth"], ["Restore Docker CLI after native Podman public install"], ["Restore Docker CLI after native Podman public install", "Clean up Docker auth"], + ["Restore Docker and retire Portable Podman runtime", "Clean up Docker auth"], + [ + "Restore Docker and retire Portable Podman runtime", + "Remove immutable native Podman cleanup fixture", + "Clean up Docker auth", + ], ].some((candidate) => isDeepStrictEqual(tailNames, candidate)); if (!validTail) { errors.push( @@ -521,6 +551,7 @@ export function validateUploadE2eArtifactsInvocations(workflow: WorkflowRecord): !isExactManagedImageBuildCacheUpload(jobName, step) && !isExactOpenShellSdkE2ePackageUpload(jobName, step) && !isExactNativeRuntimeAggregateUpload(jobName, step) && + !isExactPortablePodmanToolchainUpload(jobName, step) && !isExactReviewQueueResultUpload(jobName, step) ) { errors.push(`${jobName} must not invoke actions/upload-artifact directly`); diff --git a/tools/e2e/workflow-boundary-policy.mts b/tools/e2e/workflow-boundary-policy.mts index b0133cf0ff1..70f67b3c387 100644 --- a/tools/e2e/workflow-boundary-policy.mts +++ b/tools/e2e/workflow-boundary-policy.mts @@ -13,13 +13,13 @@ export const E2E_ACTION_PROVENANCE = { }, nativePodmanRuntime: { reference: - "NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8", - contentSha256: "85f2fd3760a2ccff1946c8aa1390156cd106b51bbd8596ce59d626def7b78de9", + "NVIDIA/NemoClaw/.github/actions/setup-native-podman-e2e@22789bcaf835db7cf6390781c8d0f454f1e73dec", + contentSha256: "71b047434bb457bd0e7f7d1b8dec9c5c803f2e74de3cdc92381652dbd77d82c8", }, restoreNativePodmanRuntime: { reference: - "NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@b39c9ee2bba1bffaabcfe97ae4a7787a5c603ee8", - contentSha256: "17a7b3c8675897fcc2f4da62b83a47ecd43ad46c37f7c42948aa99775d917f76", + "NVIDIA/NemoClaw/.github/actions/restore-native-podman-e2e@9650336899bf836db5844381a97cbc2b0fe4a2b8", + contentSha256: "8a1f5ef5b8ecb170b65aa8c1bac1a6aee148375f39711a61c64186e54e60e4be", }, stageNativePodmanToolchains: { reference: diff --git a/tools/e2e/workflow-boundary.mts b/tools/e2e/workflow-boundary.mts index a5d3eda13e0..036f9a129c4 100644 --- a/tools/e2e/workflow-boundary.mts +++ b/tools/e2e/workflow-boundary.mts @@ -205,6 +205,7 @@ const FREE_STANDING_SELECTOR_SPECIAL_CASES = new Set([ "managed-image-multiarch-startup", "managed-image-protected-runtime", "openshell-credential-generation-window", + "portable-hermes-finalization", "staging-brev-launchable", "staging-brev-launchable-identity", ]); @@ -1705,6 +1706,9 @@ function validateDockerHubAuthBoundary(errors: string[], jobs: WorkflowRecord): if (jobName === "managed-image-multiarch-startup") { return step.name === "Checkout trusted Hermes resolver" ? [index] : []; } + if (jobName === "portable-hermes-finalization") { + return step.name === "Check out the exact candidate" ? [index] : []; + } return stringValue(step.uses).startsWith("actions/checkout@") ? [index] : []; }); const checkoutIndex = checkoutIndexes[0] ?? -1; @@ -2832,6 +2836,16 @@ function validateNativePodmanDockerIsolationWorkflow(workflow: WorkflowRecord): (step) => step.uses === E2E_ACTION_PROVENANCE.nativePodmanRuntime.reference, ); if (setupIndex < 0) continue; + const setupInputs = asRecord(jobSteps[setupIndex]!.with); + const preservesDockerCli = setupInputs["isolate-docker-cli"] === "false"; + if (jobName === "portable-hermes-finalization" && !preservesDockerCli) { + errors.push( + "portable-hermes-finalization must retain the Docker client for its Podman compatibility proof", + ); + } + if (jobName !== "portable-hermes-finalization" && preservesDockerCli) { + errors.push(`${jobName} must not retain the Docker client during native Podman execution`); + } const restores = jobSteps .map((step, index) => ({ index, step })) .filter( @@ -2839,14 +2853,28 @@ function validateNativePodmanDockerIsolationWorkflow(workflow: WorkflowRecord): ); const preSetupRestores = restores.filter(({ index }) => index < setupIndex); const postSetupRestores = restores.filter(({ index }) => index > setupIndex); - const requiresStaleRecovery = jobName === "hermes-gpu-startup"; + const requiresStaleRecovery = new Set([ + "hermes-gpu-startup", + "portable-hermes-finalization", + ]).has(jobName); + const expectedPreRestoreName = + jobName === "portable-hermes-finalization" + ? "Recover stale Docker isolation before Portable Podman E2E" + : "Recover Docker CLI before native Podman E2E"; + const expectedPreRestoreCondition = + jobName === "portable-hermes-finalization" + ? "" + : "${{ matrix.runtime_provider == 'podman' }}"; + const expectedPostRestoreCondition = + jobName === "portable-hermes-finalization" + ? "always()" + : "${{ always() && matrix.runtime_provider == 'podman' }}"; if ( requiresStaleRecovery && (preSetupRestores.length !== 1 || preSetupRestores[0]!.index !== setupIndex - 1 || - preSetupRestores[0]!.step.name !== "Recover Docker CLI before native Podman E2E" || - stringValue(preSetupRestores[0]!.step.if) !== - "${{ matrix.runtime_provider == 'podman' }}" || + preSetupRestores[0]!.step.name !== expectedPreRestoreName || + stringValue(preSetupRestores[0]!.step.if) !== expectedPreRestoreCondition || !isDeepStrictEqual(asRecord(preSetupRestores[0]!.step.with), { enabled: "true" })) ) { errors.push( @@ -2865,8 +2893,7 @@ function validateNativePodmanDockerIsolationWorkflow(workflow: WorkflowRecord): ); if ( postSetupRestores.length !== 1 || - stringValue(postSetupRestores[0]!.step.if) !== - "${{ always() && matrix.runtime_provider == 'podman' }}" || + stringValue(postSetupRestores[0]!.step.if) !== expectedPostRestoreCondition || !isDeepStrictEqual(asRecord(postSetupRestores[0]!.step.with), { enabled: "true" }) ) { errors.push( @@ -3004,7 +3031,7 @@ export function validateE2eWorkflow(workflowValue: unknown): string[] { staging?.if !== undefined || staging?.["continue-on-error"] !== undefined || asRecord(staging?.with).enabled !== - "${{ contains(format(',{0},', inputs.gateway_runtimes || inputs.gateway_runtime || 'docker'), ',podman,') && 'true' || 'false' }}" || + "${{ (contains(format(',{0},', inputs.gateway_runtimes || inputs.gateway_runtime || 'docker'), ',podman,') || contains(fromJSON(steps.matrix.outputs.selected_jobs), 'portable-hermes-finalization')) && 'true' || 'false' }}" || asRecord(staging?.with)["github-token"] !== "${{ github.token }}" ) { errors.push( @@ -3622,7 +3649,9 @@ export function validateNativePodmanSetupAction( ): string[] { const actionSource = readFileSync(actionPath, "utf8"); const action = asRecord(YAML.parse(actionSource)); + const inputs = asRecord(action.inputs); const steps = asSteps(asRecord(action.runs).steps); + const artifact = steps.find((step) => step.name === "Resolve native Podman toolchain artifact"); const start = steps.find((step) => step.name === "Start native Podman runtime"); const isolate = steps.find( (step) => step.name === "Remove Docker CLI from native Podman execution", @@ -3638,6 +3667,21 @@ export function validateNativePodmanSetupAction( } if (!start) return ["native Podman setup action must start the runtime"]; + if ( + asRecord(inputs.toolchain).default !== "native-6.1" || + asRecord(inputs["isolate-docker-cli"]).default !== "true" || + asRecord(artifact?.env).TOOLCHAIN_PROFILE !== "${{ inputs.toolchain }}" || + !stringValue(artifact?.run).includes("native-6.1)") || + !stringValue(artifact?.run).includes("portable-5.7)") || + !stringValue(artifact?.run).includes( + "podman_source_sha=0370128fc8dcae93533334324ef838db8f8da8cb", + ) || + !stringValue(artifact?.run).includes( + 'echo "::error::Unsupported reviewed Podman toolchain: $TOOLCHAIN_PROFILE"', + ) + ) { + errors.push("native Podman setup must select only reviewed toolchain contracts"); + } if (!run.includes('systemctl start "user-runtime-dir@${uid}.service" "user@${uid}.service"')) { errors.push("native Podman setup must start the runner user manager"); } @@ -3719,7 +3763,7 @@ export function validateNativePodmanSetupAction( } const isolationRun = stringValue(isolate?.run); if ( - isolate?.if !== "${{ inputs.enabled == 'true' }}" || + isolate?.if !== "${{ inputs.enabled == 'true' && inputs.isolate-docker-cli == 'true' }}" || steps.at(-1) !== isolate || !isolationRun.includes("restore_root=/usr/lib/nemoclaw-native-podman-e2e/docker-cli-restore") || !isolationRun.includes('runtime_state_path="$restore_root/runtime.json"') ||