mirror of
https://github.com/bitbaum/fleet.git
synced 2026-12-04 14:18:27 +01:00
Twenty-eight of twenty-nine repos in the fleet carry
`group: ci-${{ github.ref }}` with `cancel-in-progress: true`, because
that is what templates/ci/ has always said. It lets a newer merge cancel
an older commit's CI run, and every deploy path keys off that run.
It broke two repos today, in the two ways it can break:
fleetcrown, silently. Deploy chains off workflow_run and requires
conclusion == success; a cancelled run reports cancelled, so Deploy
skipped. Four merges sat on main with every check green, nothing red
anywhere, and the box serving the previous build. Each needed a Deploy
dispatched by hand, and the only way to notice was to compare the box's
build stamp against main's tip.
hirnli, loudly. Its Deploy waits for CI to pass on the commit it is
shipping, found the cancelled run, and failed — which is the better of the
two outcomes, because somebody sees it.
Both had the same second cause underneath: auto-merge re-arms CI with a
dispatch, and under one group-per-branch that dispatch cancels the push
run for the SAME commit.
So the templates key main per commit, and the hygiene audit gains
ci-strands-commits so the repos that already copied the old line are found
by a sweep rather than by an outage. The rule only fires where a collision
is actually possible: a group already keyed by github.sha, or one that
never cancels, is left alone.
The rule has its own test, including the case that matters — a file whose
COMMENT mentions github.sha while its group does not must still flag.
Comments are stripped before matching, because a gate that a comment can
satisfy is not a gate.
Claude-Session: https://claude.ai/code/session_018Z7YRpgsEtNjRqr1usHMQY
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
46 lines
1.3 KiB
Bash
Executable File
46 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Prove ci_can_strand_a_commit fires on the shape that stranded commits, and
|
|
# stays quiet on the three shapes that are fine. A rule nobody has seen fail is
|
|
# a comment.
|
|
set -uo pipefail
|
|
cd /home/g/dev/fleet
|
|
# shellcheck disable=SC1091
|
|
source <(sed -n '/^ci_can_strand_a_commit()/,/^}/p' scripts/ci/cicd-hygiene-audit.sh)
|
|
|
|
T=$(mktemp -d)
|
|
cat > "$T/bad.yml" <<'Y'
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
Y
|
|
cat > "$T/fixed.yml" <<'Y'
|
|
concurrency:
|
|
group: ci-${{ github.ref }}-${{ github.ref == 'refs/heads/main' && github.sha || 'branch' }}
|
|
cancel-in-progress: true
|
|
Y
|
|
cat > "$T/nocancel.yml" <<'Y'
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
Y
|
|
cat > "$T/none.yml" <<'Y'
|
|
jobs:
|
|
verify:
|
|
runs-on: ubuntu-latest
|
|
Y
|
|
# A comment must not EXCUSE a broken group. This file's comment names
|
|
# github.sha while the group does not use it, so it must still flag — the
|
|
# comment is stripped before matching for exactly this reason.
|
|
cat > "$T/prose.yml" <<'Y'
|
|
# we should probably key this by github.sha one day
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
Y
|
|
|
|
for f in bad fixed nocancel none prose; do
|
|
if ci_can_strand_a_commit "$T/$f.yml"; then r="FLAGS"; else r="quiet"; fi
|
|
printf '%-9s %s\n' "$f" "$r"
|
|
done
|
|
rm -rf "$T"
|