From 541fb762f898672c1923678a2d6e87a606edd82c Mon Sep 17 00:00:00 2001 From: "congvc-bot[bot]" <3634010+congvc-bot[bot]@users.noreply.github.com> Date: Mon, 23 Nov 2026 11:05:08 +0700 Subject: [PATCH 1/2] fix(ci): wait for the apt/dpkg lock in the Playwright Chromium install steps (CHE-9158) --- .github/workflows/fork-free-suite.yml | 12 ++++++++++-- .github/workflows/free-tests.yml | 24 ++++++++++++++++++++---- test/fork-free-suite-workflow.test.ts | 23 +++++++++++++++++++++++ 3 files changed, 53 insertions(+), 6 deletions(-) diff --git a/.github/workflows/fork-free-suite.yml b/.github/workflows/fork-free-suite.yml index da7220af208..461a1f4118d 100644 --- a/.github/workflows/fork-free-suite.yml +++ b/.github/workflows/fork-free-suite.yml @@ -137,12 +137,20 @@ jobs: id: playwright_install timeout-minutes: 5 continue-on-error: true - run: npx playwright install --with-deps chromium + run: | + # Wait for a held apt/dpkg lock instead of failing at once (exit 100 + # when a timed-out first attempt still holds it; CHE-9158). + echo 'DPkg::Lock::Timeout "180";' | sudo tee /etc/apt/apt.conf.d/99-lock-timeout > /dev/null + npx playwright install --with-deps chromium - name: Retry the Playwright Chromium install once if: steps.playwright_install.outcome == 'failure' timeout-minutes: 5 - run: npx playwright install --with-deps chromium + run: | + # Wait for a held apt/dpkg lock instead of failing at once (exit 100 + # when a timed-out first attempt still holds it; CHE-9158). + echo 'DPkg::Lock::Timeout "180";' | sudo tee /etc/apt/apt.conf.d/99-lock-timeout > /dev/null + npx playwright install --with-deps chromium - name: Configure the bundled Chromium sandbox helper run: | diff --git a/.github/workflows/free-tests.yml b/.github/workflows/free-tests.yml index db8462f9f6c..e553e5f9717 100644 --- a/.github/workflows/free-tests.yml +++ b/.github/workflows/free-tests.yml @@ -482,11 +482,19 @@ jobs: id: playwright_install timeout-minutes: 5 continue-on-error: true - run: npx playwright install --with-deps chromium + run: | + # Wait for a held apt/dpkg lock instead of failing at once (exit 100 + # when a timed-out first attempt still holds it; CHE-9158). + echo 'DPkg::Lock::Timeout "180";' | sudo tee /etc/apt/apt.conf.d/99-lock-timeout > /dev/null + npx playwright install --with-deps chromium - name: Retry the Playwright Chromium install once if: steps.playwright_install.outcome == 'failure' timeout-minutes: 5 - run: npx playwright install --with-deps chromium + run: | + # Wait for a held apt/dpkg lock instead of failing at once (exit 100 + # when a timed-out first attempt still holds it; CHE-9158). + echo 'DPkg::Lock::Timeout "180";' | sudo tee /etc/apt/apt.conf.d/99-lock-timeout > /dev/null + npx playwright install --with-deps chromium - name: Configure the bundled Chromium sandbox helper run: | set -euo pipefail @@ -605,12 +613,20 @@ jobs: id: playwright_install timeout-minutes: 5 continue-on-error: true - run: npx playwright install --with-deps chromium + run: | + # Wait for a held apt/dpkg lock instead of failing at once (exit 100 + # when a timed-out first attempt still holds it; CHE-9158). + echo 'DPkg::Lock::Timeout "180";' | sudo tee /etc/apt/apt.conf.d/99-lock-timeout > /dev/null + npx playwright install --with-deps chromium - name: Retry the Playwright Chromium install once if: steps.playwright_install.outcome == 'failure' timeout-minutes: 5 - run: npx playwright install --with-deps chromium + run: | + # Wait for a held apt/dpkg lock instead of failing at once (exit 100 + # when a timed-out first attempt still holds it; CHE-9158). + echo 'DPkg::Lock::Timeout "180";' | sudo tee /etc/apt/apt.conf.d/99-lock-timeout > /dev/null + npx playwright install --with-deps chromium - name: Configure the bundled Chromium sandbox helper run: | diff --git a/test/fork-free-suite-workflow.test.ts b/test/fork-free-suite-workflow.test.ts index 424cc31d51d..479ae13aef4 100644 --- a/test/fork-free-suite-workflow.test.ts +++ b/test/fork-free-suite-workflow.test.ts @@ -69,3 +69,26 @@ describe('fork free-suite workflow', () => { expect(JSON.stringify(agg.steps)).toContain('--ci-verify'); }); }); + +// CHE-9158: a timed-out first Chromium install can still hold the apt/dpkg lock +// when the retry starts (run 44265868267, retry exited 100 two seconds later). +// Every Playwright install step must set a dpkg lock timeout before it runs. +describe('Playwright Chromium install steps wait for the apt lock', () => { + for (const [label, file] of [['fork', FORK], ['upstream', UPSTREAM]] as const) { + test(`${label}: each install step sets DPkg::Lock::Timeout first`, () => { + const wf = Bun.YAML.parse(fs.readFileSync(file, 'utf-8')) as any; + const installs: string[] = []; + for (const job of Object.values(wf.jobs)) { + for (const step of job.steps ?? []) { + const run = String(step.run ?? ''); + if (!run.includes('playwright install --with-deps')) continue; + installs.push(step.name); + const lock = run.indexOf('DPkg::Lock::Timeout'); + expect(lock, step.name).toBeGreaterThanOrEqual(0); + expect(lock, step.name).toBeLessThan(run.indexOf('playwright install')); + } + } + expect(installs.length).toBeGreaterThanOrEqual(2); + }); + } +}); From abb0dbf4b7ddce55d99aac48a32076499d5935de Mon Sep 17 00:00:00 2001 From: "congvc-bot[bot]" <3634010+congvc-bot[bot]@users.noreply.github.com> Date: Mon, 23 Nov 2026 11:21:29 +0700 Subject: [PATCH 2/2] test(ci): allow the apt lock timeout in the Chromium install wiring assertion (CHE-9158) --- test/free-tests-workflow-wiring.test.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/free-tests-workflow-wiring.test.ts b/test/free-tests-workflow-wiring.test.ts index 59d970f7cfe..d4dcc26e8ce 100644 --- a/test/free-tests-workflow-wiring.test.ts +++ b/test/free-tests-workflow-wiring.test.ts @@ -234,7 +234,12 @@ 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, name).toBe('npx playwright install --with-deps chromium'); + // CHE-9158: apt waits for the dpkg lock first; the install command stays the last line. + const lines = String(step.run).trim().split('\n').filter((line: string) => !line.startsWith('#')); + expect(lines, name).toEqual([ + `echo 'DPkg::Lock::Timeout "180";' | sudo tee /etc/apt/apt.conf.d/99-lock-timeout > /dev/null`, + 'npx playwright install --with-deps chromium', + ]); } expect(steps[install]['continue-on-error'], name).toBe(true); const failOpen = name === 'free-suite' ? [steps[install], steps.find((step: any) => step.name === 'Upload shard JUnit reports')] : [steps[install]];