Skip to content

Commit f2e9472

Browse files
Merge pull request #3 from DIG-Network/ci/raise-build-stage-budget-48
ci: raise build stage budget 16->24 and retry flaky artifact downloads
2 parents 48ee5f1 + a18776c commit f2e9472

2 files changed

Lines changed: 201 additions & 5 deletions

File tree

.github/actions/stage/index.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,35 @@ import * as exec from '@actions/exec';
44
import { DefaultArtifactClient } from '@actions/artifact';
55
import * as glob from '@actions/glob';
66

7+
// The staged tree/out-dir checkpoint artifact grows to multi-GB (observed 14GB+ by
8+
// mid-build) as more of the chrome/chromedriver/mini_installer ninja graph compiles.
9+
// A transfer that size occasionally exhausts the @actions/artifact package's OWN
10+
// internal download retries ("Artifact download failed after 5 retries"), which
11+
// otherwise hard-fails the stage job and discards every prior stage's ninja progress,
12+
// forcing the whole tag build back to stage 1. Retry the whole get+download at this
13+
// outer level too (mirroring the upload retry loop below) so one flaky transfer
14+
// doesn't cost 30-45+ build-hours of already-completed compilation.
15+
const DOWNLOAD_RETRY_ATTEMPTS = 3;
16+
const DOWNLOAD_RETRY_DELAY_MS = 60000;
17+
18+
async function downloadArtifactWithRetry(artifact, artifactName, destPath) {
19+
let lastErr;
20+
for (let i = 0; i < DOWNLOAD_RETRY_ATTEMPTS; ++i) {
21+
try {
22+
const artifactInfo = await artifact.getArtifact(artifactName);
23+
await artifact.downloadArtifact(artifactInfo.artifact.id, {path: destPath});
24+
return;
25+
} catch (e) {
26+
lastErr = e;
27+
console.error(`Download artifact failed (attempt ${i + 1}/${DOWNLOAD_RETRY_ATTEMPTS}): ${e}`);
28+
if (i < DOWNLOAD_RETRY_ATTEMPTS - 1) {
29+
await new Promise(r => setTimeout(r, DOWNLOAD_RETRY_DELAY_MS));
30+
}
31+
}
32+
}
33+
throw lastErr;
34+
}
35+
736
async function run() {
837
process.on('SIGINT', function() {
938
})
@@ -21,8 +50,7 @@ async function run() {
2150
const artifactName = x86 ? 'build-artifact-x86' : (arm ? 'build-artifact-arm' : 'build-artifact');
2251

2352
if (from_artifact) {
24-
const artifactInfo = await artifact.getArtifact(artifactName);
25-
await artifact.downloadArtifact(artifactInfo.artifact.id, {path: 'C:\\ungoogled-chromium-windows\\build'});
53+
await downloadArtifactWithRetry(artifact, artifactName, 'C:\\ungoogled-chromium-windows\\build');
2654
await exec.exec('7z', ['x', 'C:\\ungoogled-chromium-windows\\build\\artifacts.zip',
2755
'-oC:\\ungoogled-chromium-windows\\build', '-y']);
2856
await io.rmRF('C:\\ungoogled-chromium-windows\\build\\artifacts.zip');

.github/workflows/reusable-build.yml

Lines changed: 171 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,13 +351,181 @@ jobs:
351351
arm: ${{ inputs.arm }}
352352
outputs:
353353
finished: ${{ steps.stage.outputs.finished }}
354-
complete:
354+
build-17:
355355
needs: build-16
356+
runs-on: windows-2022
357+
steps:
358+
- uses: actions/checkout@v6
359+
with:
360+
submodules: 'recursive'
361+
- name: Prepare
362+
uses: ./.github/actions/prepare
363+
with:
364+
python-version: ${{ inputs.python-version }}
365+
- name: Run Stage
366+
id: stage
367+
uses: ./.github/actions/stage
368+
with:
369+
finished: ${{ join(needs.*.outputs.finished) }}
370+
from_artifact: true
371+
x86: ${{ inputs.x86 }}
372+
arm: ${{ inputs.arm }}
373+
outputs:
374+
finished: ${{ steps.stage.outputs.finished }}
375+
build-18:
376+
needs: build-17
377+
runs-on: windows-2022
378+
steps:
379+
- uses: actions/checkout@v6
380+
with:
381+
submodules: 'recursive'
382+
- name: Prepare
383+
uses: ./.github/actions/prepare
384+
with:
385+
python-version: ${{ inputs.python-version }}
386+
- name: Run Stage
387+
id: stage
388+
uses: ./.github/actions/stage
389+
with:
390+
finished: ${{ join(needs.*.outputs.finished) }}
391+
from_artifact: true
392+
x86: ${{ inputs.x86 }}
393+
arm: ${{ inputs.arm }}
394+
outputs:
395+
finished: ${{ steps.stage.outputs.finished }}
396+
build-19:
397+
needs: build-18
398+
runs-on: windows-2022
399+
steps:
400+
- uses: actions/checkout@v6
401+
with:
402+
submodules: 'recursive'
403+
- name: Prepare
404+
uses: ./.github/actions/prepare
405+
with:
406+
python-version: ${{ inputs.python-version }}
407+
- name: Run Stage
408+
id: stage
409+
uses: ./.github/actions/stage
410+
with:
411+
finished: ${{ join(needs.*.outputs.finished) }}
412+
from_artifact: true
413+
x86: ${{ inputs.x86 }}
414+
arm: ${{ inputs.arm }}
415+
outputs:
416+
finished: ${{ steps.stage.outputs.finished }}
417+
build-20:
418+
needs: build-19
419+
runs-on: windows-2022
420+
steps:
421+
- uses: actions/checkout@v6
422+
with:
423+
submodules: 'recursive'
424+
- name: Prepare
425+
uses: ./.github/actions/prepare
426+
with:
427+
python-version: ${{ inputs.python-version }}
428+
- name: Run Stage
429+
id: stage
430+
uses: ./.github/actions/stage
431+
with:
432+
finished: ${{ join(needs.*.outputs.finished) }}
433+
from_artifact: true
434+
x86: ${{ inputs.x86 }}
435+
arm: ${{ inputs.arm }}
436+
outputs:
437+
finished: ${{ steps.stage.outputs.finished }}
438+
build-21:
439+
needs: build-20
440+
runs-on: windows-2022
441+
steps:
442+
- uses: actions/checkout@v6
443+
with:
444+
submodules: 'recursive'
445+
- name: Prepare
446+
uses: ./.github/actions/prepare
447+
with:
448+
python-version: ${{ inputs.python-version }}
449+
- name: Run Stage
450+
id: stage
451+
uses: ./.github/actions/stage
452+
with:
453+
finished: ${{ join(needs.*.outputs.finished) }}
454+
from_artifact: true
455+
x86: ${{ inputs.x86 }}
456+
arm: ${{ inputs.arm }}
457+
outputs:
458+
finished: ${{ steps.stage.outputs.finished }}
459+
build-22:
460+
needs: build-21
461+
runs-on: windows-2022
462+
steps:
463+
- uses: actions/checkout@v6
464+
with:
465+
submodules: 'recursive'
466+
- name: Prepare
467+
uses: ./.github/actions/prepare
468+
with:
469+
python-version: ${{ inputs.python-version }}
470+
- name: Run Stage
471+
id: stage
472+
uses: ./.github/actions/stage
473+
with:
474+
finished: ${{ join(needs.*.outputs.finished) }}
475+
from_artifact: true
476+
x86: ${{ inputs.x86 }}
477+
arm: ${{ inputs.arm }}
478+
outputs:
479+
finished: ${{ steps.stage.outputs.finished }}
480+
build-23:
481+
needs: build-22
482+
runs-on: windows-2022
483+
steps:
484+
- uses: actions/checkout@v6
485+
with:
486+
submodules: 'recursive'
487+
- name: Prepare
488+
uses: ./.github/actions/prepare
489+
with:
490+
python-version: ${{ inputs.python-version }}
491+
- name: Run Stage
492+
id: stage
493+
uses: ./.github/actions/stage
494+
with:
495+
finished: ${{ join(needs.*.outputs.finished) }}
496+
from_artifact: true
497+
x86: ${{ inputs.x86 }}
498+
arm: ${{ inputs.arm }}
499+
outputs:
500+
finished: ${{ steps.stage.outputs.finished }}
501+
build-24:
502+
needs: build-23
503+
runs-on: windows-2022
504+
steps:
505+
- uses: actions/checkout@v6
506+
with:
507+
submodules: 'recursive'
508+
- name: Prepare
509+
uses: ./.github/actions/prepare
510+
with:
511+
python-version: ${{ inputs.python-version }}
512+
- name: Run Stage
513+
id: stage
514+
uses: ./.github/actions/stage
515+
with:
516+
finished: ${{ join(needs.*.outputs.finished) }}
517+
from_artifact: true
518+
x86: ${{ inputs.x86 }}
519+
arm: ${{ inputs.arm }}
520+
outputs:
521+
finished: ${{ steps.stage.outputs.finished }}
522+
complete:
523+
needs: build-24
356524
runs-on: ubuntu-latest
357525
steps:
358526
- name: Ensure build finished
359527
run: |
360-
if [ "${{ needs.build-16.outputs.finished }}" != "true" ]; then
361-
echo "Build did not finish after 16 stages."
528+
if [ "${{ needs.build-24.outputs.finished }}" != "true" ]; then
529+
echo "Build did not finish after 24 stages."
362530
exit 1
363531
fi

0 commit comments

Comments
 (0)