diff --git a/.github/actions/setup-e2e-cli/action.yml b/.github/actions/setup-e2e-cli/action.yml index 4d43e232a4..d7d1c8a296 100644 --- a/.github/actions/setup-e2e-cli/action.yml +++ b/.github/actions/setup-e2e-cli/action.yml @@ -1,5 +1,11 @@ name: Setup E2E CLI -description: Download an architecture-matched prebuilt OpenShell CLI for E2E tests +description: Download architecture-matched prebuilt OpenShell host CLIs for E2E tests + +inputs: + conformance-artifact-prefix: + description: Optional conformance CLI artifact name prefix; linux- is appended automatically + required: false + default: "" runs: using: composite @@ -17,3 +23,27 @@ runs: chmod +x "$cli" "$cli" --version echo "OPENSHELL_BIN=$cli" >> "$GITHUB_ENV" + + - name: Download prebuilt conformance CLI + if: inputs.conformance-artifact-prefix != '' + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: ${{ format('{0}-{1}', inputs.conformance-artifact-prefix, runner.arch == 'X64' && 'x86_64-unknown-linux-musl' || 'aarch64-unknown-linux-musl') }} + path: .e2e/prebuilt-conformance + + - name: Configure prebuilt conformance CLI + if: inputs.conformance-artifact-prefix != '' + shell: bash + run: | # zizmor: ignore[github-env] validated filename under the trusted workspace path + set -euo pipefail + conformance="$GITHUB_WORKSPACE/.e2e/prebuilt-conformance/openshell-conformance" + if [[ ! -f "$conformance" ]]; then + echo "downloaded artifact is missing $conformance" >&2 + exit 1 + fi + # TODO: Remove this temporary mode diagnostic after CI confirms artifact permission handling. + echo "conformance binary mode before chmod: $(ls -l "$conformance")" + chmod +x "$conformance" + echo "conformance binary mode after chmod: $(ls -l "$conformance")" + "$conformance" list --output json >/dev/null + echo "OPENSHELL_CONFORMANCE_BIN=$conformance" >> "$GITHUB_ENV" diff --git a/.github/workflows/branch-e2e.yml b/.github/workflows/branch-e2e.yml index 0b050d0e51..580a05c1f9 100644 --- a/.github/workflows/branch-e2e.yml +++ b/.github/workflows/branch-e2e.yml @@ -105,6 +105,31 @@ jobs: cargo-version: ${{ needs.version.outputs.cargo }} secrets: inherit + build-conformance: + needs: [pr_metadata, version] + if: needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_any_e2e == 'true' + permissions: + contents: read + strategy: + matrix: + include: + - triple: x86_64-unknown-linux-musl + runner: linux-amd64-cpu8 + dev_shell: .#devShells.x86_64-linux.musl + - triple: aarch64-unknown-linux-musl + runner: linux-arm64-cpu8 + dev_shell: .#devShells.aarch64-linux.musl + uses: ./.github/workflows/build-binaries.yml + with: + package: openshell-conformance-cli + binary: openshell-conformance + artifact-name: openshell-conformance-${{ matrix.triple }} + triple: ${{ matrix.triple }} + runner: ${{ matrix.runner }} + dev-shell: ${{ matrix.dev_shell }} + cargo-version: ${{ needs.version.outputs.cargo }} + secrets: inherit + build-sandbox: needs: version permissions: @@ -241,7 +266,7 @@ jobs: secrets: inherit docker-e2e: - needs: [pr_metadata, build-cli, build-gateway, build-supervisor-image] + needs: [pr_metadata, build-cli, build-conformance, build-gateway, build-supervisor-image] if: needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_core_e2e == 'true' permissions: actions: read @@ -251,9 +276,10 @@ jobs: with: image-tag: ${{ github.sha }} runner: linux-arm64-cpu8 + conformance-artifact-prefix: openshell-conformance podman-e2e: - needs: [pr_metadata, build-cli, build-gateway, build-supervisor-image] + needs: [pr_metadata, build-cli, build-conformance, build-gateway, build-supervisor-image] if: needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_core_e2e == 'true' permissions: actions: read @@ -262,18 +288,21 @@ jobs: uses: ./.github/workflows/e2e-podman-test.yml with: image-tag: ${{ github.sha }} + conformance-artifact-prefix: openshell-conformance vm-e2e: - needs: [pr_metadata, build-cli, build-gateway, build-vm-driver] + needs: [pr_metadata, build-cli, build-conformance, build-gateway, build-vm-driver] if: needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_core_e2e == 'true' permissions: actions: read contents: read packages: read uses: ./.github/workflows/e2e-vm-test.yml + with: + conformance-artifact-prefix: openshell-conformance docker-external-driver-e2e: - needs: [pr_metadata, build-cli, build-gateway-plain, build-driver-docker, build-supervisor-image] + needs: [pr_metadata, build-cli, build-conformance, build-gateway-plain, build-driver-docker, build-supervisor-image] if: needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_core_e2e == 'true' permissions: actions: read @@ -285,11 +314,12 @@ jobs: runner: linux-arm64-cpu8 gateway-artifact: openshell-gateway-plain-aarch64-unknown-linux-gnu external-driver-binary: openshell-driver-docker + conformance-artifact-prefix: openshell-conformance suite-matrix: >- [{"suite":"external-driver","cmd":"mise run --no-deps --skip-deps e2e:docker:external-driver","apt_packages":"openssh-client","python_proto":false,"mcp":false}] podman-external-driver-e2e: - needs: [pr_metadata, build-cli, build-gateway-plain, build-driver-podman, build-supervisor-image] + needs: [pr_metadata, build-cli, build-conformance, build-gateway-plain, build-driver-podman, build-supervisor-image] if: needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_core_e2e == 'true' permissions: actions: read @@ -300,11 +330,12 @@ jobs: image-tag: ${{ github.sha }} gateway-artifact: openshell-gateway-plain-x86_64-unknown-linux-gnu external-driver-binary: openshell-driver-podman + conformance-artifact-prefix: openshell-conformance suite-matrix: >- [{"suite":"external-driver","runner":"ubuntu-26.04","podman_major":"5","podman_package_version":"5.7.0+ds2-3build1","conmon_package_version":"2.1.13+ds1-2","cmd":"mise run --no-deps --skip-deps e2e:podman:external-driver"}] vm-external-driver-e2e: - needs: [pr_metadata, build-cli, build-gateway-plain, build-vm-driver] + needs: [pr_metadata, build-cli, build-conformance, build-gateway-plain, build-vm-driver] if: needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_core_e2e == 'true' permissions: actions: read @@ -315,9 +346,10 @@ jobs: gateway-artifact: openshell-gateway-plain-x86_64-unknown-linux-gnu suite-name: external-driver e2e-task: e2e:vm:external-driver + conformance-artifact-prefix: openshell-conformance gpu-e2e: - needs: [pr_metadata, build-cli, build-gateway, build-supervisor-image] + needs: [pr_metadata, build-cli, build-conformance, build-gateway, build-supervisor-image] if: needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_gpu_e2e == 'true' permissions: actions: read @@ -326,9 +358,10 @@ jobs: uses: ./.github/workflows/e2e-gpu-test.yaml with: image-tag: ${{ github.sha }} + conformance-artifact-prefix: openshell-conformance kubernetes-e2e: - needs: [pr_metadata, build-cli, build-gateway-image, build-supervisor-image] + needs: [pr_metadata, build-cli, build-conformance, build-gateway-image, build-supervisor-image] if: needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_core_e2e == 'true' strategy: fail-fast: false @@ -356,9 +389,10 @@ jobs: job-name: Kubernetes E2E (Rust smoke, ${{ matrix.topology }}, Agent Sandbox ${{ matrix.agent_sandbox_api }}) agent-sandbox-version: ${{ matrix.agent_sandbox_version }} extra-helm-values: ${{ matrix.extra_helm_values }} + conformance-artifact-prefix: openshell-conformance kubernetes-workspace-managed-e2e: - needs: [pr_metadata, build-cli, build-gateway-image, build-supervisor-image] + needs: [pr_metadata, build-cli, build-conformance, build-gateway-image, build-supervisor-image] if: needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_core_e2e == 'true' permissions: actions: read @@ -369,9 +403,10 @@ jobs: image-tag: ${{ github.sha }} job-name: Kubernetes E2E (workspace managed mode) e2e-task: e2e:kubernetes:workspace-managed + conformance-artifact-prefix: openshell-conformance kubernetes-external-driver-e2e: - needs: [pr_metadata, build-cli, build-gateway-plain, build-driver-kubernetes, build-supervisor-image] + needs: [pr_metadata, build-cli, build-conformance, build-gateway-plain, build-driver-kubernetes, build-supervisor-image] if: needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_core_e2e == 'true' permissions: actions: read @@ -385,9 +420,10 @@ jobs: gateway-artifact: openshell-gateway-plain-x86_64-unknown-linux-gnu external-driver-binary: openshell-driver-kubernetes cluster-images: supervisor + conformance-artifact-prefix: openshell-conformance kubernetes-workspace-operator-e2e: - needs: [pr_metadata, build-cli, build-gateway-image, build-supervisor-image] + needs: [pr_metadata, build-cli, build-conformance, build-gateway-image, build-supervisor-image] if: needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_core_e2e == 'true' permissions: actions: read @@ -398,9 +434,10 @@ jobs: image-tag: ${{ github.sha }} job-name: Kubernetes E2E (workspace operator mode) e2e-task: e2e:kubernetes:workspace-operator + conformance-artifact-prefix: openshell-conformance kubernetes-ha-e2e: - needs: [pr_metadata, build-cli, build-gateway-image, build-supervisor-image] + needs: [pr_metadata, build-cli, build-conformance, build-gateway-image, build-supervisor-image] if: needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_kubernetes_ha_e2e == 'true' permissions: actions: read @@ -412,9 +449,10 @@ jobs: job-name: Kubernetes HA E2E (Rust smoke) extra-helm-values: deploy/helm/openshell/ci/values-high-availability.yaml external-postgres-secret: openshell-ha-pg + conformance-artifact-prefix: openshell-conformance kubernetes-credential-drivers-e2e: - needs: [pr_metadata, build-cli, build-gateway-image, build-supervisor-image] + needs: [pr_metadata, build-cli, build-conformance, build-gateway-image, build-supervisor-image] if: needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_kubernetes_credential_drivers_e2e == 'true' permissions: actions: read @@ -425,6 +463,7 @@ jobs: image-tag: ${{ github.sha }} job-name: Kubernetes Credential Drivers E2E e2e-task: e2e:kubernetes:credential-drivers + conformance-artifact-prefix: openshell-conformance core-e2e-result: name: Core E2E result diff --git a/.github/workflows/codex-security.yml b/.github/workflows/codex-security.yml new file mode 100644 index 0000000000..0749ec7d84 --- /dev/null +++ b/.github/workflows/codex-security.yml @@ -0,0 +1,244 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +name: Codex Security Release Qualification + +on: + push: + tags: + - "v*.*.*-pre.*" + workflow_call: + inputs: + candidate_ref: + description: Pre-release tag to scan (vMAJOR.MINOR.PATCH-pre.N) + required: true + type: string + stable_ref: + description: Optional previous stable tag override + required: false + default: "" + type: string + allow_full_bootstrap: + description: Allow a full scan when no previous stable tag exists + required: false + default: false + type: boolean + outputs: + base_sha: + description: Previous stable commit, empty for a full bootstrap scan + value: ${{ jobs.analyze.outputs.base_sha }} + candidate_sha: + description: Qualified pre-release commit + value: ${{ jobs.analyze.outputs.candidate_sha }} + category: + description: Code Scanning category for the release train + value: ${{ jobs.analyze.outputs.category }} + train: + description: Stable version targeted by the pre-release train + value: ${{ jobs.analyze.outputs.train }} + secrets: + CODEX_SECURITY_API_KEY: + required: true + workflow_dispatch: + inputs: + candidate_ref: + description: Pre-release tag to scan (vMAJOR.MINOR.PATCH-pre.N) + required: true + type: string + stable_ref: + description: Optional previous stable tag override + required: false + type: string + allow_full_bootstrap: + description: Allow a full scan when no previous stable tag exists + required: false + default: false + type: boolean + +permissions: + actions: read + contents: read + security-events: write + +concurrency: + group: codex-security-release-qualification + cancel-in-progress: true + +env: + CODEX_SECURITY_REASONING_EFFORT: medium + NVIDIA_INFERENCE_BASE_URL: https://inference-api.nvidia.com/v1 + NVIDIA_INFERENCE_MODEL: openai/openai/gpt-5.6-sol + +jobs: + analyze: + name: Codex Security (${{ inputs.candidate_ref || github.ref_name }}) + runs-on: ubuntu-latest + timeout-minutes: 120 + outputs: + base_sha: ${{ steps.range.outputs.base_sha }} + candidate_sha: ${{ steps.range.outputs.candidate_sha }} + category: ${{ steps.range.outputs.category }} + train: ${{ steps.range.outputs.train }} + steps: + # Install the trusted scanner before repository-controlled files exist in + # the workspace, and invoke it later through its absolute path. + - name: Set up Node.js + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + node-version: "26" + package-manager-cache: false + + - name: Set up Python + uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 + with: + python-version: "3.14" + + - name: Install Codex Security + run: | + set -euo pipefail + npm install \ + --prefix "$RUNNER_TEMP/codex-security" \ + --ignore-scripts \ + --no-audit \ + --no-fund \ + @openai/codex-security@0.1.24 + + - name: Verify Codex Security + env: + CODEX_SECURITY_BIN: ${{ runner.temp }}/codex-security/node_modules/.bin/codex-security + run: | + set -euo pipefail + test -x "$CODEX_SECURITY_BIN" + "$CODEX_SECURITY_BIN" --version + + - name: Check out the pre-release + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ inputs.candidate_ref || github.ref }} + fetch-depth: 0 + persist-credentials: false + + - name: Resolve release range + id: range + env: + ALLOW_FULL_BOOTSTRAP: ${{ inputs.allow_full_bootstrap || false }} + CANDIDATE_REF: ${{ inputs.candidate_ref || github.ref_name }} + STABLE_REF: ${{ inputs.stable_ref || '' }} + run: | + set -euo pipefail + git show-ref --verify --quiet refs/remotes/origin/main + + args=( + --candidate "$CANDIDATE_REF" + --main-ref origin/main + ) + if [ -n "$STABLE_REF" ]; then + args+=(--stable "$STABLE_REF") + fi + if [ "$ALLOW_FULL_BOOTSTRAP" = "true" ]; then + args+=(--allow-full-bootstrap) + fi + + node tasks/scripts/codex-security-release-range.mjs "${args[@]}" + + - name: Scan changes since the previous stable + env: + BASE_SHA: ${{ steps.range.outputs.base_sha }} + CODEX_SECURITY_BIN: ${{ runner.temp }}/codex-security/node_modules/.bin/codex-security + CODEX_SECURITY_STATE_DIR: ${{ runner.temp }}/codex-security-state + HEAD_SHA: ${{ steps.range.outputs.candidate_sha }} + NVIDIA_INFERENCE_API_KEY: ${{ secrets.CODEX_SECURITY_API_KEY }} + OPENAI_API_KEY: ${{ secrets.CODEX_SECURITY_API_KEY }} + SCAN_DIR: ${{ runner.temp }}/codex-security-results + SCAN_SCOPE: ${{ steps.range.outputs.scan_scope }} + run: | + set -euo pipefail + install -d -m 700 "$CODEX_SECURITY_STATE_DIR" "$SCAN_DIR" + + target_args=() + if [ "$SCAN_SCOPE" = "diff" ]; then + target_args=(--diff "$BASE_SHA" --head "$HEAD_SHA") + elif [ "$SCAN_SCOPE" != "full" ]; then + echo "::error::Unsupported Codex Security scan scope: $SCAN_SCOPE" + exit 2 + fi + + "$CODEX_SECURITY_BIN" scan . \ + "${target_args[@]}" \ + --auth api-key \ + --model "$NVIDIA_INFERENCE_MODEL" \ + --effort "$CODEX_SECURITY_REASONING_EFFORT" \ + --codex 'model_provider="nvidia"' \ + --codex 'model_providers.nvidia.name="NVIDIA Inference"' \ + --codex "model_providers.nvidia.base_url=\"$NVIDIA_INFERENCE_BASE_URL\"" \ + --codex 'model_providers.nvidia.env_key="NVIDIA_INFERENCE_API_KEY"' \ + --codex 'model_providers.nvidia.wire_api="responses"' \ + --codex 'model_providers.nvidia.supports_websockets=false' \ + --output-dir "$SCAN_DIR" \ + --headless > /dev/null + + - name: Export SARIF + env: + CODEX_SECURITY_BIN: ${{ runner.temp }}/codex-security/node_modules/.bin/codex-security + SARIF_FILE: ${{ runner.temp }}/codex-security.sarif + SCAN_DIR: ${{ runner.temp }}/codex-security-results + run: | + set -euo pipefail + "$CODEX_SECURITY_BIN" export "$SCAN_DIR" \ + --export-format sarif \ + --source-root "$GITHUB_WORKSPACE" \ + --output "$SARIF_FILE" + + - name: Summarize findings + env: + BASE_TAG: ${{ steps.range.outputs.base_tag }} + CANDIDATE_TAG: ${{ steps.range.outputs.candidate_tag }} + COMMIT_COUNT: ${{ steps.range.outputs.commit_count }} + SARIF_FILE: ${{ runner.temp }}/codex-security.sarif + SCAN_SCOPE: ${{ steps.range.outputs.scan_scope }} + TRAIN: ${{ steps.range.outputs.train }} + run: | + set -euo pipefail + finding_count=$(jq '[.runs[]?.results[]?] | length' "$SARIF_FILE") + { + echo "### Codex Security release qualification" + echo + echo "- Train: \`$TRAIN\`" + echo "- Candidate: \`$CANDIDATE_TAG\`" + if [ "$SCAN_SCOPE" = "diff" ]; then + echo "- Previous stable: \`$BASE_TAG\`" + echo "- Commits in cumulative diff: $COMMIT_COUNT" + else + echo "- Scope: approved full bootstrap scan" + fi + echo "- Coverage: complete" + echo "- Findings: $finding_count" + echo + echo "Findings are informational during the observation phase." + } >> "$GITHUB_STEP_SUMMARY" + + - name: Upload SARIF to Code Scanning + uses: github/codeql-action/upload-sarif@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4.37.7 + with: + sarif_file: ${{ runner.temp }}/codex-security.sarif + ref: refs/heads/main + sha: ${{ steps.range.outputs.candidate_sha }} + category: ${{ steps.range.outputs.category }} + + result: + name: OpenShell / Codex Security (informational) + if: always() + needs: analyze + runs-on: ubuntu-latest + permissions: {} + steps: + - name: Evaluate scanner execution + env: + ANALYZE_RESULT: ${{ needs.analyze.result }} + run: | + set -euo pipefail + if [ "$ANALYZE_RESULT" != "success" ]; then + echo "::error::Codex Security release qualification did not complete successfully." + exit 1 + fi + echo "Codex Security completed; findings remain informational." diff --git a/.github/workflows/e2e-docker-test.yml b/.github/workflows/e2e-docker-test.yml index aa884bc3e2..0b2338e8a6 100644 --- a/.github/workflows/e2e-docker-test.yml +++ b/.github/workflows/e2e-docker-test.yml @@ -25,6 +25,10 @@ on: required: false type: string default: "" + conformance-artifact-prefix: + required: false + type: string + default: "" suite-matrix: required: false type: string @@ -66,6 +70,8 @@ jobs: persist-credentials: false - uses: ./.github/actions/setup-e2e-cli + with: + conformance-artifact-prefix: ${{ inputs.conformance-artifact-prefix }} - uses: ./.github/actions/setup-e2e-gateway with: diff --git a/.github/workflows/e2e-gpu-test.yaml b/.github/workflows/e2e-gpu-test.yaml index 1a8275a274..b363a0509b 100644 --- a/.github/workflows/e2e-gpu-test.yaml +++ b/.github/workflows/e2e-gpu-test.yaml @@ -7,6 +7,11 @@ on: description: "Image tag to test (typically the commit SHA)" required: true type: string + conformance-artifact-prefix: + description: "Optional prebuilt conformance CLI artifact prefix (artifact suffix is )" + required: false + type: string + default: "" permissions: actions: read @@ -61,6 +66,8 @@ jobs: - name: Use prebuilt OpenShell CLI uses: ./.github/actions/setup-e2e-cli + with: + conformance-artifact-prefix: ${{ inputs.conformance-artifact-prefix }} - name: Use prebuilt OpenShell gateway uses: ./.github/actions/setup-e2e-gateway diff --git a/.github/workflows/e2e-kubernetes-test.yml b/.github/workflows/e2e-kubernetes-test.yml index 4498f9d44a..368d902b40 100644 --- a/.github/workflows/e2e-kubernetes-test.yml +++ b/.github/workflows/e2e-kubernetes-test.yml @@ -52,6 +52,11 @@ on: required: false type: string default: "" + conformance-artifact-prefix: + description: "Optional prebuilt conformance CLI artifact prefix (artifact suffix is )" + required: false + type: string + default: "" external-driver-binary: description: "Optional standalone compute driver binary used to compose a local test image" required: false @@ -92,6 +97,8 @@ jobs: - name: Use prebuilt OpenShell CLI uses: ./.github/actions/setup-e2e-cli + with: + conformance-artifact-prefix: ${{ inputs.conformance-artifact-prefix }} - name: Use prebuilt OpenShell gateway if: inputs.gateway-artifact != '' diff --git a/.github/workflows/e2e-podman-test.yml b/.github/workflows/e2e-podman-test.yml index 4a5a6d38d7..3ec5294c41 100644 --- a/.github/workflows/e2e-podman-test.yml +++ b/.github/workflows/e2e-podman-test.yml @@ -21,6 +21,10 @@ on: required: false type: string default: "" + conformance-artifact-prefix: + required: false + type: string + default: "" suite-matrix: required: false type: string @@ -53,6 +57,8 @@ jobs: persist-credentials: false - uses: ./.github/actions/setup-e2e-cli + with: + conformance-artifact-prefix: ${{ inputs.conformance-artifact-prefix }} - uses: ./.github/actions/setup-e2e-gateway with: diff --git a/.github/workflows/e2e-vm-test.yml b/.github/workflows/e2e-vm-test.yml index 57e04c32b3..954de9669e 100644 --- a/.github/workflows/e2e-vm-test.yml +++ b/.github/workflows/e2e-vm-test.yml @@ -22,6 +22,10 @@ on: required: false type: string default: e2e:vm + conformance-artifact-prefix: + required: false + type: string + default: "" permissions: actions: read @@ -43,6 +47,8 @@ jobs: persist-credentials: false - uses: ./.github/actions/setup-e2e-cli + with: + conformance-artifact-prefix: ${{ inputs.conformance-artifact-prefix }} - uses: ./.github/actions/setup-e2e-gateway with: diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml index 92eb4adf14..20d74436c6 100644 --- a/.github/workflows/release-tag.yml +++ b/.github/workflows/release-tag.yml @@ -4,6 +4,7 @@ on: push: tags: - "v*.*.*" + - "!v*.*.*-pre.*" workflow_dispatch: inputs: tag: diff --git a/AGENTS.md b/AGENTS.md index 2f2a166f55..5fdaa63d02 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -30,6 +30,8 @@ These pipelines connect skills into end-to-end workflows. Individual skill files | Path | Components | Purpose | |------|-----------|---------| | `crates/openshell-cli/` | CLI binary | User-facing command-line interface | +| `crates/openshell-conformance/` | CLI conformance library | Reusable driver-agnostic scenarios and command runner | +| `crates/openshell-conformance-cli/` | Conformance CLI | Distributable `list` and `run` entrypoint for gateway conformance | | `crates/openshell-server/` | Gateway server | Control-plane API, sandbox lifecycle, auth boundary | | `crates/openshell-sandbox/` | Sandbox runtime | Container supervision, policy-enforced egress routing | | `crates/openshell-policy/` | Policy engine | Filesystem, network, process, and inference constraints | diff --git a/CI.md b/CI.md index c0ec57f877..c29abdba0c 100644 --- a/CI.md +++ b/CI.md @@ -28,13 +28,15 @@ The GitHub ruleset should require the `OpenShell / ...` statuses published by `R ## Informational security reports -Security analysis that does not need NVIDIA infrastructure runs directly on -GitHub-hosted runners. These workflows receive no secrets. The PR-oriented -reports run on fork pull requests without waiting for copy-pr-bot. Scanner jobs -request `security-events: write` to publish SARIF to Code Scanning. GitHub -permits Code Scanning uploads from `pull_request` runs even when fork and -Dependabot contexts receive a read-only `GITHUB_TOKEN`, so those scanners upload -results directly and also retain report artifacts: +Security workflow compute runs directly on GitHub-hosted runners instead of +NVIDIA self-hosted runners. The PR-oriented workflows receive no secrets and run +on fork pull requests without waiting for copy-pr-bot. Codex Security release +qualification is the exception: it runs only for maintainer-created +pre-release tags and receives a scoped NVIDIA Inference API key for the scan +step. Scanner jobs request `security-events: write` to publish SARIF to Code +Scanning. GitHub permits Code Scanning uploads from `pull_request` runs even +when fork and Dependabot contexts receive a read-only `GITHUB_TOKEN`, so those +scanners upload results directly: - `Workflow Security Reports` runs Actionlint and Zizmor. Actionlint reports workflow syntax and expression findings. Zizmor reports only High severity, @@ -50,6 +52,20 @@ results directly and also retain report artifacts: E2E test code are excluded. It runs nightly on `main`, remains manually dispatchable for diagnostics, uploads results to Code Scanning, and retains workflow artifacts. +- `Codex Security Release Qualification` analyzes each `vX.Y.Z-pre.N` + candidate against the previous stable release. Every candidate in a release + train therefore rescans the cumulative stable-to-candidate diff. It calls + `https://inference-api.nvidia.com/v1` with + `openai/openai/gpt-5.6-sol` at medium reasoning effort. The + `CODEX_SECURITY_API_KEY` secret must contain an API key authorized for that + NVIDIA endpoint. Results are uploaded against the candidate commit on `main` + under a category shared by the train, for example + `codex-security/v0.1.1`, so later candidates replace earlier analyses. The + slash-qualified NVIDIA model identifier prevents Codex Security 0.1.24 from + enforcing `--max-cost`, so the workflow relies on its timeout, serialized + concurrency, and the inference account's spend controls. Raw reports are not + retained as workflow artifacts. Pre-release creation and stable-promotion + enforcement remain part of RFC 0014 and are not implemented by this workflow. Findings do not fail these workflows. Tool startup, configuration, build, and analysis failures still fail so a broken scanner cannot appear healthy. The @@ -187,6 +203,7 @@ The bot's full administrator documentation is internal to NVIDIA. The only comma | `.github/workflows/workflow-security.yml` | Runs informational Actionlint and High-severity Zizmor reports on GitHub-hosted runners. | | `.github/workflows/dependency-review.yml` | Reports dependency changes when GitHub Dependency Graph is available; otherwise publishes a neutral warning. | | `.github/workflows/codeql.yml` | Runs nightly informational CodeQL analysis on `main` for Rust and the Go, Python, and TypeScript SDKs and retains SARIF artifacts. | +| `.github/workflows/codex-security.yml` | Scans the cumulative diff from the previous stable release to each pre-release candidate and publishes train-scoped SARIF on `main`. | ## Release workflows @@ -195,7 +212,7 @@ These workflows run after merge to publish dev/tagged artifacts and verify them. | File | Role | |---|---| | `.github/workflows/release-dev.yml` | Publishes the rolling `dev` build on every push to `main`. Builds gateway/supervisor images and binaries, packages, wheels, and pushes the Helm chart as `oci://ghcr.io/nvidia/openshell/helm-chart:0.0.0-dev` (plus an immutable `0.0.0-dev.` pin). Also dispatchable manually. | -| `.github/workflows/release-tag.yml` | Publishes a tagged public release. | +| `.github/workflows/release-tag.yml` | Publishes a tagged stable release. Its automatic tag trigger excludes `-pre.*`; manual dispatch remains maintainer-controlled. | | `.github/workflows/release-canary.yml` | Smoke-tests published artifacts on `macos`, `ubuntu`, `fedora`, and `kubernetes` (kind + Helm) runners. Triggers automatically when `Release Dev` succeeds, and via `workflow_dispatch` on any branch (`gh workflow run release-canary.yml --ref `). The `kubernetes` job pins to `0.0.0-dev` artifacts; the other jobs install the latest tagged release via `install.sh`. See the `test-release-canary` skill for the manual-dispatch playbook and local kind reproduction. | ## Required status contexts diff --git a/Cargo.lock b/Cargo.lock index 011730760d..9188a93d0c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -127,7 +127,7 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -138,7 +138,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -434,23 +434,17 @@ dependencies = [ "aws-smithy-async", "aws-smithy-runtime-api", "aws-smithy-types", - "h2 0.3.27", - "h2 0.4.13", - "http 0.2.12", + "h2", "http 1.4.0", - "http-body 0.4.6", - "hyper 0.14.32", - "hyper 1.9.0", - "hyper-rustls 0.24.2", - "hyper-rustls 0.27.9", + "hyper", + "hyper-rustls", "hyper-util", "pin-project-lite", - "rustls 0.21.12", - "rustls 0.23.38", + "rustls", "rustls-native-certs", "rustls-pki-types", "tokio", - "tokio-rustls 0.26.4", + "tokio-rustls", "tower 0.5.3", "tracing", ] @@ -615,7 +609,7 @@ dependencies = [ "http 1.4.0", "http-body 1.0.1", "http-body-util", - "hyper 1.9.0", + "hyper", "hyper-util", "itoa", "matchit", @@ -818,7 +812,7 @@ dependencies = [ "hex", "http 1.4.0", "http-body-util", - "hyper 1.9.0", + "hyper", "hyper-named-pipe", "hyper-util", "hyperlocal", @@ -1828,7 +1822,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -2206,25 +2200,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "h2" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0beca50380b1fc32983fc1cb4587bfa4bb9e78fc259aad4a0032d2080309222d" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 0.2.12", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "h2" version = "0.4.13" @@ -2465,30 +2440,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "hyper" -version = "0.14.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2 0.3.27", - "http 0.2.12", - "http-body 0.4.6", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2 0.5.10", - "tokio", - "tower-service", - "tracing", - "want", -] - [[package]] name = "hyper" version = "1.9.0" @@ -2499,7 +2450,7 @@ dependencies = [ "bytes", "futures-channel", "futures-core", - "h2 0.4.13", + "h2", "http 1.4.0", "http-body 1.0.1", "httparse", @@ -2518,7 +2469,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73b7d8abf35697b81a825e386fc151e0d503e8cb5fcb93cc8669c376dfd6f278" dependencies = [ "hex", - "hyper 1.9.0", + "hyper", "hyper-util", "pin-project-lite", "tokio", @@ -2526,21 +2477,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "hyper-rustls" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" -dependencies = [ - "futures-util", - "http 0.2.12", - "hyper 0.14.32", - "log", - "rustls 0.21.12", - "tokio", - "tokio-rustls 0.24.1", -] - [[package]] name = "hyper-rustls" version = "0.27.9" @@ -2548,13 +2484,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f" dependencies = [ "http 1.4.0", - "hyper 1.9.0", + "hyper", "hyper-util", "log", - "rustls 0.23.38", + "rustls", "rustls-native-certs", "tokio", - "tokio-rustls 0.26.4", + "tokio-rustls", "tower-service", ] @@ -2564,7 +2500,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" dependencies = [ - "hyper 1.9.0", + "hyper", "hyper-util", "pin-project-lite", "tokio", @@ -2583,12 +2519,12 @@ dependencies = [ "futures-util", "http 1.4.0", "http-body 1.0.1", - "hyper 1.9.0", + "hyper", "ipnet", "libc", "percent-encoding", "pin-project-lite", - "socket2 0.6.3", + "socket2", "tokio", "tower-service", "tracing", @@ -2602,7 +2538,7 @@ checksum = "986c5ce3b994526b3cd75578e62554abd09f0899d6206de48b3e96ab34ccc8c7" dependencies = [ "hex", "http-body-util", - "hyper 1.9.0", + "hyper", "hyper-util", "pin-project-lite", "tokio", @@ -3155,15 +3091,15 @@ dependencies = [ "http 1.4.0", "http-body 1.0.1", "http-body-util", - "hyper 1.9.0", - "hyper-rustls 0.27.9", + "hyper", + "hyper-rustls", "hyper-timeout", "hyper-util", "jsonpath-rust", "k8s-openapi", "kube-core", "pem", - "rustls 0.23.38", + "rustls", "rustls-pemfile", "secrecy", "serde", @@ -3417,7 +3353,7 @@ checksum = "3589659543c04c7dc5526ec858591015b87cd8746583b51b48ef4353f99dbcda" dependencies = [ "base64 0.22.1", "http-body-util", - "hyper 1.9.0", + "hyper", "hyper-util", "indexmap", "ipnet", @@ -3628,7 +3564,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -3715,7 +3651,7 @@ version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51e219e79014df21a225b1860a479e2dcd7cbd9130f4defd4bd0e191ea31d67d" dependencies = [ - "base64 0.22.1", + "base64 0.21.7", "chrono", "getrandom 0.2.17", "http 1.4.0", @@ -3850,8 +3786,8 @@ dependencies = [ "dialoguer", "futures", "http-body-util", - "hyper 1.9.0", - "hyper-rustls 0.27.9", + "hyper", + "hyper-rustls", "hyper-util", "indicatif", "miette", @@ -3867,7 +3803,7 @@ dependencies = [ "prost-types", "rcgen", "reqwest 0.12.28", - "rustls 0.23.38", + "rustls", "rustls-pemfile", "serde", "serde_json", @@ -3877,7 +3813,7 @@ dependencies = [ "tempfile", "thiserror 2.0.18", "tokio", - "tokio-rustls 0.26.4", + "tokio-rustls", "tokio-stream", "tokio-tungstenite 0.26.2", "tonic", @@ -3887,6 +3823,28 @@ dependencies = [ "url", ] +[[package]] +name = "openshell-conformance" +version = "0.0.0" +dependencies = [ + "rand 0.9.4", + "serde", + "serde_json", + "tempfile", + "tokio", +] + +[[package]] +name = "openshell-conformance-cli" +version = "0.0.0" +dependencies = [ + "clap", + "openshell-conformance", + "serde", + "serde_json", + "tokio", +] + [[package]] name = "openshell-core" version = "0.0.0" @@ -4050,7 +4008,7 @@ dependencies = [ "futures", "http 1.4.0", "http-body-util", - "hyper 1.9.0", + "hyper", "hyper-util", "miette", "nix 0.29.0", @@ -4145,7 +4103,7 @@ dependencies = [ "http 1.4.0", "hyper-util", "rcgen", - "rustls 0.23.38", + "rustls", "serde", "serde_json", "thiserror 2.0.18", @@ -4290,7 +4248,7 @@ dependencies = [ "openshell-supervisor-process", "prost", "prost-types", - "rustls 0.23.38", + "rustls", "serde", "serde_json", "temp-env", @@ -4310,18 +4268,18 @@ version = "0.0.0" dependencies = [ "async-trait", "futures", - "hyper 1.9.0", + "hyper", "hyper-util", "miette", "oauth2", "openshell-core", "reqwest 0.12.28", - "rustls 0.23.38", + "rustls", "serde", "serde_json", "thiserror 2.0.18", "tokio", - "tokio-rustls 0.26.4", + "tokio-rustls", "tokio-stream", "tokio-tungstenite 0.26.2", "tonic", @@ -4351,8 +4309,8 @@ dependencies = [ "http 1.4.0", "http-body 1.0.1", "http-body-util", - "hyper 1.9.0", - "hyper-rustls 0.27.9", + "hyper", + "hyper-rustls", "hyper-util", "ipnet", "jsonwebtoken", @@ -4396,18 +4354,18 @@ dependencies = [ "rsa 0.9.10", "russh", "rustix 1.1.4", - "rustls 0.23.38", + "rustls", "rustls-pemfile", "serde", "serde_json", "sha2 0.10.9", - "socket2 0.6.3", + "socket2", "spiffe", "sqlx", "tempfile", "thiserror 2.0.18", "tokio", - "tokio-rustls 0.26.4", + "tokio-rustls", "tokio-stream", "tokio-tungstenite 0.26.2", "toml", @@ -4493,7 +4451,7 @@ dependencies = [ "rcgen", "regorus", "reqwest 0.12.28", - "rustls 0.23.38", + "rustls", "rustls-native-certs", "rustls-pemfile", "serde", @@ -4506,7 +4464,7 @@ dependencies = [ "tempfile", "thiserror 2.0.18", "tokio", - "tokio-rustls 0.26.4", + "tokio-rustls", "tokio-stream", "tokio-tungstenite 0.26.2", "tonic", @@ -4540,7 +4498,7 @@ dependencies = [ "seccompiler", "serde_json", "sha2 0.10.9", - "socket2 0.6.3", + "socket2", "tempfile", "tokio", "tokio-stream", @@ -5359,8 +5317,8 @@ dependencies = [ "quinn-proto", "quinn-udp", "rustc-hash 2.1.2", - "rustls 0.23.38", - "socket2 0.6.3", + "rustls", + "socket2", "thiserror 2.0.18", "tokio", "tracing", @@ -5381,7 +5339,7 @@ dependencies = [ "rand_pcg", "ring", "rustc-hash 2.1.2", - "rustls 0.23.38", + "rustls", "rustls-pki-types", "slab", "thiserror 2.0.18", @@ -5399,7 +5357,7 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2 0.6.3", + "socket2", "tracing", "windows-sys 0.60.2", ] @@ -5647,15 +5605,15 @@ dependencies = [ "http 1.4.0", "http-body 1.0.1", "http-body-util", - "hyper 1.9.0", - "hyper-rustls 0.27.9", + "hyper", + "hyper-rustls", "hyper-util", "js-sys", "log", "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.38", + "rustls", "rustls-native-certs", "rustls-pki-types", "serde", @@ -5663,7 +5621,7 @@ dependencies = [ "serde_urlencoded", "sync_wrapper", "tokio", - "tokio-rustls 0.26.4", + "tokio-rustls", "tower 0.5.3", "tower-http 0.6.8", "tower-service", @@ -5686,15 +5644,15 @@ dependencies = [ "http 1.4.0", "http-body 1.0.1", "http-body-util", - "hyper 1.9.0", - "hyper-rustls 0.27.9", + "hyper", + "hyper-rustls", "hyper-util", "js-sys", "log", "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.38", + "rustls", "rustls-pki-types", "rustls-platform-verifier", "serde", @@ -5702,7 +5660,7 @@ dependencies = [ "serde_urlencoded", "sync_wrapper", "tokio", - "tokio-rustls 0.26.4", + "tokio-rustls", "tokio-util", "tower 0.5.3", "tower-http 0.6.8", @@ -5954,19 +5912,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.12.1", - "windows-sys 0.61.2", -] - -[[package]] -name = "rustls" -version = "0.21.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" -dependencies = [ - "log", - "ring", - "rustls-webpki 0.101.7", - "sct", + "windows-sys 0.59.0", ] [[package]] @@ -5980,7 +5926,7 @@ dependencies = [ "once_cell", "ring", "rustls-pki-types", - "rustls-webpki 0.103.13", + "rustls-webpki", "subtle", "zeroize", ] @@ -6027,14 +5973,14 @@ dependencies = [ "jni 0.21.1", "log", "once_cell", - "rustls 0.23.38", + "rustls", "rustls-native-certs", "rustls-platform-verifier-android", - "rustls-webpki 0.103.13", + "rustls-webpki", "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -6043,16 +5989,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" -[[package]] -name = "rustls-webpki" -version = "0.101.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" -dependencies = [ - "ring", - "untrusted 0.9.0", -] - [[package]] name = "rustls-webpki" version = "0.103.13" @@ -6147,16 +6083,6 @@ dependencies = [ "sha2 0.11.0", ] -[[package]] -name = "sct" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" -dependencies = [ - "ring", - "untrusted 0.9.0", -] - [[package]] name = "sec1" version = "0.7.3" @@ -6577,16 +6503,6 @@ dependencies = [ "serde", ] -[[package]] -name = "socket2" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "socket2" version = "0.6.3" @@ -6594,7 +6510,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -6697,7 +6613,7 @@ dependencies = [ "memchr", "once_cell", "percent-encoding", - "rustls 0.23.38", + "rustls", "rustls-native-certs", "serde", "serde_json", @@ -7092,7 +7008,7 @@ dependencies = [ "getrandom 0.4.2", "once_cell", "rustix 1.1.4", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -7128,7 +7044,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "230a1b821ccbd75b185820a1f1ff7b14d21da1e442e22c0863ea5f08771a8874" dependencies = [ "rustix 1.1.4", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -7264,7 +7180,7 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.6.3", + "socket2", "tokio-macros", "windows-sys 0.61.2", ] @@ -7280,23 +7196,13 @@ dependencies = [ "syn 2.0.117", ] -[[package]] -name = "tokio-rustls" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" -dependencies = [ - "rustls 0.21.12", - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" dependencies = [ - "rustls 0.23.38", + "rustls", "tokio", ] @@ -7319,11 +7225,11 @@ checksum = "7a9daff607c6d2bf6c16fd681ccb7eecc83e4e2cdc1ca067ffaadfca5de7f084" dependencies = [ "futures-util", "log", - "rustls 0.23.38", + "rustls", "rustls-native-certs", "rustls-pki-types", "tokio", - "tokio-rustls 0.26.4", + "tokio-rustls", "tungstenite 0.26.2", ] @@ -7404,20 +7310,20 @@ dependencies = [ "axum", "base64 0.22.1", "bytes", - "h2 0.4.13", + "h2", "http 1.4.0", "http-body 1.0.1", "http-body-util", - "hyper 1.9.0", + "hyper", "hyper-timeout", "hyper-util", "percent-encoding", "pin-project", "rustls-native-certs", - "socket2 0.6.3", + "socket2", "sync_wrapper", "tokio", - "tokio-rustls 0.26.4", + "tokio-rustls", "tokio-stream", "tower 0.5.3", "tower-layer", @@ -7695,7 +7601,7 @@ dependencies = [ "httparse", "log", "rand 0.9.4", - "rustls 0.23.38", + "rustls", "rustls-pki-types", "sha1 0.10.6", "thiserror 2.0.18", @@ -8125,7 +8031,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.48.0", ] [[package]] @@ -8562,7 +8468,7 @@ dependencies = [ "futures", "http 1.4.0", "http-body-util", - "hyper 1.9.0", + "hyper", "hyper-util", "log", "once_cell", diff --git a/Cargo.toml b/Cargo.toml index 57b77d0716..6936439a3b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -90,8 +90,8 @@ regex = "1" reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls-native-roots"] } # AWS SDK -aws-config = { version = "1", default-features = false, features = ["rustls", "rt-tokio", "behavior-version-latest"] } -aws-sdk-sts = { version = "1", default-features = false, features = ["rustls", "rt-tokio", "behavior-version-latest"] } +aws-config = { version = "1", default-features = false, features = ["default-https-client", "rt-tokio", "behavior-version-latest"] } +aws-sdk-sts = { version = "1", default-features = false, features = ["default-https-client", "rt-tokio", "behavior-version-latest"] } # WebSocket tokio-tungstenite = { version = "0.26", default-features = false, features = ["connect", "rustls-tls-native-roots"] } diff --git a/TESTING.md b/TESTING.md index 6c0829060d..199fa35416 100644 --- a/TESTING.md +++ b/TESTING.md @@ -148,7 +148,12 @@ lifecycle management, output parsing, and cleanup. Suites: - Common suite (`--features e2e`) - driver-neutral CLI behavior, sandbox lifecycle, sync, port forwarding, policy, and provider tests. -- Docker suite (`--features e2e-docker`) - common suite plus Docker-only coverage such as Dockerfile image builds, Docker preflight checks, and managed Docker gateway start. +- CLI conformance (`openshell-conformance`) - the portable deployment smoke + scenario plus focused tests for its reusable command runner. +- Driver suites (`--features e2e-docker`, `e2e-podman`, `e2e-kubernetes`, or + `e2e-vm`) - CLI conformance plus the common and driver-specific coverage for + the selected deployment. +- Docker suite (`--features e2e-docker`) - includes Docker-only coverage such as Dockerfile image builds, Docker preflight checks, and managed Docker gateway start. - Docker GPU suite (`--features e2e-docker-gpu`) - Docker suite plus GPU sandbox smoke coverage. - VM suite (`--features e2e-vm`) - runs e2e tests on a VM. - Kubernetes credential-driver suite (`--features e2e-kubernetes-credential-drivers`) - targeted Kubernetes Secrets and Vault provider credential storage coverage. @@ -166,10 +171,48 @@ key. Run the Docker-backed Rust CLI e2e suite: ```shell -mise run e2e:rust +mise run e2e:docker ``` -Run the Podman-backed Rust CLI e2e suite: +Run the minimal portable CLI conformance profile against the gateway selected +in your OpenShell CLI configuration: + +```shell +mise run e2e:cli-conformance +``` + +The gateway must already be installed, reachable, and selected before the task +starts. The task does not provision a gateway or select a compute driver. Set +`OPENSHELL_BIN` to test a prebuilt CLI; otherwise, the task builds the CLI from +the current checkout. + +The phase-1 scenario verifies the complete CLI-to-gateway-to-driver path without +depending on how the gateway was installed or which driver is configured. It +requires machine-readable gRPC status, creates a uniquely named detached +sandbox with `--from base`, verifies the sandbox is `Ready` by finding its +unique name in paginated JSON list output, executes `echo` with a run-specific +marker, deletes the sandbox, and verifies that its name no longer appears. +Driver suites enable the same profile +instead of maintaining a separate smoke implementation. Sandbox lifecycle, +label matrices, VM overlay, and TLS-key permission assertions remain regular +E2E coverage. + +Each invocation prints a ten-character run ID before creating resources. +Conformance sandboxes use names such as `ct--01`. The runner tracks the +exact name and uses it for cleanup; phase 1 does not add ownership labels. + +The runner deletes owned resources after both success and failure. If the test +process is interrupted before cleanup, locate leftovers without touching +unrelated gateway state: + +```shell +openshell sandbox list --output json +openshell sandbox delete +``` + +Gateway-backed Rust E2E tasks build the standalone conformance CLI, run its +registered scenarios against the configured gateway, then run any lane-specific +Rust tests that still apply. Run the Podman-backed Rust CLI e2e suite: ```shell mise run e2e:podman diff --git a/architecture/build.md b/architecture/build.md index 4ffec5b712..32c50aa397 100644 --- a/architecture/build.md +++ b/architecture/build.md @@ -12,6 +12,7 @@ OpenShell builds these main artifacts: |---|---| | Gateway binary | `crates/openshell-server` | | CLI binaries and system packages | `crates/openshell-cli` plus release packaging | +| E2E conformance CLI | `crates/openshell-conformance-cli` | | Python SDK wheel | `python/openshell` | | TypeScript SDK package | `sdk/typescript` | | Gateway container image | `deploy/docker/Dockerfile.gateway` | @@ -289,22 +290,31 @@ disables emission for Rust tests, E2E runs, and release canaries. This prevents synthetic activity from contributing to product usage metrics. Static security checks are deliberately outside the mirror-branch path. They run -directly on GitHub-hosted runners with no secrets, so the pull-request-triggered -ones also cover fork pull requests, and none of them consume NVIDIA self-hosted -capacity. Scanner jobs request `security-events: write` and upload SARIF to Code -Scanning directly on every event they run on, including fork and Dependabot pull -requests, which Code Scanning permits for `pull_request` runs despite their -read-only `GITHUB_TOKEN`. Each scanner also retains its report as a workflow -artifact. No privileged intermediate workflow relays those uploads. +directly on GitHub-hosted runners and none of them consume NVIDIA self-hosted +capacity. The change-oriented ones receive no secrets, so they also cover fork +pull requests; Codex Security release qualification is the exception because it +needs a scoped API key. That key routes Codex Security's model calls to +NVIDIA-hosted inference; the job itself still runs on a GitHub-hosted runner and +uses no NVIDIA self-hosted runner. Scanner jobs request `security-events: write` +and upload SARIF to Code Scanning directly on every event they run on, including +fork and Dependabot pull requests, which Code Scanning permits for +`pull_request` runs despite their read-only `GITHUB_TOKEN`. No privileged +intermediate workflow relays those uploads. Report retention differs by scanner: +Actionlint, Zizmor, and CodeQL keep their reports as workflow artifacts, and +Codex Security keeps no raw report. Triggers differ by workflow: `.github/workflows/workflow-security.yml` runs on `pull_request`, `merge_group`, `main`, and a weekly schedule; `.github/workflows/dependency-review.yml` runs on `pull_request` and -`merge_group` only, because it needs a base and head commit to compare; and +`merge_group` only, because it needs a base and head commit to compare; `.github/workflows/codeql.yml` runs nightly on the default branch (`main`) via -`schedule`, with `workflow_dispatch` kept for manual diagnostics. CodeQL does +`schedule`, with `workflow_dispatch` kept for manual diagnostics; and +`.github/workflows/codex-security.yml` runs on pushed `v*.*.*-pre.*` tags, and is +also callable through `workflow_call` and `workflow_dispatch`. CodeQL does not run on `pull_request`, `merge_group`, or pushes to `main`, so it reports repository-level Code Scanning state on the default branch instead of per-PR results, and its four-language matrix stays off the per-change critical path. +Codex Security is release-scoped rather than change-scoped, so it never runs on +a pull request or merge group. - **Actionlint and Zizmor** analyze the workflow definitions themselves. Repository configuration lives in `.github/actionlint.yml` (self-hosted runner @@ -329,12 +339,49 @@ results, and its four-language matrix stays off the per-change critical path. Go requires a build; the other languages use build mode `none`. Analysis runs on the nightly schedule or by manual dispatch. Results are uploaded to Code Scanning and always retained as workflow artifacts. +- **Codex Security** qualifies release candidates rather than individual + changes. The job installs a pinned `@openai/codex-security` release into the + runner temp directory before the repository is checked out and invokes it by + absolute path, so repository-controlled files cannot shadow the scanner. Model + calls go to NVIDIA-hosted inference at `https://inference-api.nvidia.com/v1`, + declared as a custom Codex provider named `nvidia` that uses the Responses + wire API with WebSockets disabled. The scan runs `openai/openai/gpt-5.6-sol` + at `medium` reasoning effort. The `CODEX_SECURITY_API_KEY` secret holds the + NVIDIA key and is exposed to the scan step alone, as `OPENAI_API_KEY` so the + CLI selects API-key auth and as `NVIDIA_INFERENCE_API_KEY`, the provider + `env_key` read by the Codex child process. + `tasks/scripts/codex-security-release-range.mjs` resolves the scan range: the + candidate must be a `vX.Y.Z-pre.N` tag that is an ancestor of `origin/main`, + and the base is the newest stable `vX.Y.Z` tag merged into the candidate that + is strictly older than the release train `vX.Y.Z` the candidate targets. A + full-repository scan is only possible when no such stable tag exists and the + caller passes `allow_full_bootstrap`. Each candidate scans the cumulative + stable-to-candidate diff, so later candidates re-cover earlier ones. SARIF is + uploaded against `refs/heads/main` at the candidate commit under the + train-scoped category `codex-security/vX.Y.Z`, which makes each candidate's + analysis replace the previous one for that train. Codex Security 0.1.24 cannot + apply `--max-cost` to a slash-qualified model identifier, so the run has no + CLI-enforced cost ceiling. Spend is bounded instead by the 120-minute job + timeout, a single repository-wide concurrency group that serializes + qualification so starting a newer candidate cancels an in-flight one, and + NVIDIA account-side controls. No raw report is retained. Findings never fail these checks; scanner and build failures do. A scanner that -cannot run, a CodeQL analyzer that does not complete, and an unexpected -Dependency Graph API error are all errors, which keeps an informational check -from silently degrading into a no-op. None of these checks are required -statuses, so they do not gate merges. +cannot run, a CodeQL analyzer that does not complete, an unexpected Dependency +Graph API error, and a Codex Security range, scan, or export failure are all +errors, which keeps an informational check from silently degrading into a no-op. +Codex Security also rejects any scan scope other than the resolved +cumulative diff or an approved full bootstrap, so a qualification run either +covers the whole stable-to-candidate range or fails; a separate no-permission +job republishes the analysis job's outcome as the +`OpenShell / Codex Security (informational)` status. None of these checks are +required statuses, so they do not gate merges. + +Codex Security findings are informational during the observation phase, and the +workflow only reports on candidates that already exist. Creating pre-release +tags and gating stable promotion on qualification results are part of +[RFC 0014](../rfc/0014-release-stability/release-qualification.md) and are not +implemented yet. See `CI.md` for the contributor workflow, labels, and maintainer merge-queue workflow. diff --git a/crates/openshell-conformance-cli/Cargo.toml b/crates/openshell-conformance-cli/Cargo.toml new file mode 100644 index 0000000000..ce9f89c17c --- /dev/null +++ b/crates/openshell-conformance-cli/Cargo.toml @@ -0,0 +1,25 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +[package] +name = "openshell-conformance-cli" +description = "Standalone OpenShell CLI conformance test runner" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +repository.workspace = true + +[[bin]] +name = "openshell-conformance" +path = "src/main.rs" + +[dependencies] +clap.workspace = true +openshell-conformance = { path = "../openshell-conformance" } +serde.workspace = true +serde_json.workspace = true +tokio.workspace = true + +[lints] +workspace = true diff --git a/crates/openshell-conformance-cli/src/main.rs b/crates/openshell-conformance-cli/src/main.rs new file mode 100644 index 0000000000..c877cf4fc1 --- /dev/null +++ b/crates/openshell-conformance-cli/src/main.rs @@ -0,0 +1,244 @@ +// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +//! Standalone runner for `OpenShell` CLI conformance scenarios. + +use std::path::PathBuf; +use std::process::ExitCode; + +use clap::{Parser, Subcommand, ValueEnum}; +use openshell_conformance::{OpenShellRunner, Scenario, scenario, scenarios}; +use serde::Serialize; + +#[derive(Debug, Parser)] +#[command( + name = "openshell-conformance", + about = "Run OpenShell CLI conformance scenarios", + version +)] +struct Cli { + #[command(subcommand)] + command: Command, +} + +#[derive(Debug, Subcommand)] +enum Command { + /// List registered scenarios. + List { + #[arg(long, value_enum, default_value_t = OutputFormat::Text)] + output: OutputFormat, + }, + /// Run all registered scenarios, or named scenarios. + Run { + /// Scenario names. Omit to run every registered scenario. + scenarios: Vec, + /// Explicit path to the `OpenShell` CLI. Defaults to `openshell` on PATH. + #[arg(long)] + openshell_bin: Option, + #[arg(long, value_enum, default_value_t = OutputFormat::Text)] + output: OutputFormat, + }, +} + +#[derive(Clone, Copy, Debug, Eq, PartialEq, ValueEnum)] +enum OutputFormat { + Text, + Json, +} + +#[derive(Serialize)] +struct ScenarioDescription<'a> { + name: &'a str, + description: &'a str, +} + +#[derive(Serialize)] +struct ScenarioResult<'a> { + name: &'a str, + passed: bool, + diagnostic: Option, +} + +#[derive(Serialize)] +struct RunReport<'a> { + scenarios: Vec>, + passed: bool, +} + +#[tokio::main] +async fn main() -> ExitCode { + match execute(Cli::parse()).await { + Ok(()) => ExitCode::SUCCESS, + Err(error) => { + eprintln!("openshell-conformance: {error}"); + ExitCode::FAILURE + } + } +} + +async fn execute(cli: Cli) -> Result<(), String> { + match cli.command { + Command::List { output } => list(output), + Command::Run { + scenarios: requested, + openshell_bin, + output, + } => run(&requested, openshell_bin, output).await, + } +} + +fn list(output: OutputFormat) -> Result<(), String> { + match output { + OutputFormat::Text => { + for candidate in scenarios() { + println!("{:<16} {}", candidate.name, candidate.description); + } + } + OutputFormat::Json => { + let result = scenarios() + .iter() + .map(|candidate| ScenarioDescription { + name: candidate.name, + description: candidate.description, + }) + .collect::>(); + println!( + "{}", + serde_json::to_string_pretty(&result).map_err(|error| error.to_string())? + ); + } + } + Ok(()) +} + +async fn run( + requested: &[String], + binary: Option, + output: OutputFormat, +) -> Result<(), String> { + let selected = select_scenarios(requested)?; + let mut results = Vec::with_capacity(selected.len()); + for candidate in selected { + let runner = binary.as_ref().map_or_else( + || OpenShellRunner::new(candidate.name), + |path| OpenShellRunner::with_binary(path.clone(), candidate.name), + ); + let mut runner = match runner { + Ok(runner) => runner, + Err(error) => { + results.push(ScenarioResult { + name: candidate.name, + passed: false, + diagnostic: Some(error.to_string()), + }); + continue; + } + }; + eprintln!("CLI conformance run ID: {}", runner.id()); + let scenario_result = match runner.check_gateway_status().await { + Ok(()) => candidate.run(&mut runner).await, + Err(error) => Err(error), + }; + let outcome = runner.finish(scenario_result).await; + results.push(ScenarioResult { + name: candidate.name, + passed: outcome.is_ok(), + diagnostic: outcome.err(), + }); + } + + let passed = results.iter().all(|result| result.passed); + match output { + OutputFormat::Text => { + for result in &results { + if result.passed { + println!("PASS {}", result.name); + } else { + println!( + "FAIL {}\n{}", + result.name, + result.diagnostic.as_deref().unwrap_or("unknown failure") + ); + } + } + } + OutputFormat::Json => println!( + "{}", + serde_json::to_string_pretty(&RunReport { + scenarios: results, + passed + }) + .map_err(|error| error.to_string())? + ), + } + if passed { + Ok(()) + } else { + Err("one or more scenarios failed".to_string()) + } +} + +fn select_scenarios(requested: &[String]) -> Result, String> { + if requested.is_empty() { + return Ok(scenarios().iter().collect()); + } + requested + .iter() + .map(|name| { + scenario(name).ok_or_else(|| { + format!("unknown scenario '{name}'; run `openshell-conformance list`") + }) + }) + .collect() +} + +#[cfg(test)] +mod tests { + use clap::Parser; + + use super::*; + + #[test] + fn selects_all_scenarios_by_default() { + assert_eq!( + select_scenarios(&[]).expect("select all").len(), + scenarios().len() + ); + } + + #[test] + fn selects_named_scenario() { + let selected = select_scenarios(&["smoke".to_string()]).expect("select smoke"); + assert_eq!(selected[0].name, "smoke"); + } + + #[test] + fn unknown_scenario_has_actionable_diagnostic() { + let error = select_scenarios(&["missing".to_string()]).expect_err("unknown scenario"); + assert!(error.contains("openshell-conformance list")); + } + + #[test] + fn parses_binary_override_and_json_output() { + let cli = Cli::try_parse_from([ + "openshell-conformance", + "run", + "smoke", + "--openshell-bin", + "/opt/openshell", + "--output", + "json", + ]) + .expect("parse CLI"); + let Command::Run { + openshell_bin, + output, + .. + } = cli.command + else { + panic!("expected run") + }; + assert_eq!(openshell_bin, Some(PathBuf::from("/opt/openshell"))); + assert_eq!(output, OutputFormat::Json); + } +} diff --git a/crates/openshell-conformance/Cargo.toml b/crates/openshell-conformance/Cargo.toml new file mode 100644 index 0000000000..7b67258045 --- /dev/null +++ b/crates/openshell-conformance/Cargo.toml @@ -0,0 +1,23 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +[package] +name = "openshell-conformance" +description = "Reusable OpenShell CLI conformance scenarios and runner" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +repository.workspace = true + +[dependencies] +rand.workspace = true +serde.workspace = true +serde_json.workspace = true +tokio.workspace = true + +[dev-dependencies] +tempfile = "3" + +[lints] +workspace = true diff --git a/crates/openshell-conformance/src/executor.rs b/crates/openshell-conformance/src/executor.rs new file mode 100644 index 0000000000..b45c102ee1 --- /dev/null +++ b/crates/openshell-conformance/src/executor.rs @@ -0,0 +1,52 @@ +// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +//! Process execution boundary for the CLI conformance runner. + +use std::future::Future; +use std::path::PathBuf; +use std::pin::Pin; +use std::process::{Output, Stdio}; +use std::time::Duration; + +use tokio::time::timeout; + +pub type CliExecution<'a> = + Pin> + Send + 'a>>; + +pub trait CliExecutor: Send + Sync { + fn execute(&self, args: Vec, command_timeout: Duration) -> CliExecution<'_>; +} + +pub enum CliExecutionError { + Spawn(std::io::Error), + Timeout, +} + +pub struct ProcessCli { + binary: PathBuf, +} + +impl ProcessCli { + pub fn new(binary: PathBuf) -> Self { + Self { binary } + } +} + +impl CliExecutor for ProcessCli { + fn execute(&self, args: Vec, command_timeout: Duration) -> CliExecution<'_> { + Box::pin(async move { + let mut process = tokio::process::Command::new(&self.binary); + process + .args(&args) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .kill_on_drop(true); + + timeout(command_timeout, process.output()) + .await + .map_err(|_| CliExecutionError::Timeout)? + .map_err(CliExecutionError::Spawn) + }) + } +} diff --git a/crates/openshell-conformance/src/lib.rs b/crates/openshell-conformance/src/lib.rs new file mode 100644 index 0000000000..aa6f69c387 --- /dev/null +++ b/crates/openshell-conformance/src/lib.rs @@ -0,0 +1,986 @@ +// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +//! Reusable support for portable `OpenShell` CLI conformance scenarios. + +pub mod executor; +mod scenarios; + +use std::collections::BTreeSet; +use std::error::Error; +use std::fmt; +use std::future::Future; +use std::path::PathBuf; +use std::pin::Pin; +use std::process::ExitStatus; +use std::sync::Arc; +use std::time::{Duration, Instant}; + +use rand::Rng; +use serde::Deserialize; +use serde::de::DeserializeOwned; +use tokio::time::sleep; + +use self::executor::{CliExecutionError, CliExecutor, ProcessCli}; + +pub use scenarios::SMOKE_SCENARIO; + +/// An installed conformance scenario. +#[derive(Debug)] +pub struct Scenario { + pub name: &'static str, + pub description: &'static str, + run: for<'a> fn(&'a mut OpenShellRunner) -> ScenarioFuture<'a>, +} + +pub type ScenarioFuture<'a> = Pin> + Send + 'a>>; + +impl Scenario { + pub async fn run(&self, runner: &mut OpenShellRunner) -> Result<(), String> { + (self.run)(runner).await + } +} + +const SCENARIOS: &[Scenario] = &[SMOKE_SCENARIO]; + +/// Returns every scenario compiled into this distribution. +pub fn scenarios() -> &'static [Scenario] { + SCENARIOS +} + +/// Finds a scenario by its stable command-line name. +pub fn scenario(name: &str) -> Option<&'static Scenario> { + scenarios().iter().find(|candidate| candidate.name == name) +} + +const CLEANUP_TIMEOUT: Duration = Duration::from_secs(120); +pub const STATUS_TIMEOUT: Duration = Duration::from_secs(30); +const GATEWAY_STATUS_ATTEMPT_TIMEOUT: Duration = Duration::from_secs(10); +const GATEWAY_STATUS_INTERVAL: Duration = Duration::from_secs(2); + +/// Generate the suite-owned identifier used in resource names and diagnostics. +fn generate_run_id() -> String { + const ALPHABET: &[u8] = b"0123456789abcdefghijklmnopqrstuvwxyz"; + let mut rng = rand::rng(); + (0..10) + .map(|_| ALPHABET[rng.random_range(0..ALPHABET.len())] as char) + .collect() +} + +/// The completed outcome of one `OpenShell` CLI process. +#[derive(Debug)] +pub struct CommandResult { + run_id: String, + scenario: String, + step: String, + expectation: String, + command: String, + status: ExitStatus, + elapsed: Duration, + stdout: String, + stderr: String, +} + +impl CommandResult { + pub fn success(&self) -> bool { + self.status.success() + } + + pub fn exit_code(&self) -> Option { + self.status.code() + } + + pub fn stdout(&self) -> &str { + &self.stdout + } + + pub fn stderr(&self) -> &str { + &self.stderr + } + + pub fn elapsed(&self) -> Duration { + self.elapsed + } + + pub fn json(&self) -> Result { + serde_json::from_str(&self.stdout).map_err(|source| RunnerError::InvalidJson { + context: self.context(), + source, + stdout: self.stdout.clone(), + stderr: self.stderr.clone(), + }) + } + + pub fn require_success(&self) -> Result<(), String> { + if self.success() { + return Ok(()); + } + Err(self.failure_diagnostic(&self.expectation)) + } + + pub fn failure_diagnostic(&self, expectation: &str) -> String { + format!( + "{}\nexpected: {expectation}\nactual: exit {} after {:.1?}\ncommand: {}\nstdout:\n{}\nstderr:\n{}", + self.context(), + exit_description(self.status), + self.elapsed, + self.command, + self.stdout, + self.stderr, + ) + } + + fn context(&self) -> String { + format!("[run {}][{}/{}]", self.run_id, self.scenario, self.step) + } +} + +/// Failures in reusable runner mechanics rather than scenario assertions. +#[derive(Debug)] +pub enum RunnerError { + BinaryUnavailable(String), + Spawn { + context: String, + command: String, + source: std::io::Error, + }, + Timeout { + context: String, + command: String, + timeout: Duration, + }, + InvalidJson { + context: String, + source: serde_json::Error, + stdout: String, + stderr: String, + }, + PollTimeout { + context: String, + timeout: Duration, + last_observation: String, + }, + ObservationFailed { + context: String, + diagnostic: String, + }, +} + +impl fmt::Display for RunnerError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::BinaryUnavailable(message) => write!(f, "{message}"), + Self::Spawn { + context, + command, + source, + } => write!( + f, + "{context} failed to spawn command: {source}\ncommand: {command}" + ), + Self::Timeout { + context, + command, + timeout, + } => write!( + f, + "{context} timed out after {timeout:.1?}\ncommand: {command}" + ), + Self::InvalidJson { + context, + source, + stdout, + stderr, + } => write!( + f, + "{context} returned invalid JSON: {source}\nstdout:\n{stdout}\nstderr:\n{stderr}" + ), + Self::PollTimeout { + context, + timeout, + last_observation, + } => write!( + f, + "{context} did not satisfy the observation within {timeout:.1?}\nlast observation:\n{last_observation}" + ), + Self::ObservationFailed { + context, + diagnostic, + } => write!(f, "{context} observation failed early:\n{diagnostic}"), + } + } +} + +impl Error for RunnerError { + fn source(&self) -> Option<&(dyn Error + 'static)> { + match self { + Self::Spawn { source, .. } => Some(source), + Self::InvalidJson { source, .. } => Some(source), + _ => None, + } + } +} + +/// Result of one read-only polling observation. +pub enum Poll { + Ready(T), + Pending(String), + Failed(String), +} + +#[derive(Debug, Deserialize)] +struct StatusOutput { + gateway: Option, + server: Option, + status: String, + version: Option, + authentication: Option, +} + +#[derive(Debug, Deserialize)] +struct AuthenticationOutput { + status: String, +} + +/// Runs `OpenShell` commands for one conformance scenario and owns its cleanup. +pub struct OpenShellRunner { + cli: Arc, + run_id: String, + scenario: String, + known_sandboxes: BTreeSet, + finished: bool, +} + +/// A runner command with diagnostic context but no timeout yet. +pub struct CommandStep<'a> { + runner: &'a OpenShellRunner, + step: String, + description: Option, +} + +/// A fully configured runner command ready to execute. +pub struct OpenShellCommand<'a> { + runner: &'a OpenShellRunner, + step: String, + description: String, + timeout: Duration, +} + +impl OpenShellRunner { + pub fn new(scenario: &str) -> Result { + Ok(Self::with_executor( + Arc::new(ProcessCli::new(PathBuf::from("openshell"))), + scenario, + )) + } + + /// Uses an explicit `openshell` binary rather than resolving it on `PATH`. + pub fn with_binary(binary: PathBuf, scenario: &str) -> Result { + if !binary.is_file() { + return Err(RunnerError::BinaryUnavailable(format!( + "OpenShell CLI binary not found at {}", + binary.display() + ))); + } + Ok(Self::with_executor( + Arc::new(ProcessCli::new(binary)), + scenario, + )) + } + + /// Creates a runner with an injected executor. This is useful for harness tests. + pub fn with_executor(cli: Arc, scenario: &str) -> Self { + Self { + cli, + run_id: generate_run_id(), + scenario: scenario.to_string(), + known_sandboxes: BTreeSet::new(), + finished: false, + } + } + + pub fn id(&self) -> &str { + &self.run_id + } + + pub fn scenario(&self) -> &str { + &self.scenario + } + + pub fn step(&self, step: impl Into) -> CommandStep<'_> { + CommandStep { + runner: self, + step: step.into(), + description: None, + } + } + + /// Confirm that the configured gateway is reachable before a scenario runs. + pub async fn check_gateway_status(&mut self) -> Result<(), String> { + let status = self + .poll_until( + "preflight", + STATUS_TIMEOUT, + GATEWAY_STATUS_INTERVAL, + async |runner| match runner + .step("status/json") + .description("machine-readable gateway status succeeds") + .with_timeout(GATEWAY_STATUS_ATTEMPT_TIMEOUT) + .run(&["status", "--output", "json"]) + .await + { + Ok(result) if !result.success() => Poll::Pending( + result.failure_diagnostic("gateway status command succeeds"), + ), + Ok(result) => match result.json::() { + Ok(status) if status.status == "connected" => Poll::Ready(status), + Ok(status) if status.status == "not_configured" => Poll::Failed( + "no active gateway; register and select a gateway before running conformance" + .to_string(), + ), + Ok(status) => Poll::Pending(format!( + "gateway status is {:?}; expected \"connected\"\nstderr:\n{}", + status.status, + result.stderr() + )), + Err(error) => Poll::Failed(error.to_string()), + }, + Err(error) => Poll::Pending(error.to_string()), + }, + ) + .await + .map_err(|error| error.to_string())?; + + eprintln!( + "gateway preflight connected: gateway={}, server={}, version={}, authentication={}", + status.gateway.as_deref().unwrap_or("unknown"), + status.server.as_deref().unwrap_or("unknown"), + status.version.as_deref().unwrap_or("unknown"), + status + .authentication + .as_ref() + .map_or("unknown", |authentication| authentication.status.as_str()), + ); + Ok(()) + } + + /// Register a sandbox name for cleanup. + /// + /// Call this before running the command that may create the sandbox. The + /// scenario remains responsible for constructing and running that command. + pub fn track_sandbox(&mut self, name: &str) { + self.known_sandboxes.insert(name.to_string()); + } + + /// Stop tracking a sandbox after the scenario confirms it is absent. + pub fn forget_sandbox(&mut self, name: &str) { + self.known_sandboxes.remove(name); + } + + pub async fn poll_until( + &mut self, + step: &str, + poll_timeout: Duration, + interval: Duration, + mut observe: F, + ) -> Result + where + F: AsyncFnMut(&mut Self) -> Poll, + { + let started = Instant::now(); + let context = self.context(step); + + loop { + match observe(self).await { + Poll::Ready(value) => return Ok(value), + Poll::Pending(diagnostic) => { + if started.elapsed() >= poll_timeout { + return Err(RunnerError::PollTimeout { + context, + timeout: poll_timeout, + last_observation: diagnostic, + }); + } + } + Poll::Failed(diagnostic) => { + return Err(RunnerError::ObservationFailed { + context, + diagnostic, + }); + } + } + sleep(interval).await; + } + } + + pub async fn finish(mut self, scenario_result: Result<(), String>) -> Result<(), String> { + let cleanup_result = self.cleanup().await; + self.finished = true; + combine_results(scenario_result, cleanup_result) + } + + async fn run_strings( + &self, + step: &str, + expectation: &str, + args: Vec, + command_timeout: Duration, + ) -> Result { + let context = self.context(step); + let command = sanitized_command(&args); + eprintln!("{context} running: {command}"); + + let started = Instant::now(); + let output = + self.cli + .execute(args, command_timeout) + .await + .map_err(|error| match error { + CliExecutionError::Timeout => RunnerError::Timeout { + context: context.clone(), + command: command.clone(), + timeout: command_timeout, + }, + CliExecutionError::Spawn(source) => RunnerError::Spawn { + context: context.clone(), + command: command.clone(), + source, + }, + })?; + let elapsed = started.elapsed(); + eprintln!( + "{context} completed in {:.1?}: exit {}", + elapsed, + exit_description(output.status) + ); + + Ok(CommandResult { + run_id: self.run_id.clone(), + scenario: self.scenario.clone(), + step: step.to_string(), + expectation: expectation.to_string(), + command, + status: output.status, + elapsed, + stdout: String::from_utf8_lossy(&output.stdout).into_owned(), + stderr: String::from_utf8_lossy(&output.stderr).into_owned(), + }) + } + + async fn cleanup(&self) -> Result<(), String> { + if self.known_sandboxes.is_empty() { + return Ok(()); + } + + let cleanup_started = Instant::now(); + let mut failures = Vec::new(); + for name in self.known_sandboxes.clone() { + let remaining = remaining_cleanup_time(cleanup_started); + if remaining.is_zero() { + failures.push(format!( + "{} cleanup budget expired before deleting sandbox '{name}'", + self.context("cleanup/delete") + )); + break; + } + match self + .step("cleanup/delete") + .description(format!("sandbox '{name}' is deleted or already absent")) + .with_timeout(remaining) + .run(&["sandbox", "delete", &name]) + .await + { + Ok(result) if result.success() || output_reports_not_found(&result) => {} + Ok(result) => { + failures.push(result.failure_diagnostic(&format!( + "sandbox '{name}' is deleted or already absent" + ))); + } + Err(error) => failures.push(error.to_string()), + } + } + + if failures.is_empty() { + Ok(()) + } else { + Err(failures.join("\n\n")) + } + } + + fn context(&self, step: &str) -> String { + format!("[run {}][{}/{}]", self.run_id, self.scenario, step) + } +} + +impl<'a> CommandStep<'a> { + #[must_use] + pub fn description(mut self, description: impl Into) -> Self { + self.description = Some(description.into()); + self + } + + pub fn with_timeout(self, timeout: Duration) -> OpenShellCommand<'a> { + let description = self + .description + .unwrap_or_else(|| format!("step '{}' succeeds", self.step)); + OpenShellCommand { + runner: self.runner, + step: self.step, + description, + timeout, + } + } +} + +impl OpenShellCommand<'_> { + pub async fn run(&self, args: &[&str]) -> Result { + self.runner + .run_strings( + &self.step, + &self.description, + args.iter().map(|arg| (*arg).to_string()).collect(), + self.timeout, + ) + .await + } +} + +impl Drop for OpenShellRunner { + fn drop(&mut self) { + if self.finished { + return; + } + let resources = if self.known_sandboxes.is_empty() { + "none explicitly tracked".to_string() + } else { + self.known_sandboxes + .iter() + .cloned() + .collect::>() + .join(", ") + }; + eprintln!( + "[run {}][{}] WARNING: runner dropped without finish(); known sandboxes: {}", + self.run_id, self.scenario, resources + ); + } +} + +fn combine_results( + scenario_result: Result<(), String>, + cleanup_result: Result<(), String>, +) -> Result<(), String> { + match (scenario_result, cleanup_result) { + (Ok(()), Ok(())) => Ok(()), + (Err(functional), Ok(())) => Err(functional), + (Ok(()), Err(cleanup)) => Err(format!("cleanup failed:\n{cleanup}")), + (Err(functional), Err(cleanup)) => Err(format!( + "{functional}\n\nsecondary cleanup failure:\n{cleanup}" + )), + } +} + +fn remaining_cleanup_time(started: Instant) -> Duration { + CLEANUP_TIMEOUT.saturating_sub(started.elapsed()) +} + +fn output_reports_not_found(result: &CommandResult) -> bool { + result.stderr().to_ascii_lowercase().contains("not found") + || result.stdout().to_ascii_lowercase().contains("not found") +} + +fn exit_description(status: ExitStatus) -> String { + status.code().map_or_else( + || "terminated by signal".to_string(), + |code| code.to_string(), + ) +} + +fn sanitized_command(args: &[String]) -> String { + let mut redact_next = false; + let rendered = args.iter().map(|arg| { + let rendered = if redact_next { + redact_next = false; + "".to_string() + } else if sensitive_flag(arg) { + redact_next = !arg.contains('='); + arg.split_once('=') + .map_or_else(|| arg.clone(), |(flag, _)| format!("{flag}=")) + } else { + arg.clone() + }; + shell_escape(&rendered) + }); + std::iter::once("openshell".to_string()) + .chain(rendered) + .collect::>() + .join(" ") +} + +fn sensitive_flag(arg: &str) -> bool { + let flag = arg.split_once('=').map_or(arg, |(flag, _)| flag); + matches!( + flag, + "--credential" + | "--credentials" + | "--env" + | "--header" + | "--material" + | "--password" + | "--secret" + | "--token" + ) || flag.contains("client-secret") + || flag.contains("private-key") + || flag.ends_with("-token") +} + +fn shell_escape(arg: &str) -> String { + if arg + .chars() + .all(|character| character.is_ascii_alphanumeric() || "-_./:@=,".contains(character)) + { + return arg.to_string(); + } + format!("'{}'", arg.replace('\'', "'\\''")) +} + +#[cfg(all(test, unix))] +mod tests { + use std::collections::VecDeque; + use std::os::unix::process::ExitStatusExt; + use std::process::Output; + use std::sync::Mutex; + + use serde::Deserialize; + + use super::executor::CliExecution; + use super::*; + + struct MockCli { + state: Mutex, + } + + struct MockCliState { + responses: VecDeque, + invocations: Vec>, + } + + enum MockResponse { + Output { + exit_code: i32, + stdout: String, + stderr: String, + }, + Timeout, + } + + impl MockResponse { + fn output(exit_code: i32, stdout: &str, stderr: &str) -> Self { + Self::Output { + exit_code, + stdout: stdout.to_string(), + stderr: stderr.to_string(), + } + } + + fn success(stdout: &str) -> Self { + Self::output(0, stdout, "") + } + } + + impl MockCli { + fn new(responses: Vec) -> Self { + Self { + state: Mutex::new(MockCliState { + responses: responses.into(), + invocations: Vec::new(), + }), + } + } + + fn invocations(&self) -> Vec> { + self.state + .lock() + .expect("lock mock CLI state") + .invocations + .clone() + } + } + + impl CliExecutor for MockCli { + fn execute(&self, args: Vec, _command_timeout: Duration) -> CliExecution<'_> { + let response = { + let mut state = self.state.lock().expect("lock mock CLI state"); + state.invocations.push(args); + state + .responses + .pop_front() + .expect("mock CLI received an unexpected invocation") + }; + + Box::pin(async move { + match response { + MockResponse::Output { + exit_code, + stdout, + stderr, + } => Ok(Output { + status: ExitStatus::from_raw(exit_code << 8), + stdout: stdout.into_bytes(), + stderr: stderr.into_bytes(), + }), + MockResponse::Timeout => Err(CliExecutionError::Timeout), + } + }) + } + } + + fn test_runner(responses: Vec) -> (OpenShellRunner, Arc) { + let cli = Arc::new(MockCli::new(responses)); + let runner = OpenShellRunner::with_executor(cli.clone(), "smoke"); + (runner, cli) + } + + #[test] + fn with_binary_rejects_a_missing_file() { + let directory = tempfile::tempdir().expect("create missing CLI directory"); + let Err(error) = OpenShellRunner::with_binary(directory.path().join("missing"), "smoke") + else { + panic!("missing CLI should be rejected"); + }; + + assert!(matches!(error, RunnerError::BinaryUnavailable(_))); + } + + #[test] + fn exposes_generated_identity() { + let (mut runner, _cli) = test_runner(Vec::new()); + + assert_eq!(runner.id().len(), 10); + assert_eq!(runner.scenario(), "smoke"); + runner.finished = true; + } + + #[tokio::test] + async fn captures_streams_and_nonzero_exit_as_result() { + let (mut runner, _cli) = test_runner(vec![MockResponse::output(7, "stdout", "stderr")]); + + let result = runner + .step("capture") + .description("sandbox list succeeds") + .with_timeout(Duration::from_secs(1)) + .run(&["sandbox", "list"]) + .await + .expect("completed nonzero exit is a result"); + + assert_eq!(result.exit_code(), Some(7)); + assert_eq!(result.stdout(), "stdout"); + assert_eq!(result.stderr(), "stderr"); + assert!( + result + .require_success() + .expect_err("nonzero result should fail its expectation") + .contains("expected: sandbox list succeeds") + ); + runner.finished = true; + } + + #[tokio::test] + async fn reports_timeout_as_typed_error() { + let (mut runner, _cli) = test_runner(vec![MockResponse::Timeout]); + + let error = runner + .step("timeout") + .with_timeout(Duration::from_millis(10)) + .run(&["status"]) + .await + .expect_err("command should time out"); + + assert!(matches!(error, RunnerError::Timeout { .. })); + runner.finished = true; + } + + #[derive(Debug, Deserialize, PartialEq, Eq)] + struct JsonFixture { + status: String, + } + + #[tokio::test] + async fn deserializes_stdout_json_without_stderr() { + let (mut runner, _cli) = test_runner(vec![MockResponse::output( + 0, + "{\"status\":\"connected\"}", + "diagnostic", + )]); + + let result = runner + .step("json") + .with_timeout(Duration::from_secs(1)) + .run(&["status"]) + .await + .expect("run fake CLI"); + + assert_eq!( + result.json::().expect("parse JSON"), + JsonFixture { + status: "connected".to_string() + } + ); + runner.finished = true; + } + + #[tokio::test] + async fn accepts_connected_gateway_status() { + let (mut runner, _cli) = + test_runner(vec![MockResponse::success("{\"status\":\"connected\"}")]); + + runner + .check_gateway_status() + .await + .expect("connected gateway should satisfy preflight"); + + runner.finished = true; + } + + #[tokio::test] + async fn polling_returns_ready_value() { + let (mut runner, _cli) = test_runner(Vec::new()); + let mut attempts = 0; + + let value = runner + .poll_until( + "poll", + Duration::from_secs(1), + Duration::from_millis(1), + async |_runner| { + attempts += 1; + if attempts == 2 { + Poll::Ready("ready") + } else { + Poll::Pending("not ready".to_string()) + } + }, + ) + .await + .expect("poll should become ready"); + + assert_eq!(value, "ready"); + runner.finished = true; + } + + #[tokio::test] + async fn polling_timeout_preserves_last_observation() { + let (mut runner, _cli) = test_runner(Vec::new()); + + let error = runner + .poll_until( + "poll", + Duration::from_millis(1), + Duration::from_millis(1), + async |_runner| Poll::<()>::Pending("still pending".to_string()), + ) + .await + .expect_err("poll should time out"); + + assert!(matches!( + error, + RunnerError::PollTimeout { + last_observation, + .. + } if last_observation == "still pending" + )); + runner.finished = true; + } + + #[tokio::test] + async fn finish_skips_cleanup_commands_without_registered_resources() { + let (runner, cli) = test_runner(Vec::new()); + + let error = runner + .finish(Err("preflight failed".to_string())) + .await + .expect_err("functional failure should be preserved"); + + assert_eq!(error, "preflight failed"); + assert!(cli.invocations().is_empty()); + } + + #[test] + fn tracks_sandbox_for_cleanup() { + let (mut runner, _cli) = test_runner(Vec::new()); + + runner.track_sandbox("ct-0123456789-01"); + + assert!(runner.known_sandboxes.contains("ct-0123456789-01")); + runner.finished = true; + } + + #[test] + fn forgets_exact_name_cleanup() { + let (mut runner, _cli) = test_runner(Vec::new()); + + runner.track_sandbox("ct-0123456789-01"); + runner.forget_sandbox("ct-0123456789-01"); + + assert!(runner.known_sandboxes.is_empty()); + runner.finished = true; + } + + #[tokio::test] + async fn finish_deletes_explicitly_tracked_resources() { + let (mut runner, cli) = test_runner(vec![MockResponse::success("")]); + runner.track_sandbox("ct-0123456789-01"); + + runner + .finish(Ok(())) + .await + .expect("owned resource cleanup should succeed"); + + assert_eq!( + cli.invocations(), + vec![vec![ + "sandbox".to_string(), + "delete".to_string(), + "ct-0123456789-01".to_string(), + ]] + ); + } + + #[test] + fn functional_failure_remains_primary_when_cleanup_also_fails() { + let error = combine_results( + Err("functional failure".to_string()), + Err("cleanup failure".to_string()), + ) + .expect_err("combined result should fail"); + + assert!(error.starts_with("functional failure")); + assert!(error.contains("secondary cleanup failure:\ncleanup failure")); + } + + #[test] + fn generated_run_id_is_portable_and_compact() { + let run_id = generate_run_id(); + assert_eq!(run_id.len(), 10); + assert!( + run_id + .chars() + .all(|character| character.is_ascii_lowercase() || character.is_ascii_digit()) + ); + } + + #[test] + fn sanitizes_sensitive_cli_arguments() { + let command = sanitized_command(&[ + "provider".to_string(), + "create".to_string(), + "--credential".to_string(), + "TOKEN=secret".to_string(), + "--client-secret=hunter2".to_string(), + ]); + + assert!(!command.contains("TOKEN=secret")); + assert!(!command.contains("hunter2")); + assert!(command.contains("")); + } +} diff --git a/crates/openshell-conformance/src/scenarios/mod.rs b/crates/openshell-conformance/src/scenarios/mod.rs new file mode 100644 index 0000000000..bd6abdc7af --- /dev/null +++ b/crates/openshell-conformance/src/scenarios/mod.rs @@ -0,0 +1,8 @@ +// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +//! Registered, portable conformance scenarios. + +mod smoke; + +pub use smoke::SMOKE_SCENARIO; diff --git a/crates/openshell-conformance/src/scenarios/smoke.rs b/crates/openshell-conformance/src/scenarios/smoke.rs new file mode 100644 index 0000000000..7a71cb9099 --- /dev/null +++ b/crates/openshell-conformance/src/scenarios/smoke.rs @@ -0,0 +1,206 @@ +// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +//! Portable phase-1 CLI conformance scenario. + +use std::time::{Duration, Instant}; + +use crate::{OpenShellRunner, STATUS_TIMEOUT, Scenario, ScenarioFuture}; +use serde::Deserialize; +use tokio::time::sleep; + +const CREATE_TIMEOUT: Duration = Duration::from_secs(600); +const LIST_ATTEMPT_TIMEOUT: Duration = Duration::from_secs(10); +const LIST_PAGE_SIZE: u32 = 1_000; +const EXEC_TIMEOUT: Duration = Duration::from_secs(120); +const DELETE_TIMEOUT: Duration = Duration::from_secs(120); +const DELETE_POLL_INTERVAL: Duration = Duration::from_secs(1); + +#[derive(Debug, Deserialize)] +struct SandboxListEntry { + name: String, + phase: String, +} + +/// Certify status -> create -> list Ready -> exec -> delete -> list empty. +pub const SMOKE_SCENARIO: Scenario = Scenario { + name: "smoke", + description: "Create, inspect, execute in, and delete a base sandbox.", + run: run_smoke, +}; + +fn run_smoke(runner: &mut OpenShellRunner) -> ScenarioFuture<'_> { + Box::pin(async move { run_smoke_inner(runner).await }) +} + +async fn run_smoke_inner(runner: &mut OpenShellRunner) -> Result<(), String> { + let status = runner + .step("status") + .description("openshell status succeeds") + .with_timeout(STATUS_TIMEOUT) + .run(&["status"]) + .await + .map_err(|error| error.to_string())?; + status.require_success()?; + + let sandbox_name = format!("ct-{}-01", runner.id()); + runner.track_sandbox(&sandbox_name); + let create = runner + .step("create") + .description("sandbox creation succeeds") + .with_timeout(CREATE_TIMEOUT) + .run(&[ + "sandbox", + "create", + "--name", + &sandbox_name, + "--from", + "base", + "--detach", + ]) + .await + .map_err(|error| error.to_string())?; + create.require_success()?; + + let get = runner + .step("get-ready") + .description(format!("sandbox '{sandbox_name}' can be retrieved")) + .with_timeout(LIST_ATTEMPT_TIMEOUT) + .run(&["sandbox", "get", &sandbox_name, "--output", "json"]) + .await + .map_err(|error| error.to_string())?; + get.require_success()?; + + let sandbox = get + .json::() + .map_err(|error| error.to_string())?; + if sandbox.name != sandbox_name { + return Err(format!( + "sandbox get returned {:?}; expected sandbox '{sandbox_name}'", + sandbox.name + )); + } + if sandbox.phase != "Ready" { + return Err(format!( + "sandbox '{sandbox_name}' is in phase {:?}; expected Ready", + sandbox.phase + )); + } + + check_sandbox_listed(runner, &sandbox_name).await?; + + let marker = format!("openshell-conformance-{}", runner.id()); + let exec = runner + .step("exec") + .description("sandbox exec exits successfully") + .with_timeout(EXEC_TIMEOUT) + .run(&[ + "sandbox", + "exec", + "--name", + &sandbox_name, + "--no-tty", + "--", + "echo", + &marker, + ]) + .await + .map_err(|error| error.to_string())?; + exec.require_success()?; + let expected_stdout = format!("{marker}\n"); + if exec.stdout() != expected_stdout { + return Err(exec.failure_diagnostic(&format!("stdout is exactly {expected_stdout:?}"))); + } + + let delete = runner + .step("delete") + .description("sandbox deletion succeeds") + .with_timeout(DELETE_TIMEOUT) + .run(&["sandbox", "delete", &sandbox_name]) + .await + .map_err(|error| error.to_string())?; + delete.require_success()?; + + check_empty_list(runner, &sandbox_name).await?; + runner.forget_sandbox(&sandbox_name); + Ok(()) +} + +async fn check_sandbox_listed(runner: &OpenShellRunner, sandbox_name: &str) -> Result<(), String> { + if find_sandbox(runner, sandbox_name, "list-visible") + .await? + .is_some() + { + return Ok(()); + } + Err(format!( + "sandbox '{sandbox_name}' does not appear in sandbox list" + )) +} + +async fn check_empty_list(runner: &OpenShellRunner, sandbox_name: &str) -> Result<(), String> { + let started = Instant::now(); + + loop { + match find_sandbox(runner, sandbox_name, "list-empty/query").await? { + None => return Ok(()), + Some(sandbox) if started.elapsed() >= DELETE_TIMEOUT => { + return Err(format!( + "sandbox '{sandbox_name}' remains listed in phase {:?} after {DELETE_TIMEOUT:.1?}", + sandbox.phase + )); + } + Some(_) => sleep(DELETE_POLL_INTERVAL).await, + } + } +} + +async fn find_sandbox( + runner: &OpenShellRunner, + sandbox_name: &str, + step: &str, +) -> Result, String> { + let mut offset = 0u32; + + loop { + let limit = LIST_PAGE_SIZE.to_string(); + let page_offset = offset.to_string(); + let result = runner + .step(format!("{step}/{offset}")) + .description(format!("sandbox list page at offset {offset} succeeds")) + .with_timeout(LIST_ATTEMPT_TIMEOUT) + .run(&[ + "sandbox", + "list", + "--limit", + &limit, + "--offset", + &page_offset, + "--output", + "json", + ]) + .await + .map_err(|error| error.to_string())?; + result.require_success()?; + + let sandboxes = result + .json::>() + .map_err(|error| error.to_string())?; + if let Some(sandbox) = sandboxes + .iter() + .find(|sandbox| sandbox.name == sandbox_name) + { + return Ok(Some(SandboxListEntry { + name: sandbox.name.clone(), + phase: sandbox.phase.clone(), + })); + } + if sandboxes.len() < LIST_PAGE_SIZE as usize { + return Ok(None); + } + + offset = offset + .checked_add(LIST_PAGE_SIZE) + .ok_or_else(|| "sandbox list pagination offset overflowed".to_string())?; + } +} diff --git a/e2e/rust/Cargo.toml b/e2e/rust/Cargo.toml index 44881e1682..6dca586879 100644 --- a/e2e/rust/Cargo.toml +++ b/e2e/rust/Cargo.toml @@ -16,6 +16,7 @@ license = "Apache-2.0" publish = false [features] +# Selects the common E2E suite. e2e = [] # Selects tests that rely on `host.openshell.internal` (the sandbox's stable # alias to the host running test fixtures). docker, podman, and vm wire the @@ -47,6 +48,11 @@ name = "provider_refresh_keycloak" path = "tests/provider_refresh_keycloak.rs" required-features = ["e2e-provider-refresh-keycloak"] +[[test]] +name = "vm_overlay" +path = "tests/vm_overlay.rs" +required-features = ["e2e-vm"] + [[test]] name = "custom_image" path = "tests/custom_image.rs" diff --git a/e2e/rust/e2e-docker.sh b/e2e/rust/e2e-docker.sh index 6c28868083..ba97b85a5b 100755 --- a/e2e/rust/e2e-docker.sh +++ b/e2e/rust/e2e-docker.sh @@ -2,23 +2,47 @@ # SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -# Run a Rust e2e test against a standalone gateway running the bundled Docker -# compute driver. Set OPENSHELL_GATEWAY_ENDPOINT=http://host:port to reuse an -# existing plaintext gateway instead of starting an ephemeral one. +# Run standalone CLI conformance, and optionally a focused Rust e2e test, +# against a gateway using the bundled Docker compute driver. Set +# OPENSHELL_GATEWAY_ENDPOINT=http://host:port to reuse an existing plaintext +# gateway instead of starting an ephemeral one. set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" -E2E_TEST="${OPENSHELL_E2E_DOCKER_TEST:-smoke}" -E2E_FEATURES="${OPENSHELL_E2E_DOCKER_FEATURES:-e2e,e2e-docker}" +E2E_TEST="${OPENSHELL_E2E_DOCKER_TEST:-}" +E2E_FEATURES="${OPENSHELL_E2E_DOCKER_FEATURES-e2e-docker}" DEFAULT_WORKLOAD_MANIFEST="${ROOT}/e2e/gpu/images/.build/workloads.yaml" +RUN_WITH_GATEWAY_COMMAND="__openshell_run_docker_e2e" +# shellcheck source=e2e/support/conformance.sh +source "${ROOT}/e2e/support/conformance.sh" + +run_e2e() { + e2e_run_openshell_conformance "Docker" + + if [ -z "${E2E_FEATURES}" ]; then + return 0 + fi + + local cargo_args=( + cargo test --manifest-path "${ROOT}/e2e/rust/Cargo.toml" + --features "${E2E_FEATURES}" + ) + if [ -n "${E2E_TEST}" ]; then + cargo_args+=(--test "${E2E_TEST}") + fi + cargo_args+=(-- --nocapture) + "${cargo_args[@]}" +} if [ "${E2E_TEST}" = "gpu" ] && [ -z "${OPENSHELL_E2E_WORKLOAD_MANIFEST:-}" ] && [ ! -f "${DEFAULT_WORKLOAD_MANIFEST}" ]; then echo "note: running GPU e2e without a workload manifest; workload validation will log an explicit skip. Build one with 'mise run e2e:workloads:build' or set OPENSHELL_E2E_WORKLOAD_MANIFEST." fi +if [ "${1:-}" = "${RUN_WITH_GATEWAY_COMMAND}" ]; then + run_e2e + exit 0 +fi + exec "${ROOT}/e2e/with-docker-gateway.sh" \ - cargo test --manifest-path "${ROOT}/e2e/rust/Cargo.toml" \ - --features "${E2E_FEATURES}" \ - --test "${E2E_TEST}" \ - -- --nocapture + bash "${BASH_SOURCE[0]}" "${RUN_WITH_GATEWAY_COMMAND}" diff --git a/e2e/rust/e2e-kubernetes.sh b/e2e/rust/e2e-kubernetes.sh index cf28e35728..c54057bb94 100755 --- a/e2e/rust/e2e-kubernetes.sh +++ b/e2e/rust/e2e-kubernetes.sh @@ -6,7 +6,7 @@ # via Helm. Set OPENSHELL_E2E_KUBE_CONTEXT to target an existing cluster; # otherwise an ephemeral k3d cluster is created and torn down by # with-kube-gateway.sh. Set OPENSHELL_E2E_KUBE_TEST to scope to a single -# integration test (e.g. smoke) for local debugging. +# integration test for local debugging. # # Features: the default set includes `e2e-host-gateway` so tests that rely on # the sandbox-side `host.openshell.internal` alias compile and run. The @@ -18,14 +18,18 @@ set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +RUN_WITH_GATEWAY_COMMAND="__openshell_run_kubernetes_e2e" +# shellcheck source=e2e/support/conformance.sh +source "${ROOT}/e2e/support/conformance.sh" -E2E_FEATURES="${OPENSHELL_E2E_KUBERNETES_FEATURES:-e2e,e2e-host-gateway,e2e-kubernetes}" +E2E_FEATURES="${OPENSHELL_E2E_KUBERNETES_FEATURES-e2e,e2e-host-gateway,e2e-kubernetes}" # Docker and Podman build their local gateway and CLI together in the shared # gateway wrapper. Kubernetes consumes published gateway images, so only its # local CLI needs to be built when CI has not supplied a prebuilt one. if [ -z "${OPENSHELL_BIN:-}" ]; then cargo build -p openshell-cli + export OPENSHELL_BIN="${ROOT}/target/debug/openshell" fi test_filter=() @@ -33,15 +37,42 @@ if [ -n "${OPENSHELL_E2E_KUBE_TEST:-}" ]; then test_filter+=(--test "${OPENSHELL_E2E_KUBE_TEST}") fi +is_operator_workspace_mode() { + [[ ",${E2E_FEATURES}," == *",e2e-kubernetes-workspace-operator,"* ]] +} + +run_conformance() { + if is_operator_workspace_mode; then + echo "note: skipping standalone CLI conformance in Kubernetes operator workspace mode; default workspace is not operator-allowlisted (see #2971)." + return 0 + fi + + e2e_run_openshell_conformance "Kubernetes" +} + run_suite() { "${ROOT}/e2e/with-kube-gateway.sh" \ - cargo test --manifest-path "${ROOT}/e2e/rust/Cargo.toml" \ - --features "${E2E_FEATURES}" \ - --no-fail-fast \ - ${test_filter[@]+"${test_filter[@]}"} \ - -- --nocapture + bash "${BASH_SOURCE[0]}" "${RUN_WITH_GATEWAY_COMMAND}" } +run_e2e() { + run_conformance + if [ -z "${E2E_FEATURES}" ]; then + return 0 + fi + + cargo test --manifest-path "${ROOT}/e2e/rust/Cargo.toml" \ + --features "${E2E_FEATURES}" \ + --no-fail-fast \ + ${test_filter[@]+"${test_filter[@]}"} \ + -- --nocapture +} + +if [ "${1:-}" = "${RUN_WITH_GATEWAY_COMMAND}" ]; then + run_e2e + exit 0 +fi + if [ "${OPENSHELL_E2E_CREDENTIAL_DRIVERS:-0}" = "1" ] \ && [ -z "${OPENSHELL_E2E_CREDENTIAL_DRIVER:-}" ]; then OPENSHELL_E2E_CREDENTIAL_DRIVER=kubernetes-secrets run_suite @@ -50,8 +81,4 @@ if [ "${OPENSHELL_E2E_CREDENTIAL_DRIVERS:-0}" = "1" ] \ fi exec "${ROOT}/e2e/with-kube-gateway.sh" \ - cargo test --manifest-path "${ROOT}/e2e/rust/Cargo.toml" \ - --features "${E2E_FEATURES}" \ - --no-fail-fast \ - ${test_filter[@]+"${test_filter[@]}"} \ - -- --nocapture + bash "${BASH_SOURCE[0]}" "${RUN_WITH_GATEWAY_COMMAND}" diff --git a/e2e/rust/e2e-podman.sh b/e2e/rust/e2e-podman.sh index f5f1effd18..736519458e 100755 --- a/e2e/rust/e2e-podman.sh +++ b/e2e/rust/e2e-podman.sh @@ -10,28 +10,43 @@ set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" E2E_TEST="${OPENSHELL_E2E_PODMAN_TEST:-}" -E2E_FEATURES="${OPENSHELL_E2E_PODMAN_FEATURES:-e2e-podman}" +E2E_FEATURES="${OPENSHELL_E2E_PODMAN_FEATURES-e2e-podman}" DEFAULT_WORKLOAD_MANIFEST="${ROOT}/e2e/gpu/images/.build/workloads.yaml" +RUN_WITH_GATEWAY_COMMAND="__openshell_run_podman_e2e" +# shellcheck source=e2e/support/conformance.sh +source "${ROOT}/e2e/support/conformance.sh" if [ "${E2E_TEST}" = "gpu" ] && [ -z "${OPENSHELL_E2E_WORKLOAD_MANIFEST:-}" ] && [ ! -f "${DEFAULT_WORKLOAD_MANIFEST}" ]; then echo "note: running Podman GPU e2e without a workload manifest; workload validation will log an explicit skip. Build one with 'CONTAINER_ENGINE=podman mise run e2e:workloads:build' or set OPENSHELL_E2E_WORKLOAD_MANIFEST." fi +if [ "${1:-}" = "${RUN_WITH_GATEWAY_COMMAND}" ]; then + e2e_run_openshell_conformance "Podman" + if [ -z "${E2E_FEATURES}" ]; then + exit 0 + fi + + TEST_ARGS=( + cargo test --manifest-path "${ROOT}/e2e/rust/Cargo.toml" + --features "${E2E_FEATURES}" + ) + if [ -n "${E2E_TEST}" ]; then + TEST_ARGS+=(--test "${E2E_TEST}") + fi + TEST_ARGS+=(-- --nocapture) + "${TEST_ARGS[@]}" + exit 0 +fi + # An empty selector runs the full Podman suite, including provider_token_exchange. if [ -z "${E2E_TEST}" ] || [ "${E2E_TEST}" = "provider_token_exchange" ]; then export OPENSHELL_E2E_SPIFFE_FIXTURE="${OPENSHELL_E2E_SPIFFE_FIXTURE:-1}" fi -cargo build -p openshell-cli - -TEST_ARGS=( - cargo test --manifest-path "${ROOT}/e2e/rust/Cargo.toml" - --features "${E2E_FEATURES}" -) -if [ -n "${E2E_TEST}" ]; then - TEST_ARGS+=(--test "${E2E_TEST}") +if [ -n "${OPENSHELL_GATEWAY_ENDPOINT:-}" ] && [ -z "${OPENSHELL_BIN:-}" ]; then + cargo build -p openshell-cli + export OPENSHELL_BIN="${ROOT}/target/debug/openshell" fi -TEST_ARGS+=(-- --nocapture) exec "${ROOT}/e2e/with-podman-gateway.sh" \ - "${TEST_ARGS[@]}" + bash "${BASH_SOURCE[0]}" "${RUN_WITH_GATEWAY_COMMAND}" diff --git a/e2e/rust/e2e-vm.sh b/e2e/rust/e2e-vm.sh index 4acb7256bb..de7e3ad09d 100755 --- a/e2e/rust/e2e-vm.sh +++ b/e2e/rust/e2e-vm.sh @@ -46,13 +46,15 @@ set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" source "${ROOT}/e2e/support/gateway-common.sh" +# shellcheck source=e2e/support/conformance.sh +source "${ROOT}/e2e/support/conformance.sh" COMPRESSED_DIR="${ROOT}/target/vm-runtime-compressed" GATEWAY_BIN="${OPENSHELL_GATEWAY_BIN:-${ROOT}/target/debug/openshell-gateway}" DRIVER_BIN="${OPENSHELL_VM_DRIVER_BIN:-${ROOT}/target/debug/openshell-driver-vm}" CLI_BIN="${OPENSHELL_BIN:-${ROOT}/target/debug/openshell}" E2E_TEST_OVERRIDE="${OPENSHELL_E2E_VM_TEST:-}" -E2E_FEATURES="${OPENSHELL_E2E_VM_FEATURES:-e2e-vm}" +E2E_FEATURES="${OPENSHELL_E2E_VM_FEATURES-e2e-vm}" SANDBOX_IMAGE="${OPENSHELL_SANDBOX_IMAGE:-${COMMUNITY_SANDBOX_IMAGE:-ghcr.io/nvidia/openshell-community/sandboxes/base:latest}}" # The VM driver places `compute-driver.sock` under `[openshell.drivers.vm].state_dir`. @@ -371,7 +373,6 @@ fi # The CLI uses the raw endpoint but still resolves matching metadata so it # can find the mTLS client bundle. -export OPENSHELL_E2E_EXPECT_VM_OVERLAY=1 export OPENSHELL_E2E_DRIVER="vm" export OPENSHELL_E2E_VM_STATE_DIR="${RUN_STATE_DIR}" e2e_export_gateway_restart_metadata \ @@ -386,6 +387,8 @@ e2e_export_gateway_restart_metadata \ # preparation; allow 180s for slower CI runners. export OPENSHELL_PROVISION_TIMEOUT="${SANDBOX_PROVISION_TIMEOUT}" +e2e_run_openshell_conformance "VM" + run_e2e_test() { local test_target="$1" shift @@ -403,7 +406,7 @@ run_e2e_test() { if [ -n "${E2E_TEST_OVERRIDE}" ]; then run_e2e_test "${E2E_TEST_OVERRIDE}" else - run_e2e_test smoke run_e2e_test host_gateway_alias + run_e2e_test vm_overlay run_e2e_test vm_gateway_start fi diff --git a/e2e/rust/tests/smoke.rs b/e2e/rust/tests/smoke.rs deleted file mode 100644 index c27255e5ef..0000000000 --- a/e2e/rust/tests/smoke.rs +++ /dev/null @@ -1,139 +0,0 @@ -// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 - -#![cfg(feature = "e2e")] - -//! Smoke test: verify the gateway is healthy, create a sandbox, exec a -//! command inside it, and tear it down. -//! -//! This test is cluster-agnostic — it works against any running gateway -//! (Docker-based cluster or openshell-driver-vm microVM). The `e2e:vm` mise -//! task uses it to validate the VM gateway after boot. - -use std::process::Stdio; -use std::time::Duration; - -use openshell_e2e::harness::binary::openshell_cmd; -use openshell_e2e::harness::output::strip_ansi; -use openshell_e2e::harness::sandbox::SandboxGuard; - -/// End-to-end smoke test: status → create → exec → list → delete. -#[tokio::test] -async fn gateway_smoke() { - // ── 1. Gateway must be reachable ────────────────────────────────── - let mut clean_status = String::new(); - let mut status_ok = false; - for _ in 0..15 { - let mut status_cmd = openshell_cmd(); - status_cmd - .arg("status") - .stdout(Stdio::piped()) - .stderr(Stdio::piped()); - - let status_out = status_cmd - .output() - .await - .expect("failed to run openshell status"); - - let status_text = format!( - "{}{}", - String::from_utf8_lossy(&status_out.stdout), - String::from_utf8_lossy(&status_out.stderr), - ); - clean_status = strip_ansi(&status_text); - - if status_out.status.success() && clean_status.contains("Connected") { - status_ok = true; - break; - } - - tokio::time::sleep(Duration::from_secs(2)).await; - } - - assert!( - status_ok, - "openshell status never became healthy:\n{clean_status}", - ); - - // ── 2. Create a sandbox and exec a command ─────────────────────── - // Default behaviour keeps the sandbox alive after the command exits, - // so we can verify it in the list before cleaning up. - let mut sb = SandboxGuard::create(&["--", "echo", "smoke-ok"]) - .await - .expect("sandbox create should succeed"); - - assert!( - sb.create_output.contains("smoke-ok"), - "expected 'smoke-ok' in sandbox output:\n{}", - sb.create_output, - ); - - if std::env::var_os("OPENSHELL_E2E_EXPECT_VM_OVERLAY").is_some() { - assert_vm_overlay_root(&sb.name).await; - } - - // ── 3. Verify the sandbox appeared in the list ─────────────────── - let mut list_cmd = openshell_cmd(); - list_cmd - .args(["sandbox", "list", "--names"]) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()); - - let list_out = list_cmd - .output() - .await - .expect("failed to run openshell sandbox list"); - - let list_text = strip_ansi(&format!( - "{}{}", - String::from_utf8_lossy(&list_out.stdout), - String::from_utf8_lossy(&list_out.stderr), - )); - - assert!( - list_text.contains(&sb.name), - "sandbox '{}' should appear in list output:\n{list_text}", - sb.name, - ); - - // ── 4. Cleanup ─────────────────────────────────────────────────── - sb.cleanup().await; -} - -async fn assert_vm_overlay_root(sandbox_name: &str) { - let script = concat!( - "set -eu; ", - "test \"$(stat -f -c %T /)\" = \"overlayfs\"; ", - "printf \"overlay-write\\n\" > /sandbox/overlay-check; ", - "test \"$(cat /sandbox/overlay-check)\" = \"overlay-write\"; ", - "if [ -e /opt/openshell/tls/tls.key ]; then ", - "test \"$(stat -c %a /opt/openshell/tls/tls.key)\" = \"600\"; ", - "fi; ", - "echo vm-overlay-ok", - ); - - let mut exec_cmd = openshell_cmd(); - exec_cmd - .args(["sandbox", "exec", "--name", sandbox_name, "--no-tty", "--"]) - .arg("sh") - .arg("-lc") - .arg(script) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()); - - let output = exec_cmd - .output() - .await - .expect("failed to run VM overlay assertion"); - let combined = strip_ansi(&format!( - "{}{}", - String::from_utf8_lossy(&output.stdout), - String::from_utf8_lossy(&output.stderr), - )); - - assert!( - output.status.success() && combined.contains("vm-overlay-ok"), - "VM overlay assertion failed (status {:?}):\n{combined}", - output.status.code(), - ); -} diff --git a/e2e/rust/tests/vm_overlay.rs b/e2e/rust/tests/vm_overlay.rs new file mode 100644 index 0000000000..078c6f01de --- /dev/null +++ b/e2e/rust/tests/vm_overlay.rs @@ -0,0 +1,54 @@ +// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +//! VM-driver-specific assertions for the sandbox root filesystem. + +use std::process::Stdio; + +use openshell_e2e::harness::binary::openshell_cmd; +use openshell_e2e::harness::output::strip_ansi; +use openshell_e2e::harness::sandbox::SandboxGuard; + +#[tokio::test] +async fn vm_overlay() { + let mut sandbox = SandboxGuard::create(&["--", "echo", "vm-sandbox-ready"]) + .await + .expect("sandbox create should succeed"); + + let script = concat!( + "set -eu; ", + "test \"$(stat -f -c %T /)\" = \"overlayfs\"; ", + "printf \"overlay-write\\n\" > /sandbox/overlay-check; ", + "test \"$(cat /sandbox/overlay-check)\" = \"overlay-write\"; ", + "if [ -e /opt/openshell/tls/tls.key ]; then ", + "test \"$(stat -c %a /opt/openshell/tls/tls.key)\" = \"600\"; ", + "fi; ", + "echo vm-overlay-ok", + ); + + let mut exec_cmd = openshell_cmd(); + exec_cmd + .args(["sandbox", "exec", "--name", &sandbox.name, "--no-tty", "--"]) + .arg("sh") + .arg("-lc") + .arg(script) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()); + + let output = exec_cmd + .output() + .await + .expect("failed to run VM overlay assertion"); + let combined = strip_ansi(&format!( + "{}{}", + String::from_utf8_lossy(&output.stdout), + String::from_utf8_lossy(&output.stderr), + )); + assert!( + output.status.success() && combined.contains("vm-overlay-ok"), + "VM overlay assertion failed (status {:?}):\n{combined}", + output.status.code(), + ); + + sandbox.cleanup().await; +} diff --git a/e2e/support/conformance.sh b/e2e/support/conformance.sh new file mode 100644 index 0000000000..dd2cbcc596 --- /dev/null +++ b/e2e/support/conformance.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# Shared helpers for running standalone conformance suites against an already +# configured e2e gateway. + +e2e_run_openshell_conformance() { + local gateway_label=${1:-OpenShell} + + if [ -z "${OPENSHELL_BIN:-}" ]; then + echo "ERROR: OPENSHELL_BIN must point to the openshell CLI under test" >&2 + return 2 + fi + + if [ -z "${OPENSHELL_CONFORMANCE_BIN:-}" ]; then + echo "ERROR: OPENSHELL_CONFORMANCE_BIN must point to the openshell-conformance CLI under test" >&2 + return 2 + fi + + if [ ! -x "${OPENSHELL_CONFORMANCE_BIN}" ]; then + echo "ERROR: openshell conformance binary is not executable: ${OPENSHELL_CONFORMANCE_BIN}" >&2 + return 2 + fi + + echo "==> Running standalone CLI conformance against the ${gateway_label} gateway" + "${OPENSHELL_CONFORMANCE_BIN}" run \ + --openshell-bin "${OPENSHELL_BIN}" \ + --output json +} diff --git a/e2e/with-docker-gateway.sh b/e2e/with-docker-gateway.sh index 958ea1b0eb..0a767576dd 100755 --- a/e2e/with-docker-gateway.sh +++ b/e2e/with-docker-gateway.sh @@ -437,6 +437,7 @@ ensure_sandbox_image_available() { } e2e_build_gateway_binaries "${ROOT}" TARGET_DIR GATEWAY_BIN CLI_BIN +export OPENSHELL_BIN="${CLI_BIN}" if [ "${OPENSHELL_E2E_EXTERNAL_COMPUTE_DRIVER:-0}" = "1" ]; then e2e_build_external_driver \ "${ROOT}" openshell-driver-docker openshell-driver-docker DRIVER_BIN diff --git a/e2e/with-podman-gateway.sh b/e2e/with-podman-gateway.sh index dcb2d43fe0..fc3419e182 100755 --- a/e2e/with-podman-gateway.sh +++ b/e2e/with-podman-gateway.sh @@ -383,6 +383,7 @@ fi ensure_podman_api_socket e2e_build_gateway_binaries "${ROOT}" TARGET_DIR GATEWAY_BIN CLI_BIN +export OPENSHELL_BIN="${CLI_BIN}" if [ "${OPENSHELL_E2E_EXTERNAL_COMPUTE_DRIVER:-0}" = "1" ]; then e2e_build_external_driver \ "${ROOT}" openshell-driver-podman openshell-driver-podman DRIVER_BIN diff --git a/tasks/scripts/codex-security-release-range.mjs b/tasks/scripts/codex-security-release-range.mjs new file mode 100644 index 0000000000..025df1e7ad --- /dev/null +++ b/tasks/scripts/codex-security-release-range.mjs @@ -0,0 +1,232 @@ +#!/usr/bin/env node +// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { execFileSync, spawnSync } from 'node:child_process'; +import { appendFileSync } from 'node:fs'; + +const STABLE_TAG_RE = + /^v(?0|[1-9]\d*)\.(?0|[1-9]\d*)\.(?0|[1-9]\d*)$/; +const PRERELEASE_TAG_RE = + /^v(?0|[1-9]\d*)\.(?0|[1-9]\d*)\.(?0|[1-9]\d*)-pre\.(?[1-9]\d*)$/; + +function versionFromMatch(match) { + return [ + Number(match.groups.major), + Number(match.groups.minor), + Number(match.groups.patch), + ]; +} + +export function parseStableTag(tag) { + const match = STABLE_TAG_RE.exec(tag); + if (match === null) return null; + return { tag, version: versionFromMatch(match) }; +} + +export function parsePrereleaseTag(tag) { + const match = PRERELEASE_TAG_RE.exec(tag); + if (match === null) return null; + const version = versionFromMatch(match); + return { + tag, + version, + prerelease: Number(match.groups.prerelease), + train: `v${version.join('.')}`, + }; +} + +export function compareVersions(left, right) { + for (let index = 0; index < left.length; index += 1) { + if (left[index] !== right[index]) return left[index] - right[index]; + } + return 0; +} + +export function selectPreviousStable(tags, candidateVersion) { + return tags + .map(parseStableTag) + .filter( + (parsed) => + parsed !== null && + compareVersions(parsed.version, candidateVersion) < 0, + ) + .sort((left, right) => compareVersions(right.version, left.version))[0]?.tag; +} + +function parseArguments(argv) { + const options = { + candidate: '', + stable: '', + mainRef: 'origin/main', + allowFullBootstrap: false, + githubOutput: process.env.GITHUB_OUTPUT ?? '', + }; + + for (let index = 0; index < argv.length; index += 1) { + const argument = argv[index]; + switch (argument) { + case '--candidate': + options.candidate = argv[++index] ?? ''; + break; + case '--stable': + options.stable = argv[++index] ?? ''; + break; + case '--main-ref': + options.mainRef = argv[++index] ?? ''; + break; + case '--allow-full-bootstrap': + options.allowFullBootstrap = true; + break; + case '--github-output': + options.githubOutput = argv[++index] ?? ''; + break; + default: + throw new Error(`unknown argument: ${argument}`); + } + } + + if (options.candidate === '') { + throw new Error('--candidate is required'); + } + if (options.mainRef === '') { + throw new Error('--main-ref must not be empty'); + } + return options; +} + +function git(args) { + return execFileSync('git', args, { encoding: 'utf8' }).trim(); +} + +function resolvesToCommit(ref) { + try { + return git(['rev-parse', '--verify', `${ref}^{commit}`]); + } catch { + throw new Error(`Git reference does not resolve to a commit: ${ref}`); + } +} + +function isAncestor(ancestor, descendant) { + const result = spawnSync( + 'git', + ['merge-base', '--is-ancestor', ancestor, descendant], + { stdio: 'ignore' }, + ); + if (result.status === 0) return true; + if (result.status === 1) return false; + throw new Error( + `git merge-base failed for ${ancestor} and ${descendant} (exit ${result.status ?? 'unknown'})`, + ); +} + +function writeOutputs(path, outputs) { + if (path === '') return; + const lines = Object.entries(outputs).map(([key, value]) => `${key}=${value}`); + appendFileSync(path, `${lines.join('\n')}\n`, { encoding: 'utf8' }); +} + +function resolveRange(options) { + const candidate = parsePrereleaseTag(options.candidate); + if (candidate === null) { + throw new Error( + `candidate must match vMAJOR.MINOR.PATCH-pre.N: ${options.candidate}`, + ); + } + + const candidateSha = resolvesToCommit(candidate.tag); + const mainSha = resolvesToCommit(options.mainRef); + if (!isAncestor(candidateSha, mainSha)) { + throw new Error( + `candidate ${candidate.tag} (${candidateSha}) is not an ancestor of ${options.mainRef}`, + ); + } + + const mergedTags = git(['tag', '--list', 'v*', '--merged', candidateSha]) + .split('\n') + .filter(Boolean); + const stableTag = + options.stable || selectPreviousStable(mergedTags, candidate.version); + + if (stableTag === undefined || stableTag === '') { + if (!options.allowFullBootstrap) { + throw new Error( + `no previous stable tag exists for ${candidate.tag}; rerun with an approved base or --allow-full-bootstrap`, + ); + } + + return { + base_tag: '', + base_sha: '', + candidate_tag: candidate.tag, + candidate_sha: candidateSha, + train: candidate.train, + category: `codex-security/${candidate.train}`, + scan_scope: 'full', + commit_count: git(['rev-list', '--count', candidateSha]), + }; + } + + const stable = parseStableTag(stableTag); + if (stable === null) { + throw new Error( + `stable base must match vMAJOR.MINOR.PATCH without a prerelease: ${stableTag}`, + ); + } + if (compareVersions(stable.version, candidate.version) >= 0) { + throw new Error( + `stable base ${stable.tag} must be older than release train ${candidate.train}`, + ); + } + + const stableSha = resolvesToCommit(stable.tag); + if (!isAncestor(stableSha, candidateSha)) { + throw new Error( + `stable base ${stable.tag} (${stableSha}) is not an ancestor of ${candidate.tag}`, + ); + } + + const commitCount = Number( + git(['rev-list', '--count', `${stableSha}..${candidateSha}`]), + ); + if (!Number.isSafeInteger(commitCount) || commitCount <= 0) { + throw new Error( + `candidate ${candidate.tag} has no commits after stable base ${stable.tag}`, + ); + } + + return { + base_tag: stable.tag, + base_sha: stableSha, + candidate_tag: candidate.tag, + candidate_sha: candidateSha, + train: candidate.train, + category: `codex-security/${candidate.train}`, + scan_scope: 'diff', + commit_count: String(commitCount), + }; +} + +function main() { + try { + const options = parseArguments(process.argv.slice(2)); + const outputs = resolveRange(options); + writeOutputs(options.githubOutput, outputs); + process.stdout.write(`${JSON.stringify(outputs, null, 2)}\n`); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + if (process.env.GITHUB_ACTIONS === 'true') { + process.stderr.write(`::error::${message}\n`); + } else { + process.stderr.write(`codex-security-release-range: ${message}\n`); + } + process.exitCode = 1; + } +} + +if ( + process.argv[1] !== undefined && + import.meta.url === new URL(process.argv[1], 'file:').href +) { + main(); +} diff --git a/tasks/scripts/codex-security-release-range.test.mjs b/tasks/scripts/codex-security-release-range.test.mjs new file mode 100644 index 0000000000..ea017a8825 --- /dev/null +++ b/tasks/scripts/codex-security-release-range.test.mjs @@ -0,0 +1,190 @@ +// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +import assert from 'node:assert/strict'; +import { execFileSync, spawnSync } from 'node:child_process'; +import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import test from 'node:test'; + +import { + compareVersions, + parsePrereleaseTag, + parseStableTag, + selectPreviousStable, +} from './codex-security-release-range.mjs'; + +const SCRIPT = fileURLToPath( + new URL('./codex-security-release-range.mjs', import.meta.url), +); + +function git(repository, ...args) { + return execFileSync('git', args, { + cwd: repository, + encoding: 'utf8', + }).trim(); +} + +function commit(repository, name) { + writeFileSync(join(repository, 'content.txt'), `${name}\n`, { + encoding: 'utf8', + }); + git(repository, 'add', 'content.txt'); + git( + repository, + '-c', + 'user.name=Codex Security Test', + '-c', + 'user.email=codex-security-test@example.com', + 'commit', + '-m', + name, + ); +} + +function createRepository() { + const repository = mkdtempSync(join(tmpdir(), 'codex-security-range-')); + git(repository, 'init', '--initial-branch=main'); + return repository; +} + +function runResolver(repository, ...args) { + return JSON.parse( + execFileSync(process.execPath, [SCRIPT, ...args], { + cwd: repository, + encoding: 'utf8', + }), + ); +} + +test('parses strict stable and prerelease tags', () => { + assert.deepEqual(parseStableTag('v0.1.0'), { + tag: 'v0.1.0', + version: [0, 1, 0], + }); + assert.equal(parseStableTag('v0.1.0-pre.1'), null); + assert.equal(parseStableTag('dev'), null); + assert.equal(parseStableTag('v01.1.0'), null); + + assert.deepEqual(parsePrereleaseTag('v2.10.3-pre.12'), { + tag: 'v2.10.3-pre.12', + version: [2, 10, 3], + prerelease: 12, + train: 'v2.10.3', + }); + assert.equal(parsePrereleaseTag('v2.10.3'), null); + assert.equal(parsePrereleaseTag('v2.10.3-pre.0'), null); +}); + +test('selects the newest stable strictly before the candidate train', () => { + assert.equal( + selectPreviousStable( + [ + 'v0.1.9', + 'v0.1.10', + 'v0.2.0-pre.1', + 'v0.2.0', + 'vm-runtime', + ], + [0, 2, 0], + ), + 'v0.1.10', + ); + assert.equal(selectPreviousStable(['v0.1.0'], [0, 1, 0]), undefined); + assert(compareVersions([0, 10, 0], [0, 2, 99]) > 0); +}); + +test('resolves a cumulative prerelease range from Git history', () => { + const repository = createRepository(); + try { + commit(repository, 'stable'); + git(repository, 'tag', 'v0.1.0'); + commit(repository, 'pre one'); + git(repository, 'tag', 'v0.1.1-pre.1'); + commit(repository, 'pre two'); + git(repository, 'tag', 'v0.1.1-pre.2'); + git( + repository, + 'update-ref', + 'refs/remotes/origin/main', + git(repository, 'rev-parse', 'HEAD'), + ); + + const result = runResolver( + repository, + '--candidate', + 'v0.1.1-pre.2', + ); + assert.equal(result.base_tag, 'v0.1.0'); + assert.equal(result.candidate_tag, 'v0.1.1-pre.2'); + assert.equal(result.train, 'v0.1.1'); + assert.equal(result.category, 'codex-security/v0.1.1'); + assert.equal(result.scan_scope, 'diff'); + assert.equal(result.commit_count, '2'); + } finally { + rmSync(repository, { recursive: true, force: true }); + } +}); + +test('rejects a prerelease that is not on main', () => { + const repository = createRepository(); + try { + commit(repository, 'stable'); + git(repository, 'tag', 'v0.1.0'); + git( + repository, + 'update-ref', + 'refs/remotes/origin/main', + git(repository, 'rev-parse', 'HEAD'), + ); + git(repository, 'switch', '--create', 'detached-release'); + commit(repository, 'off-main candidate'); + git(repository, 'tag', 'v0.1.1-pre.1'); + + const result = spawnSync( + process.execPath, + [SCRIPT, '--candidate', 'v0.1.1-pre.1'], + { cwd: repository, encoding: 'utf8' }, + ); + assert.equal(result.status, 1); + assert.match(result.stderr, /is not an ancestor of origin\/main/); + } finally { + rmSync(repository, { recursive: true, force: true }); + } +}); + +test('requires explicit approval before a full bootstrap scan', () => { + const repository = createRepository(); + try { + commit(repository, 'first candidate'); + git(repository, 'tag', 'v0.1.0-pre.1'); + git( + repository, + 'update-ref', + 'refs/remotes/origin/main', + git(repository, 'rev-parse', 'HEAD'), + ); + + const rejected = spawnSync( + process.execPath, + [SCRIPT, '--candidate', 'v0.1.0-pre.1'], + { cwd: repository, encoding: 'utf8' }, + ); + assert.equal(rejected.status, 1); + assert.match(rejected.stderr, /--allow-full-bootstrap/); + + const approved = runResolver( + repository, + '--candidate', + 'v0.1.0-pre.1', + '--allow-full-bootstrap', + ); + assert.equal(approved.scan_scope, 'full'); + assert.equal(approved.base_tag, ''); + assert.equal(approved.train, 'v0.1.0'); + } finally { + rmSync(repository, { recursive: true, force: true }); + } +}); diff --git a/tasks/test.toml b/tasks/test.toml index 29e06b826a..2fc3c565e4 100644 --- a/tasks/test.toml +++ b/tasks/test.toml @@ -13,6 +13,7 @@ depends = [ "test:install-sh", "test:build-env", "test:packaging-assets", + "test:codex-security-release-range", "test:docs-website", ] @@ -45,6 +46,11 @@ run = "tasks/scripts/test-packaging-assets.sh" run_windows = "echo Skipping test:packaging-assets: Linux service and RPM assets do not apply on Windows." hide = true +["test:codex-security-release-range"] +description = "Test Codex Security release-range resolution" +run = "node --test tasks/scripts/codex-security-release-range.test.mjs" +hide = true + [e2e] description = "Run all end-to-end tests (Rust + Python + MCP)" depends = ["e2e:rust", "e2e:python", "e2e:mcp"] @@ -82,8 +88,20 @@ hide = true ["e2e:rust"] description = "Run Rust CLI e2e tests against a Docker-backed gateway" +depends = ["e2e:conformance:build"] +run = "OPENSHELL_CONFORMANCE_BIN=\"${OPENSHELL_CONFORMANCE_BIN:-$PWD/target/debug/openshell-conformance}\" e2e/rust/e2e-docker.sh" + +["e2e:conformance:build"] +description = "Build the standalone CLI conformance binary" +run = "if [ -z \"${OPENSHELL_CONFORMANCE_BIN:-}\" ]; then cargo build -p openshell-conformance-cli; fi" +hide = true + +["e2e:cli-conformance"] +description = "Build and run the standalone CLI conformance suite against the configured gateway" +depends = ["e2e:conformance:build"] run = [ - "e2e/with-docker-gateway.sh cargo test --manifest-path e2e/rust/Cargo.toml --features e2e-docker", + "if [ -z \"${OPENSHELL_BIN:-}\" ]; then cargo build -p openshell-cli; fi", + "\"${OPENSHELL_CONFORMANCE_BIN:-$PWD/target/debug/openshell-conformance}\" run --openshell-bin \"${OPENSHELL_BIN:-$PWD/target/debug/openshell}\"", ] ["e2e:websocket-conformance"] @@ -108,7 +126,8 @@ run = "e2e/with-docker-gateway.sh uv run pytest -o python_files='test_*.py *_tes ["e2e:podman"] description = "Run Rust CLI e2e tests against a Podman-backed gateway" -run = "e2e/rust/e2e-podman.sh" +depends = ["e2e:conformance:build"] +run = "OPENSHELL_CONFORMANCE_BIN=\"${OPENSHELL_CONFORMANCE_BIN:-$PWD/target/debug/openshell-conformance}\" e2e/rust/e2e-podman.sh" ["e2e:oidc-pkce"] description = "Run Linux browser PKCE and RBAC e2e tests against Keycloak and a Podman gateway" @@ -139,80 +158,95 @@ run = [ ["e2e:podman:gpu"] description = "Run GPU e2e against a standalone gateway with the Podman compute driver" env = { OPENSHELL_E2E_PODMAN_GPU = "1", OPENSHELL_E2E_PODMAN_TEST = "gpu", OPENSHELL_E2E_PODMAN_FEATURES = "e2e-podman-gpu" } -run = "e2e/rust/e2e-podman.sh" +depends = ["e2e:conformance:build"] +run = "OPENSHELL_CONFORMANCE_BIN=\"${OPENSHELL_CONFORMANCE_BIN:-$PWD/target/debug/openshell-conformance}\" e2e/rust/e2e-podman.sh" ["e2e:kubernetes"] description = "Run Rust CLI e2e tests against an OpenShell gateway deployed on Kubernetes via Helm (set OPENSHELL_E2E_KUBE_CONTEXT to reuse a cluster; otherwise creates a local k3d cluster when k3d is installed; set OPENSHELL_E2E_KUBE_TEST= to scope to one test)" -run = "e2e/rust/e2e-kubernetes.sh" +depends = ["e2e:conformance:build"] +run = "OPENSHELL_CONFORMANCE_BIN=\"${OPENSHELL_CONFORMANCE_BIN:-$PWD/target/debug/openshell-conformance}\" e2e/rust/e2e-kubernetes.sh" ["e2e:kubernetes:v1alpha1"] description = "Run Kubernetes e2e against Agent Sandbox v1alpha1" env = { AGENT_SANDBOX_VERSION = "v0.4.6" } -run = "e2e/rust/e2e-kubernetes.sh" +depends = ["e2e:conformance:build"] +run = "OPENSHELL_CONFORMANCE_BIN=\"${OPENSHELL_CONFORMANCE_BIN:-$PWD/target/debug/openshell-conformance}\" e2e/rust/e2e-kubernetes.sh" ["e2e:kubernetes:agent-sandbox-versions"] description = "Run Kubernetes e2e against Agent Sandbox v1beta1 and v1alpha1" +depends = ["e2e:conformance:build"] run = [ - "e2e/rust/e2e-kubernetes.sh", - "AGENT_SANDBOX_VERSION=v0.4.6 e2e/rust/e2e-kubernetes.sh", + "OPENSHELL_CONFORMANCE_BIN=\"${OPENSHELL_CONFORMANCE_BIN:-$PWD/target/debug/openshell-conformance}\" e2e/rust/e2e-kubernetes.sh", + "OPENSHELL_CONFORMANCE_BIN=\"${OPENSHELL_CONFORMANCE_BIN:-$PWD/target/debug/openshell-conformance}\" AGENT_SANDBOX_VERSION=v0.4.6 e2e/rust/e2e-kubernetes.sh", ] ["e2e:kubernetes:sidecar"] description = "Run Kubernetes e2e with the supervisor sidecar topology overlay" env = { OPENSHELL_E2E_KUBE_EXTRA_VALUES = "deploy/helm/openshell/ci/values-sidecar.yaml" } -run = "e2e/rust/e2e-kubernetes.sh" +depends = ["e2e:conformance:build"] +run = "OPENSHELL_CONFORMANCE_BIN=\"${OPENSHELL_CONFORMANCE_BIN:-$PWD/target/debug/openshell-conformance}\" e2e/rust/e2e-kubernetes.sh" ["e2e:kubernetes:db"] description = "Run Kubernetes e2e with all database backend scenarios (SQLite and external PostgreSQL with existingSecret)" env = { OPENSHELL_E2E_KUBE_DB_SCENARIOS = "1" } -run = "e2e/rust/e2e-kubernetes.sh" +depends = ["e2e:conformance:build"] +run = "OPENSHELL_CONFORMANCE_BIN=\"${OPENSHELL_CONFORMANCE_BIN:-$PWD/target/debug/openshell-conformance}\" e2e/rust/e2e-kubernetes.sh" ["e2e:kubernetes:credential-drivers"] description = "Run Kubernetes e2e for provider credential storage backed by Kubernetes Secrets and Vault" env = { OPENSHELL_E2E_CREDENTIAL_DRIVERS = "1", OPENSHELL_E2E_KUBE_TEST = "credential_drivers", OPENSHELL_E2E_KUBERNETES_FEATURES = "e2e,e2e-kubernetes,e2e-kubernetes-credential-drivers" } -run = "e2e/rust/e2e-kubernetes.sh" +depends = ["e2e:conformance:build"] +run = "OPENSHELL_CONFORMANCE_BIN=\"${OPENSHELL_CONFORMANCE_BIN:-$PWD/target/debug/openshell-conformance}\" e2e/rust/e2e-kubernetes.sh" ["e2e:kubernetes:workspace-managed"] description = "Run Kubernetes e2e with managed workspace mode (auto-created per-workspace namespaces)" env = { OPENSHELL_E2E_KUBE_EXTRA_VALUES = "deploy/helm/openshell/ci/values-workspace-managed.yaml", OPENSHELL_E2E_KUBE_IMAGE_PULL_SECRET = "e2e-regcred", OPENSHELL_E2E_KUBE_TEST = "workspace_namespace_managed", OPENSHELL_E2E_KUBERNETES_FEATURES = "e2e,e2e-kubernetes,e2e-kubernetes-workspace-managed" } -run = "e2e/rust/e2e-kubernetes.sh" +depends = ["e2e:conformance:build"] +run = "OPENSHELL_CONFORMANCE_BIN=\"${OPENSHELL_CONFORMANCE_BIN:-$PWD/target/debug/openshell-conformance}\" e2e/rust/e2e-kubernetes.sh" ["e2e:kubernetes:workspace-operator"] description = "Run Kubernetes e2e with operator workspace mode (pre-provisioned per-workspace namespaces)" env = { OPENSHELL_E2E_KUBE_EXTRA_VALUES = "deploy/helm/openshell/ci/values-workspace-operator.yaml", OPENSHELL_E2E_KUBE_TEST = "workspace_namespace_operator", OPENSHELL_E2E_KUBERNETES_FEATURES = "e2e,e2e-kubernetes,e2e-kubernetes-workspace-operator" } -run = "e2e/rust/e2e-kubernetes.sh" +depends = ["e2e:conformance:build"] +run = "OPENSHELL_CONFORMANCE_BIN=\"${OPENSHELL_CONFORMANCE_BIN:-$PWD/target/debug/openshell-conformance}\" e2e/rust/e2e-kubernetes.sh" ["e2e:vm"] description = "Start openshell-gateway with the VM compute driver and run VM e2e tests" -run = "e2e/rust/e2e-vm.sh" +depends = ["e2e:conformance:build"] +run = "OPENSHELL_CONFORMANCE_BIN=\"${OPENSHELL_CONFORMANCE_BIN:-$PWD/target/debug/openshell-conformance}\" e2e/rust/e2e-vm.sh" ["e2e:gateway:no-compute-drivers"] description = "Build and launch-check openshell-gateway without compiled compute drivers" run = "bash e2e/no-compute-driver-gateway.sh" ["e2e:docker:external-driver"] -description = "Run Docker smoke E2E with a driver-free gateway and external Docker driver binary" -env = { OPENSHELL_E2E_EXTERNAL_COMPUTE_DRIVER = "1" } -run = "e2e/rust/e2e-docker.sh" +description = "Run Docker conformance with a driver-free gateway and external Docker driver binary" +env = { OPENSHELL_E2E_EXTERNAL_COMPUTE_DRIVER = "1", OPENSHELL_E2E_DOCKER_FEATURES = "" } +depends = ["e2e:conformance:build"] +run = "OPENSHELL_CONFORMANCE_BIN=\"${OPENSHELL_CONFORMANCE_BIN:-$PWD/target/debug/openshell-conformance}\" e2e/rust/e2e-docker.sh" ["e2e:podman:external-driver"] -description = "Run Podman E2E with a driver-free gateway and external Podman driver binary" -env = { OPENSHELL_E2E_EXTERNAL_COMPUTE_DRIVER = "1", OPENSHELL_E2E_PODMAN_TEST = "smoke" } -run = "e2e/rust/e2e-podman.sh" +description = "Run Podman conformance with a driver-free gateway and external Podman driver binary" +env = { OPENSHELL_E2E_EXTERNAL_COMPUTE_DRIVER = "1", OPENSHELL_E2E_PODMAN_FEATURES = "" } +depends = ["e2e:conformance:build"] +run = "OPENSHELL_CONFORMANCE_BIN=\"${OPENSHELL_CONFORMANCE_BIN:-$PWD/target/debug/openshell-conformance}\" e2e/rust/e2e-podman.sh" ["e2e:vm:external-driver"] description = "Run VM E2E with a driver-free gateway and external VM driver binary" env = { OPENSHELL_E2E_EXTERNAL_COMPUTE_DRIVER = "1" } -run = "e2e/rust/e2e-vm.sh" +depends = ["e2e:conformance:build"] +run = "OPENSHELL_CONFORMANCE_BIN=\"${OPENSHELL_CONFORMANCE_BIN:-$PWD/target/debug/openshell-conformance}\" e2e/rust/e2e-vm.sh" ["e2e:kubernetes:external-driver"] -description = "Run Kubernetes smoke E2E with a driver-free gateway and external Kubernetes driver sidecar" -env = { OPENSHELL_E2E_EXTERNAL_COMPUTE_DRIVER = "1", OPENSHELL_E2E_KUBE_BUILD_IMAGES = "1", OPENSHELL_E2E_KUBE_TEST = "smoke" } -run = "e2e/rust/e2e-kubernetes.sh" +description = "Run Kubernetes conformance with a driver-free gateway and external Kubernetes driver sidecar" +env = { OPENSHELL_E2E_EXTERNAL_COMPUTE_DRIVER = "1", OPENSHELL_E2E_KUBE_BUILD_IMAGES = "1", OPENSHELL_E2E_KUBERNETES_FEATURES = "" } +depends = ["e2e:conformance:build"] +run = "OPENSHELL_CONFORMANCE_BIN=\"${OPENSHELL_CONFORMANCE_BIN:-$PWD/target/debug/openshell-conformance}\" e2e/rust/e2e-kubernetes.sh" ["e2e:docker"] -description = "Run smoke e2e against a standalone gateway with the Docker compute driver" -run = "e2e/rust/e2e-docker.sh" +description = "Run Docker conformance and Rust e2e tests against a standalone gateway" +depends = ["e2e:conformance:build"] +run = "OPENSHELL_CONFORMANCE_BIN=\"${OPENSHELL_CONFORMANCE_BIN:-$PWD/target/debug/openshell-conformance}\" e2e/rust/e2e-docker.sh" ["e2e:mechanistic-smoke"] description = "Run mechanistic L4 smoke against a Docker-backed gateway" @@ -231,7 +265,8 @@ run = [ ["e2e:docker:gpu"] description = "Run GPU e2e against a standalone gateway with the Docker compute driver" env = { OPENSHELL_E2E_DOCKER_GPU = "1", OPENSHELL_E2E_DOCKER_TEST = "gpu", OPENSHELL_E2E_DOCKER_FEATURES = "e2e-docker-gpu" } -run = "e2e/rust/e2e-docker.sh" +depends = ["e2e:conformance:build"] +run = "OPENSHELL_CONFORMANCE_BIN=\"${OPENSHELL_CONFORMANCE_BIN:-$PWD/target/debug/openshell-conformance}\" e2e/rust/e2e-docker.sh" ["e2e:openshift"] description = "Run OpenShift database-backend integration scenarios against a live cluster (requires oc CLI authenticated to an OpenShift cluster)"