-
-
Notifications
You must be signed in to change notification settings - Fork 228
56 lines (52 loc) · 2.24 KB
/
Copy pathretry-failed-builds.yml
File metadata and controls
56 lines (52 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#############################################################################
# Automatically re-run the failed jobs of a "Build Images" run, exactly once.
#
# Why: the image build has three independent, well-understood sources of
# transient failure that are not code defects:
#
# 1. qemu-user mis-emulating concurrent atomics in the armhf chroot, which
# SIGSEGVs a build tool. (The mold linker case self-heals in
# src/makefiles/common/mold-wrapper/ld.mold; a segfault in cc1plus does
# not.)
# 2. GitHub failing to allocate a hosted runner -- "The job was not acquired
# by Runner of type hosted even after multiple attempts". This killed the
# 2026-07-09 nightly publish during a GitHub Actions incident, after all
# four platforms had already built successfully.
# 3. Transient artifact upload/download failures.
#
# `gh run rerun --failed` re-runs ONLY the failed jobs and reuses the
# successful ones' artifacts, so recovering a dead publish job costs ~5 minutes
# instead of a ~55 minute rebuild.
#
# Loop safety: this fires on workflow_run/completed, and re-running bumps
# run_attempt. Guarding on `run_attempt < 2` means attempt 2's completion event
# fails the check, so a run is retried at most once, ever.
#
# We deliberately do NOT retry `cancelled` runs -- a human hitting cancel, or
# the concurrency group superseding an old run, should stay cancelled.
#############################################################################
name: Retry failed Build Images
on:
workflow_run:
workflows: ["Build Images"]
types: [completed]
permissions:
actions: write
jobs:
rerun:
if: >-
github.repository == 'FalconChristmas/fpp' &&
github.event.workflow_run.conclusion == 'failure' &&
github.event.workflow_run.run_attempt < 2
runs-on: ubuntu-latest
steps:
- name: Re-run failed jobs once
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUN_ID: ${{ github.event.workflow_run.id }}
REPO: ${{ github.repository }}
run: |
set -euo pipefail
echo "Build Images run $RUN_ID failed on attempt" \
"${{ github.event.workflow_run.run_attempt }}; re-running failed jobs."
gh run rerun "$RUN_ID" --repo "$REPO" --failed