Skip to content

Commit 314f490

Browse files
committed
ci: harden E2E workflow against VS Code binary download failures
Add restore-keys fallback to the VS Code test binary cache, probe the VS Code update API before running tests, fall back to a stale cached binary (via VSCODE_VERSION) when the CDN is unreachable, and retry the mocked E2E step so transient network blips don't fail the merge queue. Skip writing the pass marker when the stale-binary fallback was used. Closes #1044
1 parent 85f6f27 commit 314f490

1 file changed

Lines changed: 50 additions & 3 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,24 +47,71 @@ jobs:
4747
4848
- name: Cache VS Code test binary
4949
if: github.event_name != 'pull_request' || steps.e2e-marker.outputs.cache-hit != 'true'
50+
id: vscode-cache
5051
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
5152
with:
5253
path: |
5354
apps/vscode-e2e/.vscode-test/
5455
key: vscode-test-${{ runner.os }}-${{ steps.vscode-ver.outputs.version }}-v1
56+
# Fall back to the most recent stale binary so a version bump or cache
57+
# eviction doesn't force a download when the VS Code CDN is unreachable.
58+
restore-keys: |
59+
vscode-test-${{ runner.os }}-
60+
61+
- name: Probe VS Code update API
62+
if: github.event_name != 'pull_request' || steps.e2e-marker.outputs.cache-hit != 'true'
63+
id: vscode-probe
64+
run: |
65+
if curl -sf --max-time 10 https://update.code.visualstudio.com/api/releases/stable > /dev/null; then
66+
echo "reachable=true" >> "$GITHUB_OUTPUT"
67+
else
68+
echo "reachable=false" >> "$GITHUB_OUTPUT"
69+
fi
70+
71+
# @vscode/test-electron only skips its live version-resolution request when the
72+
# requested version already exists in .vscode-test/. On an exact-key miss it calls
73+
# the update API before its download retry loop, so an unreachable CDN fails the
74+
# job before any test runs. When that API is down, point the runner at the stale
75+
# binary restored above (runTest.ts honors VSCODE_VERSION) so the suite still runs.
76+
- name: Fall back to stale VS Code binary when CDN is unreachable
77+
if: (github.event_name != 'pull_request' || steps.e2e-marker.outputs.cache-hit != 'true') && steps.vscode-cache.outputs.cache-hit != 'true' && steps.vscode-probe.outputs.reachable == 'false'
78+
id: vscode-fallback
79+
run: |
80+
STALE=$(ls -d apps/vscode-e2e/.vscode-test/vscode-linux-x64-* 2>/dev/null | sort -V | tail -n 1 || true)
81+
if [ -n "$STALE" ]; then
82+
echo "VSCODE_VERSION=${STALE##*-}" >> "$GITHUB_ENV"
83+
echo "used=true" >> "$GITHUB_OUTPUT"
84+
echo "VS Code update API is unreachable; falling back to cached VS Code ${STALE##*-}"
85+
else
86+
echo "VS Code update API is unreachable and no cached binary is available; the test step may fail"
87+
fi
5588
5689
- name: Run mocked E2E tests
5790
id: run-e2e
5891
# merge_group and workflow_dispatch always run; cache skip is pull_request only
5992
if: github.event_name != 'pull_request' || steps.e2e-marker.outputs.cache-hit != 'true'
60-
run: xvfb-run -a pnpm --filter @roo-code/vscode-e2e test:ci:mock
93+
# Retry the whole step so transient CDN/network blips during version resolution
94+
# or the binary download don't fail the entire merge queue run.
95+
run: |
96+
for attempt in 1 2 3; do
97+
if xvfb-run -a pnpm --filter @roo-code/vscode-e2e test:ci:mock; then
98+
exit 0
99+
fi
100+
echo "E2E attempt ${attempt} failed"
101+
if [ "$attempt" -lt 3 ]; then
102+
sleep 15
103+
fi
104+
done
105+
exit 1
61106
62107
- name: Write mocked E2E pass marker
63-
if: steps.e2e-marker.outputs.cache-hit != 'true' && steps.run-e2e.outcome == 'success'
108+
# Skip when the stale-binary fallback ran: a pass against an older VS Code
109+
# must not mint a marker for the intended-version source hash.
110+
if: steps.e2e-marker.outputs.cache-hit != 'true' && steps.run-e2e.outcome == 'success' && steps.vscode-fallback.outputs.used != 'true'
64111
run: mkdir -p .cache/e2e-pass && date -u > .cache/e2e-pass/passed
65112

66113
- name: Save mocked E2E pass marker
67-
if: steps.e2e-marker.outputs.cache-hit != 'true' && steps.run-e2e.outcome == 'success'
114+
if: steps.e2e-marker.outputs.cache-hit != 'true' && steps.run-e2e.outcome == 'success' && steps.vscode-fallback.outputs.used != 'true'
68115
continue-on-error: true
69116
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
70117
with:

0 commit comments

Comments
 (0)