Skip to content

Commit 5137942

Browse files
fstrcursoragent
andauthored
ci: harden release chart doc sync push against races (FB-2030) (#31)
## Background FB-2030: the release workflow can fail when it commits regenerated chart docs and then loses a push race to another commit on `main`. ## Summary - set the `release-chart` checkout to `fetch-depth: 0` so rebase has a reliable merge base. - replace the one-shot push in `Sync generated chart README to released version` with a 3-attempt retry loop. - after a rejected push, fetch latest authenticated `main` and rebase before retrying. - document the race condition and mitigation in `AGENTS.md` Known issues. ## Test Plan - [x] `actionlint .github/workflows/helm-release-cd.yaml` Made with [Cursor](https://cursor.com) Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 3fc5e44 commit 5137942

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

.github/workflows/helm-release-cd.yaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ jobs:
7171
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
7272
with:
7373
show-progress: "false"
74+
fetch-depth: 0
7475
persist-credentials: false
7576

7677
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
@@ -113,7 +114,24 @@ jobs:
113114
echo "Chart README already in sync; nothing to commit."
114115
else
115116
git commit -m "docs: regenerate chart README for ${RELEASE_VERSION} [skip ci]"
116-
git push "https://x-access-token:${GH_APP_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" HEAD:main
117+
PUSH_URL="https://x-access-token:${GH_APP_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
118+
for attempt in 1 2 3; do
119+
if git push "$PUSH_URL" HEAD:main; then
120+
break
121+
fi
122+
123+
if [ "$attempt" -eq 3 ]; then
124+
echo "Failed to push chart README sync after ${attempt} attempts." 1>&2
125+
exit 1
126+
fi
127+
128+
git fetch "$PUSH_URL" main
129+
if ! git rebase FETCH_HEAD; then
130+
git rebase --abort || true
131+
echo "Failed to rebase chart README sync onto latest main." 1>&2
132+
exit 1
133+
fi
134+
done
117135
fi
118136
119137
- name: Set up Helm

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ Ongoing limitations, framework footguns, and environment traps that still affect
134134
- Remove the entry when the underlying issue is fixed — do not leave solved history behind.
135135

136136
- Symptom: GitHub Actions workflows that use `azure/setup-helm` with `version: "latest"` can start failing or changing behavior unexpectedly. Cause: the action matches upstream Helm tarball names verbatim and `latest` can silently advance across major versions, including to Helm v4. Resolution: pin an explicit Helm v3 patch in both validation and release workflows until the v4 behavioral differences have been audited and adopted intentionally.
137+
- Symptom: release jobs that commit generated chart docs back to `main` can fail with `! [rejected] HEAD -> main (fetch first)` when another commit lands after checkout. Cause: a single push attempt from a stale local base, with checkout credentials disabled. Resolution: keep release checkouts at full history and wrap the push in a retry loop that fetches and rebases on the latest authenticated `main` between attempts, failing only after explicit retries are exhausted.
137138

138139
## Project-specific rules
139140

0 commit comments

Comments
 (0)