Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

ci: remove Fleet-only workflows ahead of the 16 Oct Cloud Fleets shutdown (#4938)

Francesco Bonacci62c1c603306b
diff --git a/.github/scripts/tests/test_periodic_cua_sandbox_live.py b/.github/scripts/tests/test_periodic_cua_sandbox_live.py
deleted file mode 100644
index f8f3db2245..0000000000
--- a/.github/scripts/tests/test_periodic_cua_sandbox_live.py
+++ /dev/null
@@ -1,376 +0,0 @@
-"""Contract tests for the periodic Cua Sandbox live Fleet workflow."""
-
-import json
-import os
-import shutil
-import subprocess
-import sys
-import tempfile
-import unittest
-from pathlib import Path
-
-import yaml
-
-REPO_ROOT = Path(__file__).resolve().parents[3]
-WORKFLOW = REPO_ROOT / ".github/workflows/periodic-cua-sandbox-live.yml"
-SANDBOX_ROOT = REPO_ROOT / "libs/python/cua-sandbox"
-LIVE_TEST = SANDBOX_ROOT / "tests/live/test_fleet_ephemeral.py"
-POOL_LIVE_TEST = SANDBOX_ROOT / "tests/live/test_fleet_pool_persistent.py"
-
-
-class TestPeriodicCuaSandboxLive(unittest.TestCase):
- @staticmethod
- def workflow() -> dict[str, object]:
- # BaseLoader keeps GitHub Actions' `on` key as a string.
- return yaml.load(WORKFLOW.read_text(), Loader=yaml.BaseLoader)
-
- @staticmethod
- def steps_by_name(job: dict[str, object]) -> dict[str, dict[str, object]]:
- return {
- step["name"]: step for step in job["steps"] if isinstance(step, dict) and "name" in step
- }
-
- def run_prepare_matrix(
- self, event_name: str, requested_lane: str, requested_suite: str = ""
- ) -> dict[str, object]:
- prepare_script = self.workflow()["jobs"]["prepare"]["steps"][0]["run"]
- with tempfile.TemporaryDirectory() as temporary_directory:
- github_output = Path(temporary_directory) / "github-output"
- environment = os.environ | {
- "EVENT_NAME": event_name,
- "REQUESTED_LANE": requested_lane,
- "REQUESTED_SUITE": requested_suite,
- "GITHUB_OUTPUT": str(github_output),
- }
- subprocess.run(
- ["bash", "-c", prepare_script],
- env=environment,
- check=True,
- capture_output=True,
- text=True,
- )
- outputs = dict(
- line.split("=", 1) for line in github_output.read_text().splitlines() if "=" in line
- )
- return json.loads(outputs["matrix"])
-
- def test_trigger_and_lane_structure(self) -> None:
- workflow = self.workflow()
- triggers = workflow["on"]
- self.assertEqual(triggers["schedule"], [{"cron": "7/15 * * * *"}])
- self.assertEqual(triggers["push"]["branches"], ["main"])
- self.assertEqual(
- triggers["push"]["paths"],
- [
- "libs/python/cua-sandbox/**",
- "libs/fleet/**",
- ".github/workflows/periodic-cua-sandbox-live.yml",
- ".github/scripts/tests/test_periodic_cua_sandbox_live.py",
- ],
- )
- inputs = triggers["workflow_dispatch"]["inputs"]
- self.assertEqual(
- inputs["lane"]["options"],
- ["both", "main-source", "published-package"],
- )
- self.assertEqual(inputs["suite"]["options"], ["both", "ephemeral", "pool"])
- self.assertEqual(inputs["suite"]["default"], "both")
- self.assertEqual(inputs["force_failure"]["type"], "boolean")
-
- prepare = workflow["jobs"]["prepare"]
- self.assertEqual(prepare["outputs"]["matrix"], "${{ steps.matrix.outputs.matrix }}")
- prepare_script = prepare["steps"][0]["run"]
- self.assertIn('[[ "$EVENT_NAME" == "push" ]]', prepare_script)
- self.assertIn('{"lane":"main-source","suite":"ephemeral"}', prepare_script)
- self.assertIn('lanes=("main-source" "published-package")', prepare_script)
- self.assertIn('suites=("ephemeral" "pool")', prepare_script)
-
- def test_jobs_only_run_in_the_upstream_repository(self) -> None:
- workflow = self.workflow()
- for job_name in ("prepare", "live"):
- with self.subTest(job=job_name):
- self.assertEqual(
- workflow["jobs"][job_name]["if"],
- "github.repository == 'trycua/cua'",
- )
-
- def test_prepare_matrix_selects_lanes_and_suites_for_each_trigger(self) -> None:
- main_ephemeral = {"lane": "main-source", "suite": "ephemeral"}
- main_pool = {"lane": "main-source", "suite": "pool"}
- published_ephemeral = {"lane": "published-package", "suite": "ephemeral"}
- published_pool = {"lane": "published-package", "suite": "pool"}
- all_lanes_and_suites = {
- "include": [main_ephemeral, main_pool, published_ephemeral, published_pool]
- }
- expected_matrices = {
- ("push", "", ""): {"include": [main_ephemeral]},
- ("push", "both", "both"): {"include": [main_ephemeral]},
- ("push", "published-package", "pool"): {"include": [main_ephemeral]},
- ("schedule", "", ""): all_lanes_and_suites,
- ("schedule", "main-source", "pool"): all_lanes_and_suites,
- ("workflow_dispatch", "both", "both"): all_lanes_and_suites,
- ("workflow_dispatch", "main-source", ""): {"include": [main_ephemeral, main_pool]},
- ("workflow_dispatch", "main-source", "both"): {"include": [main_ephemeral, main_pool]},
- ("workflow_dispatch", "main-source", "pool"): {"include": [main_pool]},
- ("workflow_dispatch", "both", "pool"): {"include": [main_pool, published_pool]},
- ("workflow_dispatch", "published-package", "ephemeral"): {
- "include": [published_ephemeral]
- },
- }
-
- for inputs, expected_matrix in expected_matrices.items():
- with self.subTest(
- event_name=inputs[0], requested_lane=inputs[1], requested_suite=inputs[2]
- ):
- self.assertEqual(self.run_prepare_matrix(*inputs), expected_matrix)
-
- def test_live_job_security_and_execution_structure(self) -> None:
- workflow = self.workflow()
- live = workflow["jobs"]["live"]
- steps = self.steps_by_name(live)
-
- self.assertEqual(live["timeout-minutes"], "25")
- self.assertEqual(
- live["strategy"]["matrix"],
- "${{ fromJSON(needs.prepare.outputs.matrix) }}",
- )
- self.assertEqual(
- live["concurrency"]["group"],
- "periodic-cua-sandbox-live-${{ github.event_name }}-${{ matrix.lane }}-${{ matrix.suite }}",
- )
- self.assertEqual(
- live["concurrency"]["cancel-in-progress"],
- "${{ github.event_name == 'schedule' }}",
- )
- expected_oauth_env = {
- "CUA_CLIENT_ID": "${{ secrets.CUA_CLIENT_ID }}",
- "CUA_CLIENT_SECRET": "${{ secrets.CUA_CLIENT_SECRET }}",
- }
- self.assertNotIn("CUA_CLIENT_ID", live["env"])
- self.assertNotIn("CUA_CLIENT_SECRET", live["env"])
- self.assertNotIn("CUA_API_KEY", live["env"])
- oauth_steps = {
- step["name"]: step["env"]
- for step in live["steps"]
- if "CUA_CLIENT_ID" in step.get("env", {}) or "CUA_CLIENT_SECRET" in step.get("env", {})
- }
- self.assertEqual(
- oauth_steps,
- {
- "Check Fleet OAuth credentials": expected_oauth_env,
- "Run live Fleet smoke": expected_oauth_env,
- "Run live Fleet pool smoke": expected_oauth_env,
- },
- )
- self.assertEqual(live["env"]["CUA_LIVE_E2E_EVENT"], "${{ github.event_name }}")
- self.assertEqual(live["env"]["CUA_LIVE_E2E_SUITE"], "${{ matrix.suite }}")
- self.assertEqual(live["env"]["CUA_LIVE_E2E_SIGNED_URLS"], "true")
- self.assertEqual(
- live["env"]["CUA_LIVE_E2E_NAMESPACE"],
- "cua-live-${{ matrix.lane }}-${{ github.event_name == 'workflow_dispatch' && github.run_id || github.event_name }}",
- )
- self.assertEqual(
- live["env"]["CUA_LIVE_E2E_POOL_WARM_NAMESPACE"],
- "cua-live-pool-warm-${{ matrix.lane }}-${{ github.event_name == 'workflow_dispatch' && 'manual' || github.event_name }}",
- )
- self.assertEqual(
- live["env"]["CUA_LIVE_E2E_POOL_COLD_NAMESPACE"],
- "cua-live-pool-cold-${{ matrix.lane }}-${{ github.event_name == 'workflow_dispatch' && 'manual' || github.event_name }}",
- )
- self.assertIn("github.run_id", live["env"]["CUA_LIVE_E2E_NAMESPACE"])
- for namespace_env in (
- "CUA_LIVE_E2E_POOL_WARM_NAMESPACE",
- "CUA_LIVE_E2E_POOL_COLD_NAMESPACE",
- ):
- self.assertNotIn("github.run_id", live["env"][namespace_env])
- for namespace_env in (
- "CUA_LIVE_E2E_NAMESPACE",
- "CUA_LIVE_E2E_POOL_WARM_NAMESPACE",
- "CUA_LIVE_E2E_POOL_COLD_NAMESPACE",
- ):
- self.assertNotIn("github.run_attempt", live["env"][namespace_env])
-
- step_names = [step["name"] for step in live["steps"]]
- self.assertLess(
- step_names.index("Checkout main"),
- step_names.index("Record checked out source SHA"),
- )
-
- checkout = steps["Checkout main"]
- self.assertEqual(
- checkout["uses"],
- "actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5",
- )
- self.assertEqual(
- checkout["with"]["ref"],
- "${{ github.event_name == 'push' && github.sha || github.ref }}",
- )
- self.assertEqual(
- steps["Set up Python"]["uses"],
- "actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065",
- )
- self.assertIn("-e libs/python/cua-sandbox", steps["Install main source"]["run"])
- self.assertIn("--upgrade cua-sandbox", steps["Install published package"]["run"])
-
- preflight_step = steps["Check Fleet OAuth credentials"]
- self.assertEqual(preflight_step["env"], expected_oauth_env)
- preflight = preflight_step["run"]
- self.assertIn("CUA_CLIENT_ID", preflight)
- self.assertIn("CUA_CLIENT_SECRET", preflight)
- self.assertIn("exit 1", preflight)
-
- source_sha = steps["Record checked out source SHA"]
- self.assertEqual(source_sha["id"], "source_sha")
- self.assertIn("git rev-parse HEAD", source_sha["run"])
- self.assertIn("source_sha=", source_sha["run"])
- self.assertIn("GITHUB_OUTPUT", source_sha["run"])
- self.assertIn("CUA_LIVE_E2E_SOURCE_SHA", source_sha["run"])
- self.assertIn("GITHUB_ENV", source_sha["run"])
-
- isolated_suite = steps["Prepare isolated live test suite"]["run"]
- self.assertIn("CUA_LIVE_E2E_TEST_ROOT", isolated_suite)
- self.assertIn("tests/live", isolated_suite)
- live_step = steps["Run live Fleet smoke"]
- self.assertEqual(live_step["env"], expected_oauth_env)
- self.assertIn("matrix.suite == 'ephemeral'", live_step["if"])
- live_run = live_step["run"]
- self.assertIn("$CUA_LIVE_E2E_TEST_ROOT/tests/live/test_fleet_ephemeral.py", live_run)
- self.assertNotIn("libs/python/cua-sandbox/tests/live", live_run)
- self.assertIn('PYTHONPATH="$CUA_LIVE_E2E_TEST_ROOT', live_run)
- pool_step = steps["Run live Fleet pool smoke"]
- self.assertEqual(pool_step["env"], expected_oauth_env)
- self.assertIn("matrix.suite == 'pool'", pool_step["if"])
- self.assertIn("force_failure", pool_step["if"])
- pool_run = pool_step["run"]
- self.assertIn("$CUA_LIVE_E2E_TEST_ROOT/tests/live/test_fleet_pool_persistent.py", pool_run)
- self.assertNotIn("libs/python/cua-sandbox/tests/live", pool_run)
- self.assertIn('PYTHONPATH="$CUA_LIVE_E2E_TEST_ROOT', pool_run)
-
- def test_failure_diagnostics_alerting_and_pinned_actions(self) -> None:
- workflow = self.workflow()
- live = workflow["jobs"]["live"]
- steps = self.steps_by_name(live)
-
- for step in live["steps"]:
- if "uses" in step:
- self.assertRegex(step["uses"], r"^[^@]+@[0-9a-f]{40}$")
- self.assertEqual(
- steps["Upload failure diagnostics"]["uses"],
- "actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08",
- )
- self.assertEqual(steps["Upload failure diagnostics"]["if"], "failure()")
- self.assertEqual(steps["Upload failure diagnostics"]["with"]["retention-days"], "7")
- self.assertEqual(
- steps["Upload failure diagnostics"]["with"]["name"],
- "cua-sandbox-live-${{ matrix.lane }}-${{ matrix.suite }}"
- "-${{ github.run_id }}-${{ github.run_attempt }}",
- )
-
- controlled_summary = steps["Write controlled failure diagnostics"]
- self.assertEqual(
- controlled_summary["if"],
- "github.event_name == 'workflow_dispatch' && inputs.force_failure",
- )
- self.assertIn("summary.json", controlled_summary["run"])
- self.assertIn("ControlledFailure", controlled_summary["run"])
- self.assertIn('os.environ["CUA_LIVE_E2E_SOURCE_SHA"]', controlled_summary["run"])
- self.assertIn('os.environ["CUA_LIVE_E2E_SUITE"]', controlled_summary["run"])
- self.assertNotIn('os.environ.get("GITHUB_SHA")', controlled_summary["run"])
- self.assertEqual(
- steps["Controlled alert test failure"]["if"],
- "github.event_name == 'workflow_dispatch' && inputs.force_failure",
- )
-
- versions = steps["Record installed versions"]
- self.assertIn("GITHUB_OUTPUT", versions["run"])
- self.assertNotIn("steps.versions.outputs", versions["run"])
-
- alert = steps["Alert Alertmanager"]
- self.assertEqual(alert["if"], "failure()")
- self.assertIn("https://am.cua.ai/api/v2/alerts", alert["run"])
- self.assertIn("PeriodicCuaSandboxLiveE2EFailed", alert["run"])
- self.assertIn('"lane": "${{ matrix.lane }}"', alert["run"])
- self.assertIn('"suite": "${{ matrix.suite }}"', alert["run"])
- self.assertIn("${{ steps.versions.outputs.sandbox }}", alert["run"])
- self.assertIn("${{ steps.source_sha.outputs.source_sha }}", alert["run"])
- self.assertNotIn('"source_sha": "${{ github.sha }}"', alert["run"])
-
- def test_cleanup_is_claim_only_and_inventory_is_diagnostic(self) -> None:
- workflow = WORKFLOW.read_text()
- live_test = LIVE_TEST.read_text()
-
- self.assertNotIn("cleanup_namespace", workflow)
- self.assertNotIn("delete_namespace", workflow)
- self.assertNotIn("Emergency namespace cleanup", workflow)
- self.assertIn("Sandbox.ephemeral", live_test)
- self.assertNotIn("wait_namespace_absent", live_test)
- self.assertNotIn("namespace_leak", live_test)
- self.assertIn("wait_claims_absent", live_test)
- self.assertIn("claim_leak", live_test)
- self.assertIn("persistent_resources", live_test)
- self.assertIn("unexpected_inventory", live_test)
- self.assertIn("module_origins", live_test)
- self.assertIn("cua_sandbox", live_test)
-
- def test_pool_suite_is_claim_only_and_pool_is_persistent(self) -> None:
- workflow = WORKFLOW.read_text()
- pool_test = POOL_LIVE_TEST.read_text()
-
- self.assertIn("Run live Fleet pool smoke", workflow)
- self.assertIn("Sandbox.ephemeral", pool_test)
- self.assertIn("Pool.apply", pool_test)
- self.assertIn(
- "WarmPoolAutoscaling(min_pool_size=0, initial_pool_size=0, max_pool_size=1)",
- pool_test,
- )
- self.assertIn("wait_claims_absent", pool_test)
- self.assertIn("claim_leak", pool_test)
- self.assertIn("persistent_resources", pool_test)
- self.assertIn("unexpected_inventory", pool_test)
- self.assertIn("module_origins", pool_test)
- self.assertIn("pool_pre_existed", pool_test)
- self.assertIn("is_pool_missing_error", pool_test)
- self.assertNotIn("pool.delete(", pool_test)
- self.assertNotIn("delete_pool", pool_test)
- self.assertNotIn("delete_namespace", pool_test)
- self.assertNotIn("keep_pool", pool_test)
-
- def test_isolated_suite_cannot_import_checkout_cua_sandbox(self) -> None:
- with tempfile.TemporaryDirectory() as temporary_directory:
- temporary_root = Path(temporary_directory)
- suite_root = temporary_root / "live-suite"
- copied_live = suite_root / "tests/live"
- copied_live.mkdir(parents=True)
- shutil.copy2(SANDBOX_ROOT / "tests/__init__.py", suite_root / "tests")
- shutil.copy2(SANDBOX_ROOT / "tests/live/__init__.py", copied_live)
-
- installed_root = temporary_root / "installed"
- installed_package = installed_root / "cua_sandbox"
- installed_package.mkdir(parents=True)
- (installed_package / "__init__.py").write_text("MARKER = 'published-wheel'\n")
- probe = copied_live / "import_origin_probe.py"
- probe.write_text(
- "import cua_sandbox\n"
- "from pathlib import Path\n"
- "print(Path(cua_sandbox.__file__).resolve())\n"
- )
-
- environment = os.environ | {
- "PYTHONPATH": os.pathsep.join((str(suite_root), str(installed_root)))
- }
- result = subprocess.run(
- [sys.executable, str(probe)],
- cwd=REPO_ROOT,
- env=environment,
- check=True,
- capture_output=True,
- text=True,
- )
-
- origin = Path(result.stdout.strip()).resolve()
- self.assertEqual(origin, (installed_package / "__init__.py").resolve())
- self.assertNotIn(SANDBOX_ROOT.resolve(), origin.parents)
-
-
-if __name__ == "__main__":
- unittest.main()
diff --git a/.github/workflows/ci-py-cli-fleets-wif-smoke.yml b/.github/workflows/ci-py-cli-fleets-wif-smoke.yml
deleted file mode 100644
index dd87503c82..0000000000
--- a/.github/workflows/ci-py-cli-fleets-wif-smoke.yml
+++ /dev/null
@@ -1,93 +0,0 @@
-name: "CI: cua CLI Fleets WIF smoke"
-
-# Daily end-to-end check of the Rust `cua` CLI against Fleet with GitHub
-# workload identity: mint a GitHub OIDC token, wake the smoke pool, claim a
-# sandbox, run a command through cua-spacesd, then release the claim and
-# scale the pool back to zero. (The file name is kept from the former
-# Python CLI so the schedule and history carry over.)
-
-on:
- schedule:
- - cron: "23 8 * * *"
- workflow_dispatch:
-
-permissions:
- contents: read
- id-token: write
-
-concurrency:
- group: cua-cli-fleets-wif-smoke
- cancel-in-progress: false
-
-env:
- # Cua programs and packages run here never send usage telemetry.
- CUA_TELEMETRY: "0"
- DO_NOT_TRACK: "1"
-
-jobs:
- smoke:
- runs-on: ubuntu-latest
- timeout-minutes: 45
- steps:
- - name: Check out Cua
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
-
- - name: Install protoc
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
- with:
- version: "29.x"
- repo-token: ${{ secrets.GITHUB_TOKEN }}
-
- - uses: dtolnay/[email protected]
-
- - uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2
- with:
- workspaces: libs/cua
- key: cua-cli-wif-smoke
-
- - name: Build the cua CLI
- working-directory: libs/cua
- env:
- CARGO_BUILD_JOBS: "4"
- run: |
- cargo build --locked --release -p cua-cli
- echo "$PWD/target/release" >> "$GITHUB_PATH"
-
- - name: Claim, execute, and release a Fleet sandbox
- shell: bash
- env:
- # Hermetic CLI state for this job; never a developer keychain.
- CUA_HOME: ${{ runner.temp }}/cua-home
- CUA_CREDENTIAL_STORE: file
- CUA_NO_BROWSER: "1"
- run: |
- set -euo pipefail
- cua --version
- pool_name="cua-cli-wif-smoke"
- claim_name="wif-smoke-$(tr -d '-' < /proc/sys/kernel/random/uuid | cut -c1-20)"
- token="$(cua wif-token github)"
- export FLEETS_TOKEN="$token"
-
- cleanup() {
- status=$?
- trap - EXIT
- set +e
- cua --embedded sb delete "$claim_name" --force
- delete_status=$?
- cua --embedded sb suspend "$pool_name"
- suspend_status=$?
- unset FLEETS_TOKEN token
- if [ "$status" -eq 0 ] && [ "$delete_status" -ne 0 ]; then
- status=$delete_status
- fi
- if [ "$status" -eq 0 ] && [ "$suspend_status" -ne 0 ]; then
- status=$suspend_status
- fi
- exit "$status"
- }
- trap cleanup EXIT
-
- cua --embedded auth whoami
- cua --embedded sb resume "$pool_name"
- cua --embedded sb launch --name "$claim_name" --pool "$pool_name"
- cua --embedded sb exec "$claim_name" "uname -a && id && pwd"
diff --git a/.github/workflows/ci-test-scripts.yml b/.github/workflows/ci-test-scripts.yml
index bd98afd6f2..ad4e360428 100644
--- a/.github/workflows/ci-test-scripts.yml
+++ b/.github/workflows/ci-test-scripts.yml
@@ -38,7 +38,6 @@ on:
- "apps/cua-spaces-macos/Support/Info.plist"
- "apps/cua-spaces-desktop/package.json"
- ".github/workflows/ci-test-scripts.yml"
- - ".github/workflows/periodic-cua-sandbox-live.yml"
- ".github/workflows/ci-contributor-attribution.yml"
- ".github/workflows/e2e-rust-macos.yml"
- ".github/workflows/e2e-rust-linux.yml"
diff --git a/.github/workflows/ci-ts-fleet.yml b/.github/workflows/ci-ts-fleet.yml
deleted file mode 100644
index 5232a86430..0000000000
--- a/.github/workflows/ci-ts-fleet.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-name: "CI: @trycua/fleet"
-
-on:
- pull_request:
- paths:
- - "libs/typescript/fleet/**"
- - "libs/typescript/pnpm-lock.yaml"
- - "libs/typescript/pnpm-workspace.yaml"
- - ".github/workflows/ci-ts-fleet.yml"
- - ".github/workflows/ts-reusable-build.yml"
-
-env:
- # Cua programs and packages run here never send usage telemetry.
- CUA_TELEMETRY: "0"
- DO_NOT_TRACK: "1"
-
-permissions:
- contents: read
-
-jobs:
- build:
- uses: ./.github/workflows/ts-reusable-build.yml
- with:
- package_name: "fleet"
- package_dir: "libs/typescript/fleet"
- package_manager: "pnpm"
diff --git a/.github/workflows/docs-fleet-first-run-smoke.yml b/.github/workflows/docs-fleet-first-run-smoke.yml
deleted file mode 100644
index d4574bdd30..0000000000
--- a/.github/workflows/docs-fleet-first-run-smoke.yml
+++ /dev/null
@@ -1,92 +0,0 @@
-name: "Docs: Fleet first-run smoke"
-
-on:
- pull_request:
- paths:
- - docs/content/docs/fleets/quickstart.mdx
- - docs/content/docs/fleets/guides/recover-first-cloud-fleet.mdx
- - docs/public/scripts/first-cloud-fleet/**
- - docs/scripts/tests/test_first_cloud_fleet_tutorial.py
- - docs/scripts/tests/first_cloud_fleet_typescript_smoke.mjs
- - .github/workflows/docs-fleet-first-run-smoke.yml
- merge_group:
- workflow_dispatch:
-
-# Public PR code runs only on a disposable GitHub-hosted runner, without secrets.
-permissions:
- contents: read
-
-env:
- # Cua programs and packages run here never send usage telemetry.
- CUA_TELEMETRY: "0"
- DO_NOT_TRACK: "1"
-
-jobs:
- first-run:
- runs-on: ubuntu-24.04
- timeout-minutes: 45
- steps:
- - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- with:
- ref: ${{ github.sha }}
- persist-credentials: false
- - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
- with:
- python-version: "3.13"
- - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
- with:
- node-version: "22"
- - name: Install protoc
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
- with:
- version: "29.x"
- repo-token: ${{ github.token }}
- - uses: dtolnay/[email protected]
- - uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2
- with:
- workspaces: libs/cua
- key: docs-first-run-smoke
- - name: Install the published Python SDK
- run: |
- python -m pip install --upgrade pip
- python -m pip install \
- --extra-index-url https://wheels.cua.ai/simple \
- "cua-sandbox==0.9.0"
- - name: Test the Python example with mocked Fleet calls
- run: python -m unittest discover -s docs/scripts/tests -p test_first_cloud_fleet_tutorial.py -v
- # The example imports @trycua/cua, which is not on npm yet: build it
- # from libs/cua (as ci-cua-sdk.yml does) and install it from the tree.
- # Switch to "@trycua/cua@<version>" once cd-cua-sdk.yml publishes it.
- - name: Build @trycua/cua from source
- working-directory: libs/cua
- run: |
- npm --prefix typescript ci --ignore-scripts
- cargo build --locked --release -p cua-sdk
- node scripts/stage-uniffi-library.mjs --only=node
- npm --prefix typescript run build
- - name: Compile and test the TypeScript example with mocked Fleet calls
- shell: bash
- run: |
- repo_dir="$PWD"
- test_dir="$(mktemp -d)"
- cd "$test_dir"
- npm init -y
- npm pkg set type=module
- npm install \
- "$repo_dir/libs/cua/typescript" \
- "@types/node@22" \
- cp "$repo_dir/docs/public/scripts/first-cloud-fleet/first-cloud-fleet.ts.txt" \
- first-cloud-fleet.ts
- ./node_modules/.bin/tsc \
- --noEmit \
- --strict \
- --target ES2022 \
- --module NodeNext \
- --moduleResolution NodeNext \
- --types node \
- first-cloud-fleet.ts
- FIRST_CLOUD_FLEET_TS="$test_dir/first-cloud-fleet.ts" \
- node --import tsx --test \
- "$repo_dir/docs/scripts/tests/first_cloud_fleet_typescript_smoke.mjs"
diff --git a/.github/workflows/e2e-local-fleet-images.yml b/.github/workflows/e2e-local-fleet-images.yml
deleted file mode 100644
index 8313af3a69..0000000000
--- a/.github/workflows/e2e-local-fleet-images.yml
+++ /dev/null
@@ -1,116 +0,0 @@
-name: "E2E: Fleet images, local"
-
-# Boots every public Fleet catalog image locally through the SDK's local
-# provider (tests/e2e/local-runtimes/tests/fleet_catalog.rs): the bare Fleet
-# ref picks the backend (QEMU for containerDisks, gVisor for docker-* rootfs),
-# the declared service ports must answer over TCP/HTTP, and every sandbox is
-# deleted. x86_64 runners with /dev/kvm boot the amd64 containerDisks with
-# hardware acceleration, so the Windows image boots fully here (on arm64
-# developer machines it only runs under TCG with a hard cap).
-#
-# Only public catalog entries run in CI (fleet-catalog.public.json); private
-# registry images are covered by local runs with registry credentials.
-
-on:
- schedule:
- - cron: "41 5 * * *"
- workflow_dispatch:
- inputs:
- only:
- description: "Comma list of catalog variants (id, id@amd64, id@rootfs); empty = the job's default"
- default: ""
- windows_timeout_secs:
- description: "Windows readiness budget (seconds)"
- default: "2700"
-
-permissions:
- contents: read
-
-concurrency:
- group: e2e-local-fleet-images-${{ github.ref }}
- cancel-in-progress: false
-
-env:
- # Cua programs and packages run here never send usage telemetry.
- CUA_TELEMETRY: "0"
- DO_NOT_TRACK: "1"
-
-jobs:
- images:
- name: ${{ matrix.name }}
- runs-on: ubuntu-24.04
- timeout-minutes: 100
- strategy:
- fail-fast: false
- matrix:
- include:
- - name: linux containerDisks + rootfs (KVM, gVisor)
- only: ubuntu-24.04-duo@amd64,omarchy-4.0.2@amd64,ubuntu-24.04-duo@rootfs,omarchy-4.0.2@rootfs
- memory_mb: "6144"
- windows: skip
- - name: windows containerDisk (KVM, UEFI)
- only: windows-server-2022@amd64
- memory_mb: "8192"
- windows: full
- env:
- CARGO_BUILD_JOBS: "4"
- CARGO_TERM_COLOR: never
- CUA_E2E_FLEET_CATALOG: "1"
- CUA_E2E_FLEET_CATALOG_ONLY: ${{ inputs.only || matrix.only }}
- CUA_E2E_FLEET_WINDOWS: ${{ matrix.windows }}
- CUA_E2E_FLEET_READY_TIMEOUT_SECS: ${{ inputs.windows_timeout_secs || '2700' }}
- CUA_E2E_FLEET_CPUS: "4"
- CUA_E2E_FLEET_MEMORY_MB: ${{ matrix.memory_mb }}
- CUA_E2E_FLEET_CATALOG_PRUNE: "1"
- CUA_E2E_FLEET_CATALOG_REPORT: ${{ github.workspace }}/fleet-catalog-report.json
- CUA_HOME: /mnt/cua
- RUST_LOG: info,cua_vmm=info,cua_image=info
- steps:
- - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- - name: Free disk space (containerDisks expand to tens of GB)
- run: |
- set -euo pipefail
- sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
- sudo mkdir -p /mnt/cua && sudo chown "$USER" /mnt/cua
- df -h / /mnt
- - name: Enable KVM
- run: |
- set -euo pipefail
- echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
- sudo udevadm control --reload-rules
- sudo udevadm trigger --name-match=kvm
- ls -l /dev/kvm
- test -w /dev/kvm
- - name: Install QEMU, OVMF and gVisor
- run: |
- set -euo pipefail
- sudo apt-get update -qq
- sudo apt-get install -y -qq --no-install-recommends qemu-system-x86 qemu-utils ovmf protobuf-compiler libprotobuf-dev
- scripts/images/install-gvisor.sh
- qemu-system-x86_64 --version
- docker info --format '{{json .Runtimes}}'
- - uses: dtolnay/[email protected]
- - uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2
- with:
- workspaces: tests/e2e/local-runtimes -> target
- - name: Build the suite
- working-directory: tests/e2e/local-runtimes
- run: cargo test --test fleet_catalog readiness_text_yields_http_paths
- - name: Boot the catalog images
- working-directory: tests/e2e/local-runtimes
- run: timeout 5700 cargo test --test fleet_catalog fleet_catalog_images_run_locally -- --nocapture
- - name: Leftover sandboxes (must be none)
- if: always()
- run: |
- pgrep -fa qemu-system || true
- docker ps -a --filter name=cua-e2e- --format '{{.Names}} {{.Status}}' || true
- ls /mnt/cua/vmm/qemu 2>/dev/null || true
- - name: Upload report and screenshots
- if: always()
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
- with:
- name: fleet-catalog-${{ strategy.job-index }}
- path: |
- fleet-catalog-report.json
- /mnt/cua/e2e-fleet-catalog/*.png
- if-no-files-found: warn
diff --git a/.github/workflows/image-doctor.yml b/.github/workflows/image-doctor.yml
index 6a91339016..ed3aac4a43 100644
--- a/.github/workflows/image-doctor.yml
+++ b/.github/workflows/image-doctor.yml
@@ -35,8 +35,8 @@ name: "Image doctor"
# vars.CUA_ARM64_KVM_RUNNER (a self-hosted Graviton metal label).
#
# Tiers: callers gate each tier on its own by calling this once per tier
-# (cd-image-linux.yml doctor-post: name linux-slim-post / linux-full-post;
-# nightly-image-doctor.yml runs 24.04 and 24.04-slim). The doctor enforces
+# (cd-image-linux.yml doctor-post: name linux-slim-post / linux-full-post).
+# The doctor enforces
# each tier's own claims (/etc/cua-image/manifest.json `tier`, `apps`,
# `tools`).
#
diff --git a/.github/workflows/infra-fleets-wif-smoke.yml b/.github/workflows/infra-fleets-wif-smoke.yml
deleted file mode 100644
index de7b49f51e..0000000000
--- a/.github/workflows/infra-fleets-wif-smoke.yml
+++ /dev/null
@@ -1,113 +0,0 @@
-name: "Infra: Fleets WIF smoke pool"
-
-on:
- workflow_dispatch:
- inputs:
- recreate_pool:
- description: "Recreate a pool that was previously owned by different credentials"
- required: false
- default: false
- type: boolean
-
-permissions:
- contents: read
- id-token: write
-
-concurrency:
- group: fleets-wif-smoke-infra
- cancel-in-progress: false
-
-env:
- # Cua programs and packages run here never send usage telemetry.
- CUA_TELEMETRY: "0"
- DO_NOT_TRACK: "1"
- AWS_REGION: us-west-2
- CYCLOPS_ENDPOINT: https://run.cua.ai
- CYCLOPS_CLIENT_ID: ${{ secrets.FLEETS_TERRAFORM_CLIENT_ID }}
- CYCLOPS_CLIENT_SECRET: ${{ secrets.FLEETS_TERRAFORM_CLIENT_SECRET }}
- CYCLOPS_TOKEN_URL: ${{ secrets.FLEETS_TERRAFORM_TOKEN_URL }}
- POOL_BOOTSTRAP_CLIENT_ID: ${{ secrets.CUA_CLIENT_ID }}
- POOL_BOOTSTRAP_CLIENT_SECRET: ${{ secrets.CUA_CLIENT_SECRET }}
- POOL_BOOTSTRAP_TOKEN_URL: https://auth.cua.ai/realms/cyclops-cs/protocol/openid-connect/token
- FLEETS_PROVIDER_COMMIT: f9cc244f62fc1ed3f66142b872a9837a755f6847
- FLEETS_PROVIDER_VERSION: 1.0.0
- TF_IN_AUTOMATION: "true"
-
-jobs:
- apply:
- runs-on: ubuntu-latest
- steps:
- - name: Check out Cua
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
-
- - name: Configure AWS credentials
- uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4
- with:
- role-to-assume: arn:aws:iam::296062593712:role/github-actions-cua-fleets-wif-smoke
- aws-region: ${{ env.AWS_REGION }}
-
- - name: Set up Go
- uses: actions/setup-go@v5
- with:
- go-version: "1.25.8"
- cache: false
-
- - name: Set up Terraform
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3
- with:
- terraform_version: "1.11.4"
-
- - name: Build the pinned Fleets provider
- shell: bash
- run: |
- set -euo pipefail
- provider_dir="$RUNNER_TEMP/terraform-provider-fleets"
- sdk_parent="$RUNNER_TEMP/sdk-bindings"
- mirror="$RUNNER_TEMP/terraform-plugins"
- target="$mirror/registry.terraform.io/trycua/fleets/$FLEETS_PROVIDER_VERSION/$(go env GOOS)_$(go env GOARCH)"
-
- git clone https://github.com/trycua/terraform-provider-fleets.git "$provider_dir"
- git -C "$provider_dir" checkout "$FLEETS_PROVIDER_COMMIT"
- mkdir -p "$sdk_parent" "$target"
- ln -s "$GITHUB_WORKSPACE/libs/fleet/sdk-bindings/go-uniffi" "$sdk_parent/go-uniffi"
-
- native_target="$RUNNER_TEMP/fleets-sdk-native"
- cargo build --locked --manifest-path libs/fleet/Cargo.toml --package cyclops-sdk --target-dir "$native_target"
- native_dir="$native_target/debug"
- test -f "$native_dir/libcyclops_sdk.so"
- export CGO_CFLAGS="-I$GITHUB_WORKSPACE/libs/fleet/sdk-bindings/go-uniffi/fleet_sdk -I$GITHUB_WORKSPACE/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk_schema"
- export CGO_LDFLAGS="-L$native_dir -lcyclops_sdk -Wl,-rpath,$native_dir"
- export LD_LIBRARY_PATH="$native_dir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
-
- go -C "$provider_dir" build -o "$target/terraform-provider-fleets_v$FLEETS_PROVIDER_VERSION" .
-
- cli_config="$RUNNER_TEMP/terraformrc-fleets"
- cat > "$cli_config" <<CONFIG
- provider_installation {
- filesystem_mirror {
- path = "$mirror"
- include = ["registry.terraform.io/trycua/fleets"]
- }
-
- direct {
- exclude = ["registry.terraform.io/trycua/fleets"]
- }
- }
- CONFIG
- echo "TF_CLI_CONFIG_FILE=$cli_config" >> "$GITHUB_ENV"
- echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> "$GITHUB_ENV"
-
- - name: Apply pool and trust policy
- working-directory: infra/fleets-wif-smoke
- run: |
- terraform init -input=false
- terraform validate
- if [ "${{ inputs.recreate_pool }}" = "true" ]; then
- CYCLOPS_CLIENT_ID="$POOL_BOOTSTRAP_CLIENT_ID" \
- CYCLOPS_CLIENT_SECRET="$POOL_BOOTSTRAP_CLIENT_SECRET" \
- CYCLOPS_TOKEN_URL="$POOL_BOOTSTRAP_TOKEN_URL" \
- terraform destroy -input=false -auto-approve \
- -target=fleets_pool.cua_cli_wif_smoke
- fi
- terraform plan -input=false -out=tfplan
- terraform apply -input=false -auto-approve tfplan
diff --git a/.github/workflows/nightly-image-doctor.yml b/.github/workflows/nightly-image-doctor.yml
deleted file mode 100644
index 440a6d80f5..0000000000
--- a/.github/workflows/nightly-image-doctor.yml
+++ /dev/null
@@ -1,166 +0,0 @@
-name: "Nightly: image doctor on Fleet"
-
-# Re-verifies the published canonical Linux images, each tier on its own
-# (`24.04` full and `24.04-slim`), where users run them: on Fleet, as a gVisor pod (rootfs) and as a KubeVirt VM (containerDisk), through
-# the gateway. Each lane applies a cua-e2e-doctor-* pool with per-claim
-# Secrets, claims it with a fresh claim token and runs the guest's doctor
-# (`SystemService.Diagnose`, strict, effects on the virtual display only)
-# through the gateway with x-cua-env-authorization and the runner clock for
-# the skew check (libs/cua/crates/cua-fleet/tests/live_image_doctor.rs); the
-# pool is deleted whatever happened. The image's own token path needs the
-# claim Secret: without one it mints a local token, so a managed-pool claim
-# (`cua sb create --on cloud`) cannot reach its spacesd.
-# A failing lane flips the image-doctor ledger entry of that digest to
-# `regressed` (so the docs gate fails on the next docs PR) and opens or
-# updates an issue with the report.
-#
-# A tier whose tag is not published yet is skipped with a notice.
-#
-# Needs the Fleet client credentials as secrets (CUA_CLIENT_ID,
-# CUA_CLIENT_SECRET, CUA_TOKEN_URL, FLEET_BASE_URL); without them every lane
-# is skipped with a notice.
-
-on:
- schedule:
- - cron: "41 5 * * *"
- workflow_dispatch:
- inputs:
- images:
- description: "Images to verify (comma separated; one per tier)"
- default: "ghcr.io/trycua/linux:24.04,ghcr.io/trycua/linux:24.04-slim"
- runtimes:
- description: "Fleet runtimes"
- default: "gvisor,kubevirt"
-
-permissions:
- contents: read
-
-concurrency:
- group: nightly-image-doctor
- cancel-in-progress: false
-
-env:
- # Cua programs and packages run here never send usage telemetry.
- CUA_TELEMETRY: "0"
- DO_NOT_TRACK: "1"
-
-jobs:
- plan:
- runs-on: ubuntu-latest
- outputs:
- runtimes: ${{ steps.plan.outputs.runtimes }}
- images: ${{ steps.plan.outputs.images }}
- steps:
- - id: plan
- env:
- HAS_CREDS: ${{ secrets.CUA_CLIENT_ID != '' && secrets.CUA_CLIENT_SECRET != '' }}
- RUNTIMES: ${{ inputs.runtimes || 'gvisor,kubevirt' }}
- IMAGES: ${{ inputs.images || 'ghcr.io/trycua/linux:24.04,ghcr.io/trycua/linux:24.04-slim' }}
- run: |
- echo "images=$(jq -cR 'split(",")' <<<"$IMAGES")" >>"$GITHUB_OUTPUT"
- if [ "$HAS_CREDS" != true ]; then
- echo "::notice::Fleet credentials (CUA_CLIENT_ID / CUA_CLIENT_SECRET) are not configured; skipping the Fleet doctor lanes"
- echo 'runtimes=[]' >>"$GITHUB_OUTPUT"
- else
- echo "runtimes=$(jq -cR 'split(",")' <<<"$RUNTIMES")" >>"$GITHUB_OUTPUT"
- fi
-
- fleet:
- needs: plan
- if: needs.plan.outputs.runtimes != '[]'
- strategy:
- fail-fast: false
- matrix:
- runtime: ${{ fromJSON(needs.plan.outputs.runtimes) }}
- image: ${{ fromJSON(needs.plan.outputs.images) }}
- runs-on: ubuntu-24.04
- timeout-minutes: 60
- permissions:
- contents: write
- issues: write
- env:
- IMAGE: ${{ matrix.image }}
- CUA_CLIENT_ID: ${{ secrets.CUA_CLIENT_ID }}
- CUA_CLIENT_SECRET: ${{ secrets.CUA_CLIENT_SECRET }}
- CUA_TOKEN_URL: ${{ secrets.CUA_TOKEN_URL }}
- FLEET_BASE_URL: ${{ secrets.FLEET_BASE_URL }}
- NAME: cua-e2e-doctor-${{ matrix.runtime }}-${{ github.run_id }}
- CARGO_BUILD_JOBS: "4"
- steps:
- - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- - uses: dtolnay/[email protected]
- - uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2
- with:
- workspaces: libs/cua
- - name: Install protoc and crane
- run: |
- sudo apt-get update -qq && sudo apt-get install -y -qq protobuf-compiler libprotobuf-dev
- go install github.com/google/go-containerregistry/cmd/[email protected]
- echo "$(go env GOPATH)/bin" >>"$GITHUB_PATH"
- - name: Tier label and published check
- id: tier
- run: |
- set -euo pipefail
- tag="${IMAGE##*:}"
- echo "label=${tag//./}" >>"$GITHUB_OUTPUT"
- if crane manifest "$IMAGE" >/dev/null 2>&1; then echo "published=true" >>"$GITHUB_OUTPUT"
- else echo "::notice::$IMAGE is not published yet; skipping"; echo "published=false" >>"$GITHUB_OUTPUT"; fi
- - name: Claim, doctor, release
- id: doctor
- if: steps.tier.outputs.published == 'true'
- working-directory: libs/cua
- run: |
- set -uo pipefail
- mkdir -p "$RUNNER_TEMP/doctor"
- variant=rootfs index="$IMAGE"
- if [ "${{ matrix.runtime }}" = kubevirt ]; then variant=containerdisk index="${IMAGE}-disk"; fi
- # The amd64 child the Fleet node pulls (digest-pinned).
- child="$(crane manifest "$index" | python3 -c 'import json,sys;print(next(m["digest"] for m in json.load(sys.stdin)["manifests"] if m.get("platform",{}).get("architecture")=="amd64"))')"
- CUA_E2E_FLEET=1 CUA_E2E_FLEET_DOCTOR_IMAGE="${index%:*}@$child" \
- CUA_E2E_FLEET_DOCTOR_RUNTIME="${{ matrix.runtime }}" CUA_E2E_FLEET_DOCTOR_STRICT=1 \
- CUA_E2E_FLEET_DOCTOR_OUT="$RUNNER_TEMP/doctor/report.json" \
- cargo test --release --locked -p cua-fleet --test live_image_doctor -- --nocapture \
- | tee "$RUNNER_TEMP/doctor/report.txt"
- # The report decides: 1 = the image failed its doctor, 2 = the lane
- # itself could not run (no report), 0 = pass.
- rc=2
- if [ -s "$RUNNER_TEMP/doctor/report.json" ]; then
- status="$(python3 -c 'import json,sys;print(json.load(open(sys.argv[1]))["summary"]["status"])' "$RUNNER_TEMP/doctor/report.json")"
- if [ "$status" = fail ]; then rc=1; else rc=0; fi
- fi
- printf '{"lane": "fleet-%s", "arch": "amd64", "variant": "%s", "claim_secrets": true, "exit": %s}\n' \
- "${{ matrix.runtime }}" "$variant" "$rc" >"$RUNNER_TEMP/doctor/lane.json"
- echo "rc=$rc" >>"$GITHUB_OUTPUT"
- exit "$rc"
- - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
- if: always()
- with:
- name: doctor-fleet-${{ steps.tier.outputs.label }}-${{ matrix.runtime }}
- path: ${{ runner.temp }}/doctor
- if-no-files-found: warn
- retention-days: 30
- - name: Summary
- if: always()
- run: python3 scripts/images/doctor_ledger.py summary "$RUNNER_TEMP/doctor" >>"$GITHUB_STEP_SUMMARY"
- - name: Mark the ledger entry regressed and file an issue
- if: failure() && steps.doctor.outputs.rc == '1'
- env:
- GH_TOKEN: ${{ github.token }}
- RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- run: |
- set -euo pipefail
- variant=rootfs; [ "${{ matrix.runtime }}" = kubevirt ] && variant=containerdisk
- index="$IMAGE"; [ "$variant" = containerdisk ] && index="${IMAGE}-disk"
- child="$(crane manifest "$index" | python3 -c 'import json,sys;print(next(m["digest"] for m in json.load(sys.stdin)["manifests"] if m.get("platform",{}).get("architecture")=="amd64"))')"
- git fetch -q origin image-doctor-ledger && git worktree add -q ledger FETCH_HEAD
- git -C ledger checkout -q -B image-doctor-ledger
- python3 scripts/images/doctor_ledger.py regress --ledger ledger --repo "${index%:*}" \
- --digest "$child" --lane "fleet-${{ matrix.runtime }}" --run "$RUN_URL"
- git -C ledger add -A
- git -C ledger -c user.name=cua-image-doctor -c [email protected] commit -qm "doctor: regressed on Fleet ${{ matrix.runtime }}"
- git -C ledger push -q origin HEAD:image-doctor-ledger
- title="Image doctor: $IMAGE fails on Fleet ${{ matrix.runtime }}"
- # shellcheck disable=SC2016 # the backticks are a Markdown fence
- body="$(printf 'Nightly run: %s\n\n```\n%s\n```\n' "$RUN_URL" "$(tail -n 60 "$RUNNER_TEMP/doctor/report.txt")")"
- existing="$(gh issue list --state open --search "$title in:title" --json number --jq '.[0].number')"
- if [ -n "$existing" ]; then gh issue comment "$existing" --body "$body"; else gh issue create --title "$title" --body "$body" --label image-doctor || gh issue create --title "$title" --body "$body"; fi
diff --git a/.github/workflows/periodic-cua-sandbox-live.yml b/.github/workflows/periodic-cua-sandbox-live.yml
deleted file mode 100644
index 29f8126231..0000000000
--- a/.github/workflows/periodic-cua-sandbox-live.yml
+++ /dev/null
@@ -1,248 +0,0 @@
-name: "Periodic: Cua Sandbox Live Fleet E2E"
-
-on:
- schedule:
- - cron: "7/15 * * * *"
- push:
- branches: [main]
- paths:
- - "libs/python/cua-sandbox/**"
- - "libs/fleet/**"
- - ".github/workflows/periodic-cua-sandbox-live.yml"
- - ".github/scripts/tests/test_periodic_cua_sandbox_live.py"
- workflow_dispatch:
- inputs:
- lane:
- description: "Lane to run"
- required: true
- default: both
- type: choice
- options: [both, main-source, published-package]
- suite:
- description: "Suite to run"
- required: true
- default: both
- type: choice
- options: [both, ephemeral, pool]
- force_failure:
- description: "Fail after setup to certify alerting"
- required: true
- default: false
- type: boolean
-
-permissions:
- contents: read
-
-jobs:
- prepare:
- if: github.repository == 'trycua/cua'
- runs-on: ubuntu-latest
- outputs:
- matrix: ${{ steps.matrix.outputs.matrix }}
- steps:
- - id: matrix
- shell: bash
- env:
- EVENT_NAME: ${{ github.event_name }}
- REQUESTED_LANE: ${{ inputs.lane }}
- REQUESTED_SUITE: ${{ inputs.suite }}
- run: |
- set -euo pipefail
- if [[ "$EVENT_NAME" == "push" ]]; then
- matrix='{"include":[{"lane":"main-source","suite":"ephemeral"}]}'
- else
- lanes=("main-source" "published-package")
- if [[ "$EVENT_NAME" == "workflow_dispatch" && "$REQUESTED_LANE" != "both" ]]; then
- lanes=("$REQUESTED_LANE")
- fi
- suites=("ephemeral" "pool")
- if [[ "$EVENT_NAME" == "workflow_dispatch" && "${REQUESTED_SUITE:-both}" != "both" ]]; then
- suites=("$REQUESTED_SUITE")
- fi
- include=""
- for lane in "${lanes[@]}"; do
- for suite in "${suites[@]}"; do
- include+="{\"lane\":\"$lane\",\"suite\":\"$suite\"},"
- done
- done
- matrix="{\"include\":[${include%,}]}"
- fi
- echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
-
- live:
- if: github.repository == 'trycua/cua'
- needs: prepare
- runs-on: ubuntu-latest
- timeout-minutes: 25
- strategy:
- fail-fast: false
- matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }}
- concurrency:
- group: periodic-cua-sandbox-live-${{ github.event_name }}-${{ matrix.lane }}-${{ matrix.suite }}
- cancel-in-progress: ${{ github.event_name == 'schedule' }}
- env:
- CUA_FLEET_BASE_URL: https://run.cua.ai
- CUA_LIVE_E2E_LANE: ${{ matrix.lane }}
- CUA_LIVE_E2E_SUITE: ${{ matrix.suite }}
- CUA_LIVE_E2E_EVENT: ${{ github.event_name }}
- CUA_LIVE_E2E_NAMESPACE: cua-live-${{ matrix.lane }}-${{ github.event_name == 'workflow_dispatch' && github.run_id || github.event_name }}
- CUA_LIVE_E2E_POOL_WARM_NAMESPACE: cua-live-pool-warm-${{ matrix.lane }}-${{ github.event_name == 'workflow_dispatch' && 'manual' || github.event_name }}
- CUA_LIVE_E2E_POOL_COLD_NAMESPACE: cua-live-pool-cold-${{ matrix.lane }}-${{ github.event_name == 'workflow_dispatch' && 'manual' || github.event_name }}
- CUA_LIVE_E2E_ARTIFACT_DIR: /tmp/cua-live-e2e
- CUA_TELEMETRY_ENABLED: "false"
- CUA_LIVE_E2E_SIGNED_URLS: "true"
- steps:
- - name: Check Fleet OAuth credentials
- env:
- CUA_CLIENT_ID: ${{ secrets.CUA_CLIENT_ID }}
- CUA_CLIENT_SECRET: ${{ secrets.CUA_CLIENT_SECRET }}
- shell: bash
- run: |
- set -euo pipefail
- if [[ -z "$CUA_CLIENT_ID" || -z "$CUA_CLIENT_SECRET" ]]; then
- echo "CUA_CLIENT_ID and CUA_CLIENT_SECRET must both be configured."
- exit 1
- fi
-
- - name: Checkout main
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- with:
- ref: ${{ github.event_name == 'push' && github.sha || github.ref }}
-
- - name: Record checked out source SHA
- id: source_sha
- shell: bash
- run: |
- set -euo pipefail
- source_sha="$(git rev-parse HEAD)"
- echo "source_sha=$source_sha" >> "$GITHUB_OUTPUT"
- echo "CUA_LIVE_E2E_SOURCE_SHA=$source_sha" >> "$GITHUB_ENV"
-
- - name: Set up Python
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
- with:
- python-version: "3.12"
-
- - name: Install uv
- run: python -m pip install uv
-
- - name: Install main source
- if: matrix.lane == 'main-source'
- run: |
- uv pip install --system \
- --index https://wheels.cua.ai/simple \
- --default-index https://pypi.org/simple \
- -e libs/python/cua-sandbox pytest pytest-asyncio
-
- - name: Install published package
- if: matrix.lane == 'published-package'
- run: |
- uv pip install --system \
- --index https://wheels.cua.ai/simple \
- --default-index https://pypi.org/simple \
- --upgrade cua-sandbox pytest pytest-asyncio
-
- - name: Prepare isolated live test suite
- shell: bash
- run: |
- set -euo pipefail
- suite_root="$(mktemp -d /tmp/cua-live-e2e-suite.XXXXXX)"
- mkdir -p "$suite_root/tests/live"
- cp libs/python/cua-sandbox/tests/__init__.py "$suite_root/tests/"
- cp libs/python/cua-sandbox/tests/live/*.py "$suite_root/tests/live/"
- echo "CUA_LIVE_E2E_TEST_ROOT=$suite_root" >> "$GITHUB_ENV"
-
- - name: Record installed versions
- id: versions
- shell: bash
- run: |
- set -o pipefail
- python - <<'PY' | tee -a "$GITHUB_OUTPUT"
- from importlib.metadata import version
- print("sandbox=" + version("cua-sandbox"))
- print("fleet=" + version("cua-fleet"))
- PY
-
- - name: Write controlled failure diagnostics
- if: github.event_name == 'workflow_dispatch' && inputs.force_failure
- run: |
- python - <<'PY'
- import json
- import os
- from pathlib import Path
-
- artifact_dir = Path(os.environ["CUA_LIVE_E2E_ARTIFACT_DIR"])
- artifact_dir.mkdir(parents=True, exist_ok=True)
- (artifact_dir / "summary.json").write_text(
- json.dumps(
- {
- "lane": os.environ["CUA_LIVE_E2E_LANE"],
- "suite": os.environ["CUA_LIVE_E2E_SUITE"],
- "namespace": os.environ["CUA_LIVE_E2E_NAMESPACE"],
- "source_sha": os.environ["CUA_LIVE_E2E_SOURCE_SHA"],
- "error": {"type": "ControlledFailure"},
- },
- indent=2,
- sort_keys=True,
- )
- + "\n"
- )
- PY
-
- - name: Controlled alert test failure
- if: github.event_name == 'workflow_dispatch' && inputs.force_failure
- run: exit 1
-
- - name: Run live Fleet smoke
- if: ${{ matrix.suite == 'ephemeral' && !(github.event_name == 'workflow_dispatch' && inputs.force_failure) }}
- env:
- CUA_CLIENT_ID: ${{ secrets.CUA_CLIENT_ID }}
- CUA_CLIENT_SECRET: ${{ secrets.CUA_CLIENT_SECRET }}
- run: |
- PYTHONPATH="$CUA_LIVE_E2E_TEST_ROOT" python -m pytest -q -s \
- "$CUA_LIVE_E2E_TEST_ROOT/tests/live/test_fleet_ephemeral.py"
-
- - name: Run live Fleet pool smoke
- if: ${{ matrix.suite == 'pool' && !(github.event_name == 'workflow_dispatch' && inputs.force_failure) }}
- env:
- CUA_CLIENT_ID: ${{ secrets.CUA_CLIENT_ID }}
- CUA_CLIENT_SECRET: ${{ secrets.CUA_CLIENT_SECRET }}
- run: |
- PYTHONPATH="$CUA_LIVE_E2E_TEST_ROOT" python -m pytest -q -s \
- "$CUA_LIVE_E2E_TEST_ROOT/tests/live/test_fleet_pool_persistent.py"
-
- - name: Upload failure diagnostics
- if: failure()
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
- with:
- name: cua-sandbox-live-${{ matrix.lane }}-${{ matrix.suite }}-${{ github.run_id }}-${{ github.run_attempt }}
- path: /tmp/cua-live-e2e
- if-no-files-found: warn
- retention-days: 7
-
- - name: Alert Alertmanager
- if: failure()
- shell: bash
- run: |
- set -euo pipefail
- curl --silent --show-error --fail \
- -X POST https://am.cua.ai/api/v2/alerts \
- -H 'Content-Type: application/json' \
- -d '[{
- "labels": {
- "alertname": "PeriodicCuaSandboxLiveE2EFailed",
- "severity": "critical",
- "service": "cua-sandbox",
- "job": "periodic-cua-sandbox-live",
- "lane": "${{ matrix.lane }}",
- "suite": "${{ matrix.suite }}"
- },
- "annotations": {
- "summary": "Cua Sandbox live Fleet E2E failed (${{ matrix.lane }}/${{ matrix.suite }})",
- "description": "Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
- "source_sha": "${{ steps.source_sha.outputs.source_sha }}",
- "package_version": "${{ steps.versions.outputs.sandbox }}",
- "image_digest": "sha256:5b9cb82f482834f7541901b87be956e7544d0db13fabc0b372cbc5eca5a74180"
- },
- "generatorURL": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
- }]'