Skip to content

Retry failed Build Images #75

Retry failed Build Images

Retry failed Build Images #75

#############################################################################
# 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