Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
fix(images): pin Chromium per arch and fall back when the PPA drops a major (CUA-2023) (#5722)
ddupont688c5fd62a9f
diff --git a/.github/workflows/ci-images-chromium-pin.yml b/.github/workflows/ci-images-chromium-pin.ymlnew file mode 100644index 0000000000..67a89f846a--- /dev/null+++ b/.github/workflows/ci-images-chromium-pin.yml@@ -0,0 +1,37 @@+name: "CI: Images, Chromium pin"++# The Linux image installs Chromium from the xtradeb/apps PPA at a pinned major+# per arch (libs/images/linux/Dockerfile, CHROMIUM_MAJOR_AMD64/ARM64). The PPA+# keeps only its newest build per arch, so a pinned major can vanish overnight.+# The image build then falls back to the newest build (and warns); this check+# fails loudly with the versions the PPA has, on PRs that touch the pin and+# once a day, so the pin is bumped on purpose.++on:+ pull_request:+ paths:+ - "libs/images/linux/Dockerfile"+ - "scripts/images/check-chromium-pin.sh"+ - ".github/workflows/ci-images-chromium-pin.yml"+ schedule:+ - cron: "17 6 * * *"+ workflow_dispatch:++permissions:+ contents: read++concurrency:+ group: ci-images-chromium-pin-${{ github.ref }}+ cancel-in-progress: true++jobs:+ pin:+ name: The PPA has the pinned Chromium majors+ runs-on: ubuntu-latest+ timeout-minutes: 5+ steps:+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4+ with:+ persist-credentials: false+ - name: Check the pinned majors against the PPA+ run: scripts/images/check-chromium-pin.sh libs/images/linux/Dockerfilediff --git a/libs/images/linux/Dockerfile b/libs/images/linux/Dockerfileindex 55c6a6747a..0cf93a5ad6 100644--- a/libs/images/linux/Dockerfile+++ b/libs/images/linux/Dockerfile@@ -108,7 +108,7 @@ RUN install -d -m 0755 /etc/apt/keyrings# Chromium from the xtradeb/apps PPA (open-source build, BSD-3-Clause; not# Google-branded Chrome): only the chromium packages may come from it, at-# the pinned major (CHROMIUM_MAJOR), and the key must have the pinned fingerprint.+# the pinned major for this arch, and the key must have the pinned fingerprint.# The key is vendored (common/apt-keys/xtradeb-apps.asc), not fetched from# keyserver.ubuntu.com, so a keyserver outage cannot break the build.# cua-driver's browser_prepare launches /usr/lib/chromium/chromium (a@@ -118,13 +118,20 @@ RUN install -d -m 0755 /etc/apt/keyrings# per runtime (common/desktop/browser-sandbox.sh), not the user.# The PPA keeps only its newest build per arch and prunes the rest, so an# exact build pin (155.0.8059.39-1xtradeb1.2404.1) breaks the build as soon as-# the PPA moves on (it did, repeatedly). Pin the major instead: apt picks the-# newest CHROMIUM_MAJOR.* build the PPA has for that arch, and the arches need-# not move together. The resolved version is recorded in-# /etc/cua-image/chromium-version. Bump the major-# deliberately. CHROMIUM_VERSION, when set, wins (an exact build, for a repro).+# the PPA moves on (it did, repeatedly). Pin the major per arch instead: apt+# picks the newest <major>.* build the PPA has for that arch. The arches move+# on separately (amd64 went to 156 while arm64 stayed on 155), so each has its+# own major. When the PPA has dropped a pinned major for an arch, the build+# takes the newest build it has for that arch and says so, rather than+# failing; scripts/images/check-chromium-pin.sh (CI: Images, Chromium pin)+# fails loudly with what the PPA has, so the bump is still made deliberately.+# The resolved version is recorded in /etc/cua-image/chromium-version.+# CHROMIUM_MAJOR, when set, is the major for every arch; CHROMIUM_VERSION, when+# set, wins over both (an exact build, for a repro).ARG CHROMIUM_VERSION=-ARG CHROMIUM_MAJOR=155+ARG CHROMIUM_MAJOR=+ARG CHROMIUM_MAJOR_AMD64=156+ARG CHROMIUM_MAJOR_ARM64=155ARG CHROMIUM_PPA_KEY=5301FA4FD93244FBC6F6149982BB6851C64F6880RUN --mount=type=bind,source=common/apt-keys/xtradeb-apps.asc,target=/tmp/xtradeb-apps.asc \gpg --dearmor </tmp/xtradeb-apps.asc >/etc/apt/keyrings/xtradeb-apps.gpg \@@ -133,8 +140,17 @@ RUN --mount=type=bind,source=common/apt-keys/xtradeb-apps.asc,target=/tmp/xtrade>/etc/apt/sources.list.d/xtradeb-apps.list \&& printf 'Package: *\nPin: origin ppa.launchpadcontent.net\nPin-Priority: -1\n\nPackage: chromium chromium-common chromium-sandbox\nPin: origin ppa.launchpadcontent.net\nPin-Priority: 1001\n' \>/etc/apt/preferences.d/xtradeb-chromium \- && pin="${CHROMIUM_VERSION:-${CHROMIUM_MAJOR}.*}" && test -n "$pin" \&& apt-get update \+ && major="${CHROMIUM_MAJOR}" \+ && if [ -z "$major" ]; then case "$TARGETARCH" in \+ arm64) major="$CHROMIUM_MAJOR_ARM64" ;; *) major="$CHROMIUM_MAJOR_AMD64" ;; esac; fi \+ && have="$(apt-cache madison chromium | awk -F'|' '/ppa\.launchpadcontent\.net/ { gsub(/ /, "", $2); print $2 }' | sort -V)" \+ && test -n "$have" \+ && if [ -n "$CHROMIUM_VERSION" ]; then pin="$CHROMIUM_VERSION"; \+ elif printf '%s\n' $have | grep -q "^${major}\."; then pin="${major}.*"; \+ else pin="$(printf '%s\n' $have | tail -n 1)"; \+ echo "warning: the PPA has no chromium ${major}.* for ${TARGETARCH} any more (it has: $(echo $have)); using ${pin}. Bump CHROMIUM_MAJOR_$(echo "$TARGETARCH" | tr a-z A-Z)." >&2; fi \+ && echo "chromium for ${TARGETARCH}: ${pin}" \&& for attempt in 1 2 3; do apt-get install -y --no-install-recommends \"chromium=${pin}" "chromium-common=${pin}" && break; \echo "apt attempt $attempt failed; reconfiguring" >&2; dpkg --configure -a || true; \diff --git a/scripts/images/check-chromium-pin.sh b/scripts/images/check-chromium-pin.shnew file mode 100755index 0000000000..54c11f7088--- /dev/null+++ b/scripts/images/check-chromium-pin.sh@@ -0,0 +1,39 @@+#!/usr/bin/env bash+# SPDX-License-Identifier: MIT+# Checks that the xtradeb/apps PPA still has the Chromium major+# libs/images/linux/Dockerfile pins for each arch (the major of+# CHROMIUM_VERSION_AMD64 / CHROMIUM_VERSION_ARM64, or CHROMIUM_MAJOR_<ARCH>). The PPA keeps only its newest build per arch, so a+# major disappears without notice; the image build then falls back to the+# newest build and warns, and this check fails loudly with what the PPA has, so+# the pin is bumped on purpose.+#+# scripts/images/check-chromium-pin.sh [Dockerfile]+set -euo pipefail+dockerfile="${1:-libs/images/linux/Dockerfile}"+ppa="https://ppa.launchpadcontent.net/xtradeb/apps/ubuntu/dists/noble/main"+status=0+for arch in amd64 arm64; do+ ARCH="$(echo "$arch" | tr a-z A-Z)"+ var="CHROMIUM_MAJOR_${ARCH}"+ major="$(sed -n -E "s/^ARG ${var}=([0-9]+)\$/\\1/p" "$dockerfile")"+ if [ -z "$major" ]; then+ var="CHROMIUM_VERSION_${ARCH}"+ major="$(sed -n -E "s/^ARG ${var}=([0-9]+)\..*\$/\\1/p" "$dockerfile")"+ fi+ if [ -z "$major" ]; then+ echo "::error file=${dockerfile}::no ARG ${var}=<major> in ${dockerfile}"+ status=1+ continue+ fi+ packages="$(curl -fsSL --retry 3 "${ppa}/binary-${arch}/Packages.gz" | gunzip -c)"+ for pkg in chromium chromium-common; do+ have="$(printf '%s\n' "$packages" | awk -v p="$pkg" '/^Package: /{ok=($2==p)} ok&&/^Version: /{print $2}' | sort -uV)"+ if printf '%s\n' "$have" | grep -q "^${major}\."; then+ echo "ok: ${pkg} ${major}.* for ${arch}: $(printf '%s\n' "$have" | grep "^${major}\." | tail -n 1)"+ else+ echo "::error file=${dockerfile}::the xtradeb PPA has no ${pkg} ${major}.* for ${arch} (${var}=${major}); it has: $(echo ${have:-nothing}). Bump ${var} in ${dockerfile}."+ status=1+ fi+ done+done+exit "$status"