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.

fix(images): doctor the arm64 bench disk under TCG so promote can attest it (#4450)

ddupont9ab9e890ac63
diff --git a/.github/workflows/cd-bench-images.yml b/.github/workflows/cd-bench-images.yml
index 8b2c9092be..fe2c09eefb 100644
--- a/.github/workflows/cd-bench-images.yml
+++ b/.github/workflows/cd-bench-images.yml
@@ -247,7 +247,8 @@ jobs:
matrix:
include: ${{ fromJSON(needs.meta.outputs.matrix) }}
runs-on: ${{ matrix.runner }}
- timeout-minutes: 120
+ # A disk doctored under TCG (hosted arm64) boots and checks several times slower.
+ timeout-minutes: 300
permissions:
contents: read
packages: read
@@ -292,6 +293,14 @@ jobs:
run: |
"$RUNNER_TEMP/cua" images release "libs/images/bench/$BENCH" --arch "$ARCH" --stamp "$STAMP" --work release \
--publish --steps "verify/$ARCH" --scope "verify-$ARCH" --var python=.venv/bin/python
+ # Hosted arm64 runners have no KVM, so the release skips
+ # verify/<arch>/containerdisk (it needs accel-<arch>) and attest would
+ # find no doctor evidence for that disk. Doctor the staged disk child
+ # under TCG instead (stretched budgets), as cd-image-linux.yml does.
+ - name: Strict VM doctor of the staged disk under TCG (no KVM)
+ run: |
+ if [ -w /dev/kvm ]; then echo "KVM present: the release verified the disk"; exit 0; fi
+ scripts/bench-images/doctor-disk.sh "$BENCH" "$ARCH" release/evidence/verify
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
if: always()
with:
diff --git a/libs/images/bench/web/release.json b/libs/images/bench/web/release.json
index a626b2f8f3..f83377380c 100644
--- a/libs/images/bench/web/release.json
+++ b/libs/images/bench/web/release.json
@@ -178,7 +178,7 @@
"required": [
"amd64"
],
- "description": "(arm64: hosted runners have no KVM; publish.sh --promote still needs native evidence, committed under evidence/)"
+ "description": "(arm64: hosted runners have no KVM; cd-bench-images.yml then doctors the staged disk under TCG with scripts/bench-images/doctor-disk.sh)"
},
{
"id": "attest",
diff --git a/scripts/bench-images/doctor-disk.sh b/scripts/bench-images/doctor-disk.sh
new file mode 100755
index 0000000000..31a06eae5c
--- /dev/null
+++ b/scripts/bench-images/doctor-disk.sh
@@ -0,0 +1,63 @@
+#!/usr/bin/env bash
+# The strict VM doctor of one arch's staged containerDisk child (from
+# libs/images/bench/ID/lock.json), run through scripts/images/image-doctor-lane.sh
+# --lane qemu: KVM/HVF when usable, else TCG with stretched budgets. This is
+# the path for hosted arm64 runners, which have no KVM (the release's
+# verify/<arch>/containerdisk step needs accel-<arch> and is skipped there).
+# cd-image-linux.yml doctors its arm64 disks the same way.
+#
+# doctor-disk.sh ID ARCH EVIDENCE_DIR
+#
+# Writes EVIDENCE_DIR/containerdisk-lane-ARCH.json (a smoke.py-shaped record
+# keyed by the staged disk index) with its -doctor.json report, which is what
+# attest.sh reads, plus the lane's logs under EVIDENCE_DIR/lane-containerdisk-ARCH/.
+# Exit status: the lane's (0 pass).
+set -euo pipefail
+HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+REPO_ROOT="$(cd "$HERE/../.." && pwd)"
+ID="${1:?usage: doctor-disk.sh ID ARCH EVIDENCE_DIR}"
+ARCH="${2:?usage: doctor-disk.sh ID ARCH EVIDENCE_DIR}"
+EVIDENCE="${3:?usage: doctor-disk.sh ID ARCH EVIDENCE_DIR}"
+LOCK="$REPO_ROOT/libs/images/bench/$ID/lock.json"
+[ -f "$LOCK" ] || { echo "no $LOCK (stage the pins first)" >&2; exit 2; }
+
+repo="$(jq -r .repository "$LOCK")"
+index="$repo@$(jq -r .disk_index.digest "$LOCK")"
+child_digest="$(jq -r --arg a "$ARCH" '.children[] | select(.arch == $a) | .containerdisk' "$LOCK")"
+[[ "$child_digest" =~ ^sha256:[0-9a-f]{64}$ ]] || { echo "no $ARCH containerdisk child in $LOCK" >&2; exit 2; }
+child="$repo@$child_digest"
+
+mkdir -p "$EVIDENCE"
+EVIDENCE="$(cd "$EVIDENCE" && pwd)"
+work="$(mktemp -d "${RUNNER_TEMP:-${TMPDIR:-/tmp}}/doctor-disk.XXXXXX")"
+trap 'rm -rf "$work"' EXIT
+echo "== $child (from $index): exporting disk/disk.img"
+crane export --platform "linux/$ARCH" "$child" - | tar -x -C "$work" disk/disk.img
+
+out="$EVIDENCE/lane-containerdisk-$ARCH"
+started=$SECONDS
+rc=0
+"$REPO_ROOT/scripts/images/image-doctor-lane.sh" --lane qemu --disk "$work/disk/disk.img" --arch "$ARCH" --out "$out" || rc=$?
+
+tag="containerdisk-lane-$ARCH"
+[ -s "$out/report.json" ] && cp "$out/report.json" "$EVIDENCE/$tag-doctor.json"
+python3 - "$EVIDENCE/$tag.json" "$ID" "$ARCH" "$child" "$index" "$rc" "$((SECONDS - started))" "$out/report.json" <<'PY'
+import json, os, sys, time
+path, bid, arch, child, index, rc, secs, report = sys.argv[1:]
+status = None
+if os.path.exists(report):
+ try:
+ status = json.load(open(report))["summary"]["status"]
+ except (OSError, ValueError, KeyError):
+ pass
+passed = rc == "0" and status == "pass"
+json.dump({"id": bid, "variant": "containerdisk", "where": "qemu-lane", "arch": arch, "image": child,
+ "child": child, "container_runtime": None, "pinned_ref": index,
+ "doctor": "pass" if passed else "fail", "seconds": int(secs), "ok": passed,
+ "checks": [{"check": "doctor", "status": "pass" if passed else "fail",
+ "detail": f"image-doctor-lane.sh --lane qemu exit {rc}, report status {status}"}],
+ "date": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())},
+ open(path, "w"), indent=2)
+PY
+echo "== $([ "$rc" = 0 ] && echo PASS || echo FAIL) $tag -> $EVIDENCE/$tag.json"
+exit "$rc"