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.

12.5 KB
Raw Blame
{
  "schema_version": 1,
  "repo": "ghcr.io/trycua/linux",
  "arches": [
    "amd64",
    "arm64"
  ],
  "tiers": {
    "slim": {
      "series": "24.04-slim",
      "tag": "build-slim-{stamp}"
    },
    "full": {
      "series": "24.04",
      "tag": "build-{stamp}"
    },
    "docker": {
      "series": "24.04-docker",
      "tag": "build-docker-{stamp}"
    }
  },
  "vars": {
    "spacesd_source": "local",
    "spacesd_version": "latest",
    "record_ledger": "false",
    "cli_source": "local",
    "cli_version": ""
  },
  "steps": [
    {
      "id": "spacesd/{arch}",
      "phase": "prepare",
      "per_arch": true,
      "description": "cua-spacesd for the image (cached in dist/; CI downloads it)",
      "unless_exists": "{root}/libs/images/linux/dist/{arch}/cua-spacesd",
      "run": [
        "{root}/libs/images/linux/build-spacesd-linux.sh",
        "{arch}"
      ],
      "produces": [
        "{root}/libs/images/linux/dist/{arch}/cua-spacesd"
      ]
    },
    {
      "id": "cli/{arch}",
      "phase": "prepare",
      "per_arch": true,
      "description": "the cua CLI for the image (cached in dist/; CI hands over the one it built from this commit)",
      "unless_exists": "{root}/libs/images/linux/dist/{arch}/cua",
      "run": [
        "{root}/libs/images/linux/build-cua-cli-linux.sh",
        "{arch}"
      ],
      "produces": [
        "{root}/libs/images/linux/dist/{arch}/cua"
      ]
    },
    {
      "id": "build/{arch}",
      "phase": "build",
      "per_arch": true,
      "requires": [
        "docker"
      ],
      "run": [
        "{cua}",
        "images",
        "build",
        "{dir}",
        "--target",
        "{tier}",
        "--platform",
        "linux/{arch}",
        "--tag",
        "{tag}",
        "--outputs",
        "rootfs,disk",
        "--out",
        "{out}",
        "--label",
        "ai.cua.image.tier={tier}",
        "--build-arg",
        "CUA_SPACESD_SOURCE={spacesd_source}",
        "--build-arg",
        "CUA_SPACESD_VERSION={spacesd_version}",
        "--build-arg",
        "CUA_CLI_SOURCE={cli_source}",
        "--build-arg",
        "CUA_CLI_VERSION={cli_version}"
      ],
      "produces": [
        "{out}/{name}-{tier}/{arch}/disk.img"
      ]
    },
    {
      "id": "doctor/{arch}/runc",
      "phase": "gate",
      "per_arch": true,
      "requires": [
        "docker"
      ],
      "run": [
        "{root}/scripts/images/image-doctor-lane.sh",
        "--lane",
        "runc",
        "--image",
        "{repo}:docker-{tag}-{arch}",
        "--out",
        "{evidence}/doctor/{arch}-runc"
      ]
    },
    {
      "id": "doctor/{arch}/runsc",
      "phase": "gate",
      "per_arch": true,
      "requires": [
        "runsc",
        "native-{arch}"
      ],
      "run": [
        "{root}/scripts/images/image-doctor-lane.sh",
        "--lane",
        "runsc",
        "--image",
        "{repo}:docker-{tag}-{arch}",
        "--out",
        "{evidence}/doctor/{arch}-runsc"
      ]
    },
    {
      "id": "doctor/{arch}/qemu",
      "phase": "gate",
      "per_arch": true,
      "run": [
        "{root}/scripts/images/image-doctor-lane.sh",
        "--lane",
        "qemu",
        "--disk",
        "{out}/{name}-{tier}/{arch}/disk.img",
        "--arch",
        "{arch}",
        "--out",
        "{evidence}/doctor/{arch}-qemu"
      ],
      "description": "the strict VM doctor on every arch: KVM/HVF when the host has it, else QEMU TCG with stretched budgets (image-doctor-lane.sh; hosted arm64 runners)"
    },
    {
      "id": "doctor/{arch}/qemu-claim-secrets",
      "phase": "gate",
      "per_arch": true,
      "requires": [
        "accel-{arch}"
      ],
      "run": [
        "{root}/scripts/images/image-doctor-lane.sh",
        "--lane",
        "qemu",
        "--disk",
        "{out}/{name}-{tier}/{arch}/disk.img",
        "--arch",
        "{arch}",
        "--claim-secrets",
        "--out",
        "{evidence}/doctor/{arch}-qemu-claim-secrets"
      ],
      "required": [
        "amd64"
      ]
    },
    {
      "id": "docker/{arch}/qemu",
      "phase": "gate",
      "per_arch": true,
      "tiers": [
        "docker"
      ],
      "description": "the docker tier's own gate: boot the disk under QEMU (KVM/HVF, else TCG) and check dockerd up at boot, overlay + br_netfilter loaded, iptables/ip6tables rules, a compose hello-world (smoke-docker-vm.sh)",
      "run": [
        "{root}/libs/images/linux/smoke-docker-vm.sh",
        "--disk",
        "{out}/{name}-{tier}/{arch}/disk.img",
        "--arch",
        "{arch}",
        "--evidence",
        "{evidence}/docker/{arch}-qemu"
      ]
    },
    {
      "id": "conformance/{arch}/runc",
      "phase": "gate",
      "per_arch": true,
      "requires": [
        "docker"
      ],
      "run": [
        "bash",
        "-c",
        "docker build -q -t cua-envdesktop-test \"$0/libs/cua-spacesd/crates/cua-spacesd-desktop/tests/docker\" >/dev/null && \"$0/libs/cua-spacesd/crates/cua-spacesd-desktop/tests/docker/run-against-image.sh\" runc \"$1\"",
        "{root}",
        "{repo}:docker-{tag}-{arch}"
      ]
    },
    {
      "id": "conformance/{arch}/runsc",
      "phase": "gate",
      "per_arch": true,
      "requires": [
        "runsc",
        "native-{arch}"
      ],
      "run": [
        "bash",
        "-c",
        "docker build -q -t cua-envdesktop-test \"$0/libs/cua-spacesd/crates/cua-spacesd-desktop/tests/docker\" >/dev/null && \"$0/libs/cua-spacesd/crates/cua-spacesd-desktop/tests/docker/run-against-image.sh\" runsc \"$1\"",
        "{root}",
        "{repo}:docker-{tag}-{arch}"
      ]
    },
    {
      "id": "claim-token/{arch}/runc",
      "phase": "gate",
      "per_arch": true,
      "requires": [
        "docker"
      ],
      "run": [
        "{root}/libs/images/linux/smoke-claim-token.sh",
        "--image",
        "{repo}:docker-{tag}-{arch}",
        "--runtime",
        "runc",
        "--evidence",
        "{evidence}/claim-token/{arch}-runc"
      ]
    },
    {
      "id": "claim-token/{arch}/runsc",
      "phase": "gate",
      "per_arch": true,
      "requires": [
        "runsc",
        "native-{arch}"
      ],
      "run": [
        "{root}/libs/images/linux/smoke-claim-token.sh",
        "--image",
        "{repo}:docker-{tag}-{arch}",
        "--runtime",
        "runsc",
        "--evidence",
        "{evidence}/claim-token/{arch}-runsc"
      ]
    },
    {
      "id": "cua-cli/{arch}/runc",
      "phase": "gate",
      "per_arch": true,
      "requires": [
        "docker"
      ],
      "description": "the cua CLI in the image: version, cua-spacesd health, and `cua spaces ls` reaching the Space's spawn channel (smoke-cua-cli.sh)",
      "run": [
        "{root}/libs/images/linux/smoke-cua-cli.sh",
        "--image",
        "{repo}:docker-{tag}-{arch}",
        "--runtime",
        "runc",
        "--evidence",
        "{evidence}/cua-cli/{arch}-runc"
      ]
    },
    {
      "id": "cua-cli/{arch}/runsc",
      "phase": "gate",
      "per_arch": true,
      "requires": [
        "runsc",
        "native-{arch}"
      ],
      "description": "the cua CLI in the image: version, cua-spacesd health, and `cua spaces ls` reaching the Space's spawn channel (smoke-cua-cli.sh)",
      "run": [
        "{root}/libs/images/linux/smoke-cua-cli.sh",
        "--image",
        "{repo}:docker-{tag}-{arch}",
        "--runtime",
        "runsc",
        "--evidence",
        "{evidence}/cua-cli/{arch}-runsc"
      ]
    },
    {
      "id": "size/{arch}",
      "phase": "gate",
      "per_arch": true,
      "requires": [
        "docker"
      ],
      "tiers": [
        "slim"
      ],
      "description": "the slim tier stays bounded: the unpacked image (docker's Size) is at most 1.55 GB per arch. Before the cua CLI joined it, slim was 1.23 GB (amd64) and 1.27 GB (arm64) unpacked and 0.49 GB compressed; the released CLI archive adds about 200 MB unpacked (85 MB compressed on x64, 78 MB on arm64), 1.43 GB on amd64 measured in CI. A smaller in-Space CLI is the way to cut it.",
      "run": [
        "bash",
        "-c",
        "size=$(docker image inspect \"$0\" | python3 -c 'import json,sys; print(json.load(sys.stdin)[0][\"Size\"])') && echo \"unpacked image: $size bytes (budget $1)\" && [ \"$size\" -le \"$1\" ]",
        "{repo}:docker-{tag}-{arch}",
        "1550000000"
      ]
    },
    {
      "id": "parity/{arch}",
      "phase": "gate",
      "per_arch": true,
      "arches": [
        "amd64"
      ],
      "requires": [
        "runsc",
        "native-{arch}",
        "accel-{arch}"
      ],
      "run": [
        "{root}/scripts/images/image-parity-lane.sh",
        "--rootfs",
        "{repo}:docker-{tag}-{arch}",
        "--disk",
        "{out}/{name}-{tier}/{arch}/disk.img",
        "--arch",
        "{arch}",
        "--runtime",
        "runsc",
        "--cua",
        "{cua}",
        "--out",
        "{evidence}/parity-{arch}"
      ]
    },
    {
      "id": "content/{arch}",
      "phase": "stage",
      "per_arch": true,
      "requires": [
        "docker"
      ],
      "description": "what a scheduled run compares with the promoted tag",
      "run": [
        "{root}/scripts/images/content-digest.sh",
        "--rootfs",
        "{repo}:docker-{tag}-{arch}",
        "--tree",
        "libs/images/linux",
        "--tree",
        "libs/images/common",
        "--tree",
        "libs/cua-spacesd",
        "--tree",
        "libs/cua-driver/rust",
        "--out",
        "{evidence}/content-{arch}.txt"
      ],
      "stdout": "{evidence}/content-digest-{arch}",
      "produces": [
        "{evidence}/content-digest-{arch}"
      ]
    },
    {
      "id": "save/{arch}",
      "phase": "stage",
      "per_arch": true,
      "requires": [
        "docker"
      ],
      "run": [
        "{root}/scripts/images/release-save.sh",
        "--arch",
        "{arch}",
        "--rootfs",
        "{repo}:docker-{tag}-{arch}",
        "--disk",
        "{out}/{name}-{tier}/{arch}/disk.img",
        "--artifacts",
        "{artifacts}",
        "--evidence",
        "{evidence}"
      ],
      "produces": [
        "{artifacts}/{arch}/disk/disk.img",
        "{artifacts}/{arch}/rootfs/rootfs.tar.zst",
        "{evidence}/artifacts-{arch}.sha256"
      ]
    },
    {
      "id": "push/{arch}",
      "phase": "push",
      "per_arch": true,
      "requires": [
        "docker"
      ],
      "run": [
        "{root}/scripts/images/release-push.sh",
        "--image-dir",
        "{dir}",
        "--repo",
        "{repo}",
        "--tag",
        "{tag}",
        "--arch",
        "{arch}",
        "--target",
        "{tier}",
        "--artifacts",
        "{artifacts}",
        "--evidence",
        "{evidence}",
        "--out",
        "{out}",
        "--cua",
        "{cua}"
      ],
      "produces": [
        "{evidence}/pushed-{arch}/pushed.json"
      ]
    },
    {
      "id": "attest",
      "phase": "push",
      "description": "attach every doctor report to the child it checked (and the ledger with record_ledger=true)",
      "env": {
        "ATTEST_DIR": "{evidence}"
      },
      "run": [
        "{root}/scripts/images/attest-doctor-reports.sh",
        "attest",
        "{run_url}",
        "{record_ledger}"
      ],
      "produces": [
        "{evidence}/attested.json"
      ]
    },
    {
      "id": "publish",
      "phase": "publish",
      "run": [
        "{root}/scripts/images/release-publish.sh",
        "--image-dir",
        "{dir}",
        "--repo",
        "{repo}",
        "--tag",
        "{tag}",
        "--series",
        "{series}",
        "--stamp",
        "{stamp}",
        "--arches",
        "{arches}",
        "--evidence",
        "{evidence}",
        "--cua",
        "{cua}",
        "--run-url",
        "{run_url}",
        "--tier",
        "{tier}"
      ],
      "produces": [
        "{evidence}/pins.json"
      ]
    },
    {
      "id": "verify",
      "phase": "verify",
      "run": [
        "{root}/scripts/images/verify-pins.sh",
        "--pins",
        "{evidence}/pins.json",
        "--evidence",
        "{evidence}",
        "--arches",
        "{arches}"
      ]
    },
    {
      "id": "promote",
      "phase": "promote",
      "run": [
        "{cua}",
        "images",
        "promote",
        "{evidence}/pins.json"
      ]
    },
    {
      "id": "catalog",
      "phase": "promote",
      "description": "move the catalog digests of the promoted tags and record their sizes (commit libs/images/sandbox-images.json)",
      "run": [
        "python3",
        "{root}/scripts/images/record-image-sizes.py",
        "--refresh-digest",
        "--ref",
        "{repo}:{series}",
        "--ref",
        "{repo}:{series}-disk"
      ]
    }
  ]
}