From 8b2bedfa9ace1484042e81c9c2d942b5aea233ae Mon Sep 17 00:00:00 2001 From: Joshua Hoblitt Date: Mon, 6 Jul 2026 13:02:30 -0700 Subject: [PATCH] build: retry the docs deploy when the gh-pages push is rejected Publishing docs runs mike deploy against the rook.github.io gh-pages branch. When two builds run close together, the branch can advance between one build's fetch and its push, and the push is rejected as non-fast-forward, failing the whole push-image-to-container-registry job even though the images were already published (most recently on the 2026-07-06 master push burst). Reset the local gh-pages branch to the remote tip and retry the deploy up to three times, so a lost race redeploys onto the new tip instead of failing the build. Signed-off-by: Joshua Hoblitt --- build/release/Makefile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/build/release/Makefile b/build/release/Makefile index 1b293b661..b949f8a92 100644 --- a/build/release/Makefile +++ b/build/release/Makefile @@ -93,9 +93,16 @@ build.docs: deps.docs publish.docs: if ! git remote show docs > /dev/null 2>&1; then git remote add docs $(DOCS_GIT_REPO); fi - git fetch -u docs gh-pages - # Switch to root of repo and then run the build and deploy of the documentation - cd $(ROOT_DIR) && mike deploy --remote docs --push --branch gh-pages --update-aliases --deploy-prefix $(DOCS_PREFIX) $(DOCS_VERSION) $(DOCS_VERSION_ALIAS) + # a concurrent build can push gh-pages between our fetch and mike's push, + # getting the push rejected as non-fast-forward; reset the local branch to + # the remote tip and redeploy when that happens + cd $(ROOT_DIR) && for attempt in 1 2 3; do \ + git fetch --force --update-head-ok docs gh-pages:gh-pages && \ + mike deploy --remote docs --push --branch gh-pages --update-aliases --deploy-prefix $(DOCS_PREFIX) $(DOCS_VERSION) $(DOCS_VERSION_ALIAS) && \ + exit 0; \ + echo "docs deploy attempt $$attempt failed"; \ + sleep 15; \ + done; exit 1 # ==================================================================================== # helm