fix(pipeline): rebase and retry when a data job's push is rejected
purge-unhealthy ran for four hours on 2026-09-21 and then failed on "push rejected (fetch first)", throwing the whole run away. The data-write concurrency group serialises the WORKFLOWS, but main still moves under a long job: a merged pull request, an /admin approval or override the Worker commits, the extension's push to scripts/temp_info.jsonl. bash/commit_push.sh does what every wrapper did - add, commit only if something changed - and then pushes with up to five attempts, rebasing onto origin/main between them. None of the other writers touch the shards, so the rebase is clean; a genuine conflict still fails the job. All nine data wrappers now call it, with their commit messages unchanged (snapshot.sh keeps its data/snapshots/ pathspec). Tested against a scratch remote: with main moved by another commit, the first push is rejected, the rebase lands the job's commit on top, and the retry succeeds; with nothing to commit it prints "No changes". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
abe92e2457
commit
5e689e7aca
10 files changed
+53
-30
No files matched your search
Executable
+44
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
# Commit what a data job changed, and push it even if main moved meanwhile.
|
||||
#
|
||||
# A data job can run for hours (update-reviews, check-dead-links,
|
||||
# purge-unhealthy), and `concurrency: data-write` serialises only the
|
||||
# WORKFLOWS. main still moves underneath one: a merged pull request, an /admin
|
||||
# approval or override the Worker commits, the extension's push to
|
||||
# scripts/temp_info.jsonl. A plain `git push` is then rejected ("fetch first")
|
||||
# and the whole run is thrown away - purge-unhealthy lost four hours of work
|
||||
# that way on 2026-09-21.
|
||||
#
|
||||
# None of those other writers touch the shards, so rebasing onto them and
|
||||
# pushing again is safe. A genuine conflict still fails the job, loudly.
|
||||
#
|
||||
# Usage: commit_push.sh "<commit message>" [pathspec ...] (default: .)
|
||||
set -euo pipefail
|
||||
|
||||
msg="$1"
|
||||
shift
|
||||
if [ "$#" -eq 0 ]; then
|
||||
set -- .
|
||||
fi
|
||||
|
||||
git config --global user.name 'github-actions[bot]'
|
||||
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
||||
|
||||
git add -- "$@"
|
||||
if git diff --staged --quiet; then
|
||||
echo "No changes"
|
||||
exit 0
|
||||
fi
|
||||
git commit -m "$msg"
|
||||
|
||||
for attempt in 1 2 3 4 5; do
|
||||
if git push; then
|
||||
exit 0
|
||||
fi
|
||||
echo "Push rejected (attempt $attempt/5): rebasing onto origin/main and retrying"
|
||||
sleep $((attempt * 10))
|
||||
git pull --rebase origin main
|
||||
done
|
||||
|
||||
echo "::error::push still rejected after 5 attempts"
|
||||
exit 1
|
||||
+1
-3
@@ -2,6 +2,4 @@
|
||||
set -euo pipefail
|
||||
pip install --quiet -r requirements.txt
|
||||
python scripts/check_dead_links.py
|
||||
git config --global user.name 'github-actions[bot]'
|
||||
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
||||
git add . && git diff --staged --quiet && echo "No changes" || (git commit -m "Dead link check [$(date +'%Y-%m-%d')]" && git push)
|
||||
bash "$(dirname "$0")/commit_push.sh" "Dead link check [$(date +'%Y-%m-%d')]"
|
||||
+1
-3
@@ -2,6 +2,4 @@
|
||||
set -euo pipefail
|
||||
pip install --quiet -r requirements.txt
|
||||
python scripts/ingest_new.py
|
||||
git config --global user.name 'github-actions[bot]'
|
||||
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
||||
git add . && git diff --staged --quiet && echo "No changes" || (git commit -m "Ingest games [$(date +'%Y-%m-%d %H:%M')]" && git push)
|
||||
bash "$(dirname "$0")/commit_push.sh" "Ingest games [$(date +'%Y-%m-%d %H:%M')]"
|
||||
+1
-3
@@ -2,6 +2,4 @@
|
||||
set -euo pipefail
|
||||
pip install --quiet -r requirements.txt
|
||||
python scripts/update_data.py
|
||||
git config --global user.name 'github-actions[bot]'
|
||||
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
||||
git add . && git diff --staged --quiet && echo "No changes" || (git commit -m "Auto update [$(date +'%Y-%m-%d')]" && git push)
|
||||
bash "$(dirname "$0")/commit_push.sh" "Auto update [$(date +'%Y-%m-%d')]"
|
||||
+1
-3
@@ -2,6 +2,4 @@
|
||||
set -euo pipefail
|
||||
pip install --quiet -r requirements.txt
|
||||
python scripts/top_offline.py
|
||||
git config --global user.name 'github-actions[bot]'
|
||||
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
||||
git add . && git diff --staged --quiet && echo "No changes" || (git commit -m "Top offline [$(date +'%Y-%m-%d %H:%M')]" && git push)
|
||||
bash "$(dirname "$0")/commit_push.sh" "Top offline [$(date +'%Y-%m-%d %H:%M')]"
|
||||
+1
-3
@@ -2,6 +2,4 @@
|
||||
set -euo pipefail
|
||||
pip install --quiet -r requirements.txt
|
||||
python scripts/top_online.py
|
||||
git config --global user.name 'github-actions[bot]'
|
||||
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
||||
git add . && git diff --staged --quiet && echo "No changes" || (git commit -m "Top online [$(date +'%Y-%m-%d %H:%M')]" && git push)
|
||||
bash "$(dirname "$0")/commit_push.sh" "Top online [$(date +'%Y-%m-%d %H:%M')]"
|
||||
+1
-3
@@ -2,6 +2,4 @@
|
||||
set -euo pipefail
|
||||
pip install --quiet -r requirements.txt
|
||||
python scripts/purge_unhealthy.py
|
||||
git config --global user.name 'github-actions[bot]'
|
||||
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
||||
git add . && git diff --staged --quiet && echo "No changes" || (git commit -m "Purge unhealthy [$(date +'%Y-%m-%d')]" && git push)
|
||||
bash "$(dirname "$0")/commit_push.sh" "Purge unhealthy [$(date +'%Y-%m-%d')]"
|
||||
+1
-6
@@ -4,9 +4,4 @@ echo "── Force re-fetch ALL games (v2.1 schema) ──"
|
||||
|
||||
pip install --quiet -r requirements.txt
|
||||
python scripts/refetch_all.py
|
||||
|
||||
git config --global user.name 'github-actions[bot]'
|
||||
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
||||
git add .
|
||||
git diff --staged --quiet && echo "No changes" \
|
||||
|| (git commit -m "Force re-fetch all games → v2.1 schema [$(date +'%Y-%m-%d')]" && git push)
|
||||
bash "$(dirname "$0")/commit_push.sh" "Force re-fetch all games → v2.1 schema [$(date +'%Y-%m-%d')]"
|
||||
+1
-3
@@ -2,6 +2,4 @@
|
||||
set -euo pipefail
|
||||
pip install --quiet -r requirements.txt
|
||||
python scripts/update_reviews.py
|
||||
git config --global user.name 'github-actions[bot]'
|
||||
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
||||
git add . && git diff --staged --quiet && echo "No changes" || (git commit -m "Update reviews [$(date +'%Y-%m-%d')]" && git push)
|
||||
bash "$(dirname "$0")/commit_push.sh" "Update reviews [$(date +'%Y-%m-%d')]"
|
||||
+1
-3
@@ -2,6 +2,4 @@
|
||||
set -euo pipefail
|
||||
# No pip install: snapshot.py and scripts/core/* are stdlib-only.
|
||||
python scripts/snapshot.py
|
||||
git config --global user.name 'github-actions[bot]'
|
||||
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
||||
git add data/snapshots/ && git diff --staged --quiet && echo "No changes" || (git commit -m "Snapshot [$(date +'%Y-%m-%d')]" && git push)
|
||||
bash "$(dirname "$0")/commit_push.sh" "Snapshot [$(date +'%Y-%m-%d')]" data/snapshots/
|
||||
Reference in new issue
Block a user