From 8b5a70c492d4d2aeb45c1eabc61f6b2b55755a7c Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Fri, 27 Nov 2026 10:38:51 -0500 Subject: [PATCH] Free Tests installs saved system packages that upgrade the runner's own (GST-4075) (#4858) Free Tests' Linux jobs no longer fail on a runner whose saved system packages include a newer version of one the image already has. Why: dpkg refused libasound2-data 0.5 because it breaks the installed libasound2t64 0.3, left the package database broken, and every later apt-get exited 100 (run 46017056376). Nothing to do: the fix is in the workflow only. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/outside-voice#1 reader=outside-voice --- .github/workflows/free-tests.yml | 38 +++++++++++++++---- .../fix-free-tests-offline-dpkg-upgrade.md | 1 + test/free-tests-workflow-wiring.test.ts | 23 ++++++++++- 3 files changed, 52 insertions(+), 10 deletions(-) create mode 100644 changelog.d/fix-free-tests-offline-dpkg-upgrade.md diff --git a/.github/workflows/free-tests.yml b/.github/workflows/free-tests.yml index 0688a6b3f..b3e302d6f 100644 --- a/.github/workflows/free-tests.yml +++ b/.github/workflows/free-tests.yml @@ -408,17 +408,24 @@ jobs: with: path: ~/.cache/gstack-apt-debs key: ${{ steps.apt_base.outputs.cache_key }} + # The cache can hold a newer version of a package the image already has. + # dpkg installs the files in name order, so on run 46017056376 + # libasound2-data 0.5 came before libasound2t64 and was refused because it + # breaks the installed libasound2t64 0.3. --auto-deconfigure lets dpkg set + # libasound2t64 aside until its own upgrade in the same call lands. - name: Install the cached system packages without the network id: apt_offline if: steps.apt_cache.outputs.cache-hit == 'true' continue-on-error: true - run: sudo dpkg -i "$HOME"/.cache/gstack-apt-debs/*.deb + run: sudo dpkg -i --auto-deconfigure "$HOME"/.cache/gstack-apt-debs/*.deb # The cache restores the browser; --with-deps still runs apt for system # libraries. On 2026-10-21 apt stalled on an archive.ubuntu.com fetch and # held free-suite (12) for the whole 20-minute job timeout (run # 39641712129). Each attempt gets 5 minutes (a warm install takes about # 15 s) and the install alone is retried once. This retries infrastructure, - # never a test. + # never a test. A failed offline dpkg -i leaves packages unpacked but + # unconfigured, and every later apt-get then exits 100 on unmet + # dependencies, so each online attempt first repairs what it left. - name: Install Playwright Chromium id: playwright_install timeout-minutes: 5 @@ -426,14 +433,18 @@ jobs: env: SYSTEM_PACKAGES: ${{ steps.apt_offline.outcome }} run: | - if [ "$SYSTEM_PACKAGES" = success ]; then npx playwright install chromium; else npx playwright install --with-deps chromium; fi + if [ "$SYSTEM_PACKAGES" = success ]; then npx playwright install chromium; exit; fi + if [ "$SYSTEM_PACKAGES" = failure ]; then sudo dpkg --configure -a || true; sudo apt-get update; sudo apt-get install -f -y; fi + npx playwright install --with-deps chromium - name: Retry the Playwright Chromium install once if: steps.playwright_install.outcome == 'failure' timeout-minutes: 5 env: SYSTEM_PACKAGES: ${{ steps.apt_offline.outcome }} run: | - if [ "$SYSTEM_PACKAGES" = success ]; then npx playwright install chromium; else npx playwright install --with-deps chromium; fi + if [ "$SYSTEM_PACKAGES" = success ]; then npx playwright install chromium; exit; fi + if [ "$SYSTEM_PACKAGES" = failure ]; then sudo dpkg --configure -a || true; sudo apt-get update; sudo apt-get install -f -y; fi + npx playwright install --with-deps chromium - name: Configure the bundled Chromium sandbox helper run: | set -euo pipefail @@ -602,17 +613,24 @@ jobs: with: path: ~/.cache/gstack-apt-debs key: ${{ steps.apt_base.outputs.cache_key }} + # The cache can hold a newer version of a package the image already has. + # dpkg installs the files in name order, so on run 46017056376 + # libasound2-data 0.5 came before libasound2t64 and was refused because it + # breaks the installed libasound2t64 0.3. --auto-deconfigure lets dpkg set + # libasound2t64 aside until its own upgrade in the same call lands. - name: Install the cached system packages without the network id: apt_offline if: steps.apt_cache.outputs.cache-hit == 'true' continue-on-error: true - run: sudo dpkg -i "$HOME"/.cache/gstack-apt-debs/*.deb + run: sudo dpkg -i --auto-deconfigure "$HOME"/.cache/gstack-apt-debs/*.deb # The cache restores the browser; --with-deps still runs apt for system # libraries. On 2026-10-21 apt stalled on an archive.ubuntu.com fetch and # held free-suite (12) for the whole 20-minute job timeout (run # 39641712129). Each attempt gets 5 minutes (a warm install takes about # 15 s) and the install alone is retried once. This retries infrastructure, - # never a test. + # never a test. A failed offline dpkg -i leaves packages unpacked but + # unconfigured, and every later apt-get then exits 100 on unmet + # dependencies, so each online attempt first repairs what it left. - name: Install Playwright Chromium id: playwright_install timeout-minutes: 5 @@ -620,7 +638,9 @@ jobs: env: SYSTEM_PACKAGES: ${{ steps.apt_offline.outcome }} run: | - if [ "$SYSTEM_PACKAGES" = success ]; then npx playwright install chromium; else npx playwright install --with-deps chromium; fi + if [ "$SYSTEM_PACKAGES" = success ]; then npx playwright install chromium; exit; fi + if [ "$SYSTEM_PACKAGES" = failure ]; then sudo dpkg --configure -a || true; sudo apt-get update; sudo apt-get install -f -y; fi + npx playwright install --with-deps chromium - name: Retry the Playwright Chromium install once if: steps.playwright_install.outcome == 'failure' @@ -628,7 +648,9 @@ jobs: env: SYSTEM_PACKAGES: ${{ steps.apt_offline.outcome }} run: | - if [ "$SYSTEM_PACKAGES" = success ]; then npx playwright install chromium; else npx playwright install --with-deps chromium; fi + if [ "$SYSTEM_PACKAGES" = success ]; then npx playwright install chromium; exit; fi + if [ "$SYSTEM_PACKAGES" = failure ]; then sudo dpkg --configure -a || true; sudo apt-get update; sudo apt-get install -f -y; fi + npx playwright install --with-deps chromium - name: Configure the bundled Chromium sandbox helper run: | diff --git a/changelog.d/fix-free-tests-offline-dpkg-upgrade.md b/changelog.d/fix-free-tests-offline-dpkg-upgrade.md new file mode 100644 index 000000000..7723c5472 --- /dev/null +++ b/changelog.d/fix-free-tests-offline-dpkg-upgrade.md @@ -0,0 +1 @@ +Free Tests no longer breaks the runner's package database when its saved system packages upgrade one the runner image already has. The offline install now lets dpkg set the older package aside while it upgrades both, and a failed offline install is repaired before Playwright installs its dependencies online. diff --git a/test/free-tests-workflow-wiring.test.ts b/test/free-tests-workflow-wiring.test.ts index b7c9ffbdd..6f73b5800 100644 --- a/test/free-tests-workflow-wiring.test.ts +++ b/test/free-tests-workflow-wiring.test.ts @@ -262,7 +262,11 @@ describe('free-tests workflow wiring', () => { expect(retry, name).toBe(install + 1); for (const step of [steps[install], steps[retry]]) { expect(step['timeout-minutes'], name).toBe(5); - expect(step.run.trim(), name).toBe('if [ "$SYSTEM_PACKAGES" = success ]; then npx playwright install chromium; else npx playwright install --with-deps chromium; fi'); + expect(step.run.trim().split('\n'), name).toEqual([ + 'if [ "$SYSTEM_PACKAGES" = success ]; then npx playwright install chromium; exit; fi', + 'if [ "$SYSTEM_PACKAGES" = failure ]; then sudo dpkg --configure -a || true; sudo apt-get update; sudo apt-get install -f -y; fi', + 'npx playwright install --with-deps chromium', + ]); expect(step.env, name).toEqual({ SYSTEM_PACKAGES: '${{ steps.apt_offline.outcome }}' }); } expect(steps[install]['continue-on-error'], name).toBe(true); @@ -294,7 +298,7 @@ describe('free-tests workflow wiring', () => { expect(steps[base].run, name).toContain(')-playwright-$PLAYWRIGHT_VERSION" >> "$GITHUB_OUTPUT"'); expect(steps[restore].with, name).toEqual({ path: '~/.cache/gstack-apt-debs', key: '${{ steps.apt_base.outputs.cache_key }}' }); expect(steps[offline].if, name).toBe("steps.apt_cache.outputs.cache-hit == 'true'"); - expect(steps[offline].run, name).toBe('sudo dpkg -i "$HOME"/.cache/gstack-apt-debs/*.deb'); + expect(steps[offline].run, name).toBe('sudo dpkg -i --auto-deconfigure "$HOME"/.cache/gstack-apt-debs/*.deb'); expect(steps[keep].if, name).toBe("steps.apt_cache.outputs.cache-hit != 'true'"); expect(steps[keep].run, name).toContain('cp /var/cache/apt/archives/*.deb ~/.cache/gstack-apt-debs/'); expect(steps[save].uses, name).toStartWith('actions/cache/save@'); @@ -307,6 +311,21 @@ describe('free-tests workflow wiring', () => { } }); + test('a failed offline package install is repaired inside each bounded online attempt, so the retry still runs (run 46017056376)', () => { + const jobs = (Bun.YAML.parse(source) as any).jobs; + for (const name of ['free-suite', 'quick-bun-default']) { + const steps = jobs[name].steps; + const offline = steps.findIndex((step: any) => step.id === 'apt_offline'); + const install = steps.findIndex((step: any) => step.id === 'playwright_install'); + expect(install, name).toBe(offline + 1); + for (const step of [steps[install], steps[install + 1]]) { + const lines = step.run.trim().split('\n'); + expect(lines.findIndex((line: string) => line.includes('sudo apt-get install -f -y')), name).toBeLessThan(lines.indexOf('npx playwright install --with-deps chromium')); + } + expect(steps.filter((step: any) => /dpkg --configure|apt-get install -f/.test(step.run ?? '')).length, name).toBe(2); + } + }); + test('test jobs give PR and dispatch runs the local main that push runs get from checkout (#3237)', () => { const jobs = (Bun.YAML.parse(source) as any).jobs; for (const name of ['free-suite', 'quick-bun-default']) {