Skip to content
Merged
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
50 changes: 37 additions & 13 deletions .github/workflows/release-auto-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ name: Release Auto-Tag

on:
workflow_dispatch: {}
# schedule:
# - cron: "0 14 * * 1-5" # 7 AM PDT, weekdays only
schedule:
- cron: "0 14 * * 1-5"
timezone: "Europe/Zurich"

permissions:
contents: write
Expand All @@ -19,17 +20,40 @@ concurrency:
jobs:
create-tag:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: main
fetch-depth: 0

- name: Determine next patch version
- name: Determine next pre-release version
id: version
run: |
latest=$(git tag -l 'v*.*.*' --sort=-v:refname | head -1)
if [ -z "$latest" ]; then
echo "::error::No existing v*.*.* tags found"
set -euo pipefail
tags=$(git tag -l)
latest=$(printf '%s\n' "$tags" | \
{ grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-pre\.[1-9][0-9]*)?$' || true; } | \
sort -V | tail -1)
if [[ ! "$latest" =~ ^(v[0-9]+\.[0-9]+\.[0-9]+)-pre\.([1-9][0-9]*)$ ]]; then
echo "No active pre-release series — skipping tag creation"
echo "skip=true" >> "$GITHUB_OUTPUT"
exit 0
fi
base=${BASH_REMATCH[1]}
number=${BASH_REMATCH[2]}
if ! git show-ref --verify --quiet "refs/tags/${base}-pre.1"; then
echo "No ${base}-pre.1 seed — skipping tag creation"
echo "skip=true" >> "$GITHUB_OUTPUT"
exit 0
fi
if git show-ref --verify --quiet "refs/tags/${base}"; then
echo "$base is already stable — skipping tag creation"
echo "skip=true" >> "$GITHUB_OUTPUT"
exit 0
fi
if ! git merge-base --is-ancestor "$latest" HEAD; then
echo "::error::Latest pre-release $latest is not an ancestor of main"
exit 1
fi
echo "Latest tag: $latest"
Expand All @@ -43,10 +67,7 @@ jobs:
exit 0
fi

major=$(echo "$latest" | sed 's/^v//' | cut -d. -f1)
minor=$(echo "$latest" | sed 's/^v//' | cut -d. -f2)
patch=$(echo "$latest" | sed 's/^v//' | cut -d. -f3)
next="v${major}.${minor}.$((patch + 1))"
next="${base}-pre.$((number + 1))"

if git tag -l "$next" | grep -q .; then
echo "::error::Tag $next already exists"
Expand All @@ -58,15 +79,18 @@ jobs:

- name: Create and push tag
if: steps.version.outputs.skip != 'true'
env:
NEXT_TAG: ${{ steps.version.outputs.next }}
run: |
git tag ${{ steps.version.outputs.next }}
git push origin ${{ steps.version.outputs.next }}
git tag "$NEXT_TAG"
git push origin "refs/tags/$NEXT_TAG"

- name: Trigger Release Tag workflow
if: steps.version.outputs.skip != 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NEXT_TAG: ${{ steps.version.outputs.next }}
run: |
gh workflow run release-tag.yml \
--ref main \
-f tag=${{ steps.version.outputs.next }}
-f tag="$NEXT_TAG"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ temp/
*.tmp
e2e/gpu/images/.build/

# Ansible Galaxy roles
/tests/ansible/.roles/

# Secrets/credentials (should never be committed)
*.pem
*.key
Expand Down
35 changes: 31 additions & 4 deletions architecture/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ The Nix test guest harness under `nix/test-guest` boots native-architecture clou
through QEMU for package, release, and E2E validation. A prepared cache entry is
captured after the exact ordered Ansible configuration list and before
test-specific packages, copied binaries, forwarded ports, or commands.
On macOS, the test guest and tmachine paths use the same pinned QEMU and OVMF
package set so the hypervisor and firmware remain compatible.

Prepared disks are flattened, sanitized QCOW2 images. The local cache keeps them
read-only and each test receives a fresh writable overlay and cloud-init
Expand All @@ -242,6 +244,23 @@ CLI conformance runs after target provisioning and operates only through the
configured OpenShell CLI. The smoke scenario verifies the black-box sandbox
lifecycle by creating, inspecting, executing in, and deleting a sandbox.

The `tests/tmachine` setup and installation caches include a digest of the
entire directory containing `ANSIBLE_CONFIG`, including local roles, task
includes, templates, inventory, and requirements. The digest uses sorted
relative paths, file contents, and executable permissions; source symlinks
are unsupported. Both keys also retain the ordered playbook paths and contents,
their base disk contents, and whether Galaxy is enabled; installation keys
include named binary inputs. The top-level `.roles` directory is excluded:
Galaxy release pins in `requirements.yaml` are treated as immutable, including
any transitive dependency pins. Cache misses with Galaxy enabled reinstall
the required roles and their dependencies before running playbooks.

The `tests/artifacts.nix` helpers build the CLI, conformance CLI, and sandbox
with musl, and the gateway and supervisor with GNU. Image assembly stages
the gateway, sandbox, and supervisor as separate binaries for their respective
Dockerfiles. The Ubuntu Docker and Fedora Podman scenarios import both local
runtime images and configure the gateway to use them.

## Python Wheel Packaging

The generated protobuf/gRPC stubs under `python/openshell/_proto/` are gitignored
Expand Down Expand Up @@ -420,10 +439,18 @@ job republishes the analysis job's outcome as the
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.
workflow only reports on candidates that already exist. Gating stable promotion
on qualification results remains proposed in
[RFC 0014](../rfc/0014-release-stability/release-qualification.md).

`release-auto-tag.yml` runs at 14:00 Europe/Zurich on weekdays (including daylight
saving time changes) and supports manual dispatch. Maintainers start weekday
pre-release publishing by tagging the initial `vX.Y.Z-pre.1` release candidate.
The workflow increments the highest release series' pre-release number on `main`
only when that seed exists, its stable tag does not exist, and new commits are
available. It never chooses a minor or patch version or creates the initial seed.
After pushing the tag, it explicitly dispatches `release-tag.yml` to build the
candidate.

See `CI.md` for the contributor workflow, labels, and maintainer merge-queue workflow.

Expand Down
16 changes: 16 additions & 0 deletions crates/openshell-conformance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,22 @@ impl OpenShellRunner {
))
}

/// Uses the candidate CLI selected by the archive test runner.
///
/// Archive-based tests set `OPENSHELL_BIN` to the candidate artifact
/// installed in the guest. Requiring it here prevents a test from silently
/// resolving a different `openshell` binary from `PATH`.
pub fn from_env(scenario: &str) -> Result<Self, RunnerError> {
let binary = std::env::var_os("OPENSHELL_BIN")
.map(PathBuf::from)
.ok_or_else(|| {
RunnerError::BinaryUnavailable(
"OPENSHELL_BIN must name the candidate openshell CLI".to_string(),
)
})?;
Self::with_binary(binary, scenario)
}

/// Creates a runner with an injected executor. This is useful for harness tests.
pub fn with_executor(cli: Arc<dyn CliExecutor>, scenario: &str) -> Self {
Self {
Expand Down
63 changes: 57 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
overlays = [ (import rust-overlay) ];
};
testGuestPkgs = import nixpkgs-test-guest { inherit system; };
tmachineRuntimePkgs = if pkgs.stdenv.hostPlatform.isDarwin then testGuestPkgs else pkgs;
commonDevShellPackages = with pkgs; [
actionlint
cargo-auditable
Expand All @@ -67,6 +68,10 @@
zizmor
zstd
];
commonDevShell = {
packages = [ rustToolchain ] ++ commonDevShellPackages;
env = pkgs.lib.foldl' (env: toolchain: env // toolchain.env) { } (builtins.attrValues toolchains);
};
treefmtEval = treefmt-nix.lib.evalModule pkgs {
projectRootFile = "flake.nix";
programs.nixfmt.enable = true;
Expand Down Expand Up @@ -114,17 +119,63 @@
qemuPkgs = testGuestPkgs;
firmwarePkgs = testGuestPkgs;
};
testMachines = import ./tests/config.nix {
inherit pkgs toolchains;
qemuPkgs = tmachineRuntimePkgs;
firmwarePkgs = tmachineRuntimePkgs;
};
artifacts = pkgs.callPackage ./tests/artifacts.nix { inherit rustToolchain toolchains; };
in
{
apps.test-guest = testGuest.app;
apps.test-guest-cache = testGuest.cacheApp;
apps = {
build-artifacts = {
type = "app";
program = "${artifacts.all}/bin/build-artifacts";
};
build-artifacts-binaries = {
type = "app";
program = "${artifacts.binaries}/bin/build-artifacts-binaries";
};
build-artifacts-test-archives = {
type = "app";
program = "${artifacts.conformanceCliArchive}/bin/build-openshell-conformance-test-archive";
};
build-artifacts-helm = {
type = "app";
program = "${artifacts.helm}/bin/build-artifacts-helm";
};
build-artifacts-images = {
type = "app";
program = "${artifacts.images}/bin/build-artifacts-images";
};
test-guest = testGuest.app;
test-guest-cache = testGuest.cacheApp;
};

packages.vm-runtime = vmRuntime;
packages = {
vm-runtime = vmRuntime;
tmachine = testMachines.package;
tmachine-config = testMachines.config;
tmachine-unwrapped = testMachines.unwrapped;
};

devShells.default = pkgs.mkShellNoCC {
packages = [ rustToolchain ] ++ commonDevShellPackages;
devShells = {
default = pkgs.mkShellNoCC commonDevShell;

env = pkgs.lib.foldl' (env: toolchain: env // toolchain.env) { } (builtins.attrValues toolchains);
testing = pkgs.mkShellNoCC (
commonDevShell
// {
packages = commonDevShell.packages ++ [
pkgs.ansible
pkgs.sshpass
testMachines.package
];

shellHook = ''
export ANSIBLE_CONFIG="$(git rev-parse --show-toplevel)/tests/ansible/ansible.cfg"
'';
}
);
};

formatter = treefmtEval.config.build.wrapper;
Expand Down
16 changes: 16 additions & 0 deletions tests/ansible/ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

[defaults]
inventory = inventory.ini
host_key_checking = False
roles_path = .roles:roles
callbacks_enabled = ansible.posix.profile_tasks

[callback_profile_tasks]
summary_only = true
task_output_limit = 20
sort_order = descending

[ssh_connection]
ssh_common_args = -o UserKnownHostsFile=/dev/null
5 changes: 5 additions & 0 deletions tests/ansible/inventory.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

[machines]
tmachine ansible_host=127.0.0.1 ansible_port=2222 ansible_user=tmachine ansible_password=tmachine ansible_python_interpreter=/usr/bin/python3
19 changes: 19 additions & 0 deletions tests/ansible/playbooks/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

---
- name: Docker
hosts: all
gather_facts: false
vars:
docker_users:
- tmachine
pre_tasks:
- name: Wait for SSH
ansible.builtin.wait_for_connection:

- name: Gather facts
ansible.builtin.setup:
roles:
- role: geerlingguy.docker
become: true
9 changes: 9 additions & 0 deletions tests/ansible/playbooks/gateway.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

---
- name: Configure OpenShell gateway
hosts: all
gather_facts: false
roles:
- openshell_gateway
52 changes: 52 additions & 0 deletions tests/ansible/playbooks/nextest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

---
- name: Install cargo-nextest
hosts: all
become: true
gather_facts: false
vars:
nextest_version: 0.9.143
nextest_arches:
x86_64:
triple: x86_64-unknown-linux-musl
sha256: 6d891c18105ec2d33f6e441a4f92b7ccab47ba263e22055c8bb66884243f3389
aarch64:
triple: aarch64-unknown-linux-musl
sha256: 0560ce0ce017f368c54b5db86588370fc03b470985490fa81200e62a657dda05
tasks:
- name: Wait for SSH
ansible.builtin.wait_for_connection:

- name: Gather guest architecture
ansible.builtin.setup:
filter:
- ansible_architecture

- name: Select cargo-nextest release for guest architecture
ansible.builtin.set_fact:
nextest_release: "{{ nextest_arches[ansible_facts.architecture] | default({}) }}"

- name: Validate guest architecture
ansible.builtin.assert:
that: nextest_release | length > 0
fail_msg: "cargo-nextest is unsupported on {{ ansible_facts.architecture }}"

- name: Download cargo-nextest
ansible.builtin.get_url:
url: "https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-{{ nextest_version }}/cargo-nextest-{{ nextest_version }}-{{ nextest_release.triple }}.tar.gz"
dest: /tmp/cargo-nextest.tar.gz
checksum: "sha256:{{ nextest_release.sha256 }}"
mode: "0600"

- name: Install cargo-nextest
ansible.builtin.unarchive:
src: /tmp/cargo-nextest.tar.gz
dest: /usr/local/bin
remote_src: true
creates: /usr/local/bin/cargo-nextest

- name: Verify cargo-nextest
ansible.builtin.command: cargo-nextest --version
changed_when: false
24 changes: 24 additions & 0 deletions tests/ansible/playbooks/openshell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

---
- name: Install OpenShell
hosts: all
gather_facts: false
tasks:
- name: Wait for SSH
ansible.builtin.wait_for_connection:

- name: Install OpenShell CLI
become: true
ansible.builtin.copy:
src: "{{ openshell_cli_binary }}"
dest: /usr/local/bin/openshell
mode: "0755"

- name: Install OpenShell gateway
become: true
ansible.builtin.copy:
src: "{{ openshell_gateway_binary }}"
dest: /usr/local/bin/openshell-gateway
mode: "0755"
Loading
Loading