Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .agents/skills/helm-dev-environment/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ When the named cluster already exists, the task starts any stopped containers an
same-named kubeconfig entries so a recreated load balancer's current API port takes effect.
Also applies the upstream agent-sandbox CRDs/controller (pinned via `AGENT_SANDBOX_VERSION`
in `tasks/scripts/helm-k3s-local.sh`, fetched from `github.com/kubernetes-sigs/agent-sandbox`
releases), enables its OTLP tracing on v0.5 and later, installs an OTLP trace
releases, checked against the checksums pinned in `e2e/support/install-agent-sandbox.sh`, and
kept in `~/.cache/openshell/agent-sandbox`), enables its OTLP tracing on v0.5 and later, installs an OTLP trace
collector and UI in the `observability` namespace,
and preloads the default sandbox image into k3d so the first sandbox create
does not wait on a large registry pull. Traefik is disabled at cluster creation time.
Expand Down
41 changes: 41 additions & 0 deletions .github/actions/setup-agent-sandbox-manifests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

name: Setup Agent Sandbox manifests
description: >-
Restore the pinned Agent Sandbox release manifests that
e2e/support/install-agent-sandbox.sh applies. Branch Checks and Branch E2E
never run on main, so Rust Cache saves them there for PRs to restore.

inputs:
save:
description: Download every pinned manifest and save the cache on a miss
required: false
default: "false"

runs:
using: composite
steps:
- name: Select Agent Sandbox manifest directory
shell: bash
run: | # zizmor: ignore[github-env] the value is fixed beneath the runner-controlled HOME
echo "AGENT_SANDBOX_MANIFEST_DIR=$HOME/.cache/openshell/agent-sandbox" >> "$GITHUB_ENV"

- name: Restore Agent Sandbox manifests
id: cache
uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
with:
path: ~/.cache/openshell/agent-sandbox
key: agent-sandbox-manifests-${{ hashFiles('e2e/support/install-agent-sandbox.sh') }}

- name: Download Agent Sandbox manifests
if: inputs.save == 'true' && steps.cache.outputs.cache-hit != 'true'
shell: bash
run: bash e2e/support/install-agent-sandbox.sh --download-only

- name: Save Agent Sandbox manifests
if: inputs.save == 'true' && steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
with:
path: ~/.cache/openshell/agent-sandbox
key: ${{ steps.cache.outputs.cache-primary-key }}
20 changes: 15 additions & 5 deletions .github/actions/setup-e2e-kind/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ runs:
with:
version: ${{ inputs.mise-version }}

- uses: ./.github/actions/setup-agent-sandbox-manifests

- name: Log in to GHCR
shell: bash
env:
Expand All @@ -62,13 +64,21 @@ runs:
YAML
echo "path=$config" >> "$GITHUB_OUTPUT"

# kind comes from mise (pinned in mise.lock) rather than a fresh download.
- name: Create kind cluster
uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # v1.14.0
with:
cluster_name: ${{ inputs.cluster-name }}
shell: bash
env:
CLUSTER_NAME: ${{ inputs.cluster-name }}
# Nodes cannot become Ready until the following CNI installation.
wait: ${{ inputs.enforce-network-policy == 'true' && '0s' || '120s' }}
config: ${{ steps.kind-config.outputs.path }}
WAIT: ${{ inputs.enforce-network-policy == 'true' && '0s' || '120s' }}
CONFIG: ${{ steps.kind-config.outputs.path }}
run: |
set -euo pipefail
args=(create cluster --name "$CLUSTER_NAME" --wait "$WAIT")
if [[ -n "$CONFIG" ]]; then
args+=(--config "$CONFIG")
fi
kind "${args[@]}"

- name: Install policy-enforcing CNI
if: inputs.enforce-network-policy == 'true'
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/rust-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,24 @@ jobs:
cargo nextest run --locked --config-file .config/nextest.toml --profile ci --manifest-path examples/supervisor-middleware-content-guard/Cargo.toml --no-run
cargo nextest run --locked --config-file .config/nextest.toml --profile ci --manifest-path tests/testkit/Cargo.toml --no-run

# Restored by the Kubernetes, Podman, and VM E2E jobs through setup-mise and
# setup-agent-sandbox-manifests, so PRs that don't change mise.lock or the
# pinned manifests don't download them from GitHub.
e2e-tools:
name: E2E tools cache (Linux X64)
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: ./.github/actions/setup-mise

- uses: ./.github/actions/setup-agent-sandbox-manifests
with:
save: "true"

# Restored by build-e2e-bundles in branch-e2e.yml.
e2e-bundles:
name: E2E suite bundles cache (x86_64-unknown-linux-musl)
Expand Down
2 changes: 1 addition & 1 deletion CI.md
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ Maintainers should add ready PRs to the queue rather than pressing a direct merg
| `.github/workflows/helm-lint.yml` | Helm chart validation. PRs skip lint jobs unless Helm inputs changed; merge groups always validate Helm because they represent the final integration state. |
| `.github/actions/setup-nix/action.yml` | Installs Nix and configures the OpenShell Cachix cache, using read-only cache access when no authentication token is available. |
| `.github/actions/setup-rust/action.yml` | Restores the Rust target and registry cache. Other branches can restore only their own caches and `main`'s, so per-binary release build caches are saved only on `main`. |
| `.github/workflows/rust-cache.yml` | Builds the Branch Checks test targets on each push to `main` to save the `rust-checks` cache that PRs and merge groups restore. Skips the build when the cache already matches. |
| `.github/workflows/rust-cache.yml` | Builds the Branch Checks test targets on each push to `main` to save the `rust-checks` cache that PRs and merge groups restore. Skips the build when the cache already matches. Also saves the mise tools and pinned Agent Sandbox manifests that E2E jobs restore, so those jobs download them from GitHub only when a PR changes them. |
| `.github/workflows/required-ci-gates.yml` | Posts required PR-head and merge-group statuses for gated CI workflows, including for fork PRs. This is what branch protection and merge queue should require. |
| `.github/workflows/review-readiness.yml` | Labels newly opened accepted-work PRs using the shared read-only acceptance library, including drafts; routes matching reviewers when a PR is ready and classified. |
| `.github/workflows/workflow-security.yml` | Runs informational Actionlint and High-severity Zizmor reports on GitHub-hosted runners. |
Expand Down
74 changes: 66 additions & 8 deletions e2e/support/install-agent-sandbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,74 @@

# Install the upstream Agent Sandbox CRDs and controller. Pass any kubectl
# context arguments (for example, --context kind-e2e) as script arguments.
#
# The release manifest is verified against the checksum pinned below and kept
# in AGENT_SANDBOX_MANIFEST_DIR. CI restores that directory from a cache saved
# on main (.github/workflows/rust-cache.yml), which runs this script with
# --download-only to fetch every pinned release.
set -euo pipefail

agent_sandbox_version="${AGENT_SANDBOX_VERSION:-v1.0.3}"
manifest_dir="${AGENT_SANDBOX_MANIFEST_DIR:-${XDG_CACHE_HOME:-${HOME}/.cache}/openshell/agent-sandbox}"

# Agent Sandbox renamed its core release manifest after v0.5.1. Keep the
# v1alpha1 compatibility lane on the asset published with that release.
case "${agent_sandbox_version}" in
v0.[0-4].*|v0.5.[01]) agent_sandbox_manifest="manifest.yaml" ;;
*) agent_sandbox_manifest="sandbox.yaml" ;;
esac
# Releases this repository tests, with the SHA-256 of their core manifest.
# Agent Sandbox renamed that manifest after v0.5.1.
pinned_versions=(v0.4.6 v0.5.0 v1.0.3)
release_manifest() {
case "$1" in
v0.4.6) echo "manifest.yaml db8424b2901cef57f71757b5ae5499eda0b6ef0dfd71a50dffeeb44326517967" ;;
v0.5.0) echo "manifest.yaml ccfe3649de8b33f0ee0ec635e2c7b40e1c468ad9fde6aac7c7379501327d9c4c" ;;
v1.0.3) echo "sandbox.yaml 725fafdabe6aac202a89dc57f1cfe0e2e92f3164c8c2bd343fffca52f7039d96" ;;
*)
echo "Agent Sandbox $1 has no pinned checksum; add it to $0" >&2
return 1
;;
esac
}

sha256_of() {
if command -v sha256sum >/dev/null 2>&1; then
sha256sum "$1" | cut -d' ' -f1
else
shasum -a 256 "$1" | cut -d' ' -f1
fi
}

# Print the path of the verified manifest for a release, downloading it if the
# directory doesn't hold a copy with the pinned checksum.
fetch_manifest() {
local version="$1" entry name sha256 path tmp
entry="$(release_manifest "${version}")" || return 1
read -r name sha256 <<< "${entry}"
path="${manifest_dir}/${version}/${name}"
if [ -f "${path}" ] && [ "$(sha256_of "${path}")" = "${sha256}" ]; then
echo "${path}"
return 0
fi

mkdir -p "${manifest_dir}/${version}" || return 1
tmp="$(mktemp "${path}.XXXXXX")" || return 1
echo "Downloading Agent Sandbox ${version} ${name}..." >&2
if ! curl -fsSL --output "${tmp}" \
"https://github.com/kubernetes-sigs/agent-sandbox/releases/download/${version}/${name}"; then
rm -f "${tmp}"
return 1
fi
if [ "$(sha256_of "${tmp}")" != "${sha256}" ]; then
echo "Agent Sandbox ${version} ${name} does not match its pinned checksum ${sha256}" >&2
rm -f "${tmp}"
return 1
fi
mv "${tmp}" "${path}" || return 1
echo "${path}"
}

if [ "${1:-}" = "--download-only" ]; then
for version in "${pinned_versions[@]}"; do
fetch_manifest "${version}" >/dev/null || exit 1
done
exit 0
fi

wait_for_agent_sandbox_crd() {
local deadline
Expand All @@ -37,9 +95,9 @@ wait_for_agent_sandbox_crd() {
return 1
}

manifest="$(fetch_manifest "${agent_sandbox_version}")" || exit 1
echo "Installing agent-sandbox CRDs and controller (${agent_sandbox_version})..."
agent_sandbox_base="https://github.com/kubernetes-sigs/agent-sandbox/releases/download/${agent_sandbox_version}"
kubectl "$@" apply -f "${agent_sandbox_base}/${agent_sandbox_manifest}"
kubectl "$@" apply -f "${manifest}"
wait_for_agent_sandbox_crd "$@"
kubectl "$@" -n agent-sandbox-system rollout status \
deployment/agent-sandbox-controller --timeout=300s
32 changes: 32 additions & 0 deletions mise.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ helm = { version = "4.2.0", version_prefix = "v" }
helm-docs = "1.14.2"
yq = "4.53.6"
skaffold = { version = "2.20.0", os = ["linux", "macos"], version_prefix = "v" }
# Creates the Kubernetes E2E cluster in CI (.github/actions/setup-e2e-kind).
kind = { version = "0.31.0", os = ["linux", "macos"], version_prefix = "v" }
# Keep k3d out of Linux CI images until upstream ships a release rebuilt with
# patched Go/container dependencies. Linux Kubernetes E2E uses kind or an
# externally provided cluster context.
Expand Down
23 changes: 14 additions & 9 deletions tests/tmachine/ansible/playbooks/k3s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
gather_facts: false
vars:
helm_version: 4.2.0
k3s_version: 1.33.13+k3s2
tasks:
- name: Wait for SSH
ansible.builtin.wait_for_connection:
Expand All @@ -21,12 +20,18 @@
state: present
update_cache: true

# get.k3s.io serves the latest script, so pin the one from the k3s_version
# release tag. Update the checksum whenever k3s_version changes.
- name: Download K3s installer
ansible.builtin.get_url:
url: "https://raw.githubusercontent.com/k3s-io/k3s/v{{ k3s_version | urlencode }}/install.sh"
checksum: sha256:9ca7930c31179d83bc13de20078fd8ad3e1ee00875b31f39a7e524ca4ef7d9de
# The host provides the K3s binary and the install script from the same
# release (`k3s_binary` and `k3s_installer`, pinned and checksummed in
# tests/tmachine/config.nix), so the script doesn't download anything.
- name: Copy K3s binary
ansible.builtin.copy:
src: "{{ k3s_binary }}"
dest: /usr/local/bin/k3s
mode: "0755"

- name: Copy K3s installer
ansible.builtin.copy:
src: "{{ k3s_installer }}"
dest: /tmp/install-k3s.sh
mode: "0755"

Expand All @@ -37,9 +42,9 @@
- server
- --disable=servicelb
- --disable=traefik
creates: /usr/local/bin/k3s
creates: /etc/systemd/system/k3s.service
environment:
INSTALL_K3S_VERSION: "v{{ k3s_version }}"
INSTALL_K3S_SKIP_DOWNLOAD: "true"

- name: Wait for K3s
ansible.builtin.command:
Expand Down
10 changes: 9 additions & 1 deletion tests/tmachine/ansible/playbooks/openshell-k3s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,22 @@
mode: "0600"
content: "{{ openshell_k3s_helm_values_overlay | default('{}') }}"

# The host provides the release manifest (`agent_sandbox_manifest`, pinned
# and checksummed in tests/tmachine/config.nix).
- name: Copy Agent Sandbox manifest
ansible.builtin.copy:
src: "{{ agent_sandbox_manifest }}"
dest: /var/lib/openshell/artifacts/agent-sandbox.yaml
mode: "0600"

- name: Install Agent Sandbox
ansible.builtin.command:
argv:
- /usr/local/bin/k3s
- kubectl
- apply
- --filename
- "https://github.com/kubernetes-sigs/agent-sandbox/releases/download/v{{ agent_sandbox_version }}/manifest.yaml"
- /var/lib/openshell/artifacts/agent-sandbox.yaml

- name: Wait for Agent Sandbox CRD
ansible.builtin.command:
Expand Down
Loading
Loading