Skip to content

build: retry git clones a few times when they fail - #5488

Merged
lgritz merged 3 commits into
AcademySoftwareFoundation:mainfrom
lgritz:lg-retryclone
Sep 25, 2026
Merged

lgritz merged 3 commits into
AcademySoftwareFoundation:mainfrom
lgritz:lg-retryclone

Conversation

@lgritz

@lgritz lgritz commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator

I'm pretty fed up with GitHub's reliability. Sometimes a clone just fails, their uptime has been spotty lately. Using our dependency auto-build feature for more packages, more frequently in CI, the opportunities for spurious failures have grown enough that it seems like every CI workflow (with 29 job variants these days) has a good chance of at least one job variant failing. That's a lot of noise in what's supposed to be a reliable signal about whether the PR passes or fails the testsuite on its own merits. I'm constantly poking "rerun failed jobs" on people's PRs for no good reason, and having trouble separating which are temporary GitHub failures from which PRs are actually broken.

So here is me being a little desperate -- I'm adding a CMake function execute_process_with_retry, that we use with the git clone of dependencies to try up to 5 times before a full failure. After the first failure, it waits 15 seconds. The delay doubles with each failure. If all attempts fail, it's a full job failure. Hopefully, any spurious GitHub clone unavailability that lasts less than a few minutes will just be glossed over and let us complete CI, at the cost of perhaps a minute or two delay, which seems like a small price to pay.

Assisted by: Claude Code / claude-opus-5

@lgritz lgritz added the build / testing / port / CI Affecting the build system, tests, platform support, porting, or continuous integration. label Sep 22, 2026
I'm pretty fed up with GitHub's reliability. Sometimes a clone just
fails, their uptime has been spotty lately.  Using our dependency
auto-build feature for more packages, more frequently in CI, the
opportunities for spurious failures have grown enough that it seems
like every CI workflow (with 29 job variants these days) has a good
chance of at least one job variant failing. That's a lot of noise in
what's supposed to be a reliable signal about whether the PR passes or
fails the testsuite on its own merits.

So here is me being a little desperte -- I'm adding a CMake function
execute_process_with_retry, that we use with the git clones of
dependencies (including nanobind and its submodule) and of the test data
repos to try up to 5 times before a full failure. After the
first failure, it waits 15 seconds. The delay doubles with each
failure. If all attempts fail, it's a full job failure. Hopefully, any
spurious GitHub clone unavailability that lasts less than a few
minutes will just be glossed over and let us complete CI, at the cost
of perhaps a minute or two delay, which seems like a small price to
pay.

Assisted by: Claude Code / claude-opus-5

Signed-off-by: Larry Gritz <lg@larrygritz.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Unresolved moderate issues affect failure propagation, cleanup, and retry duration.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 Medium severity

Open (2)
What changed in this PR

Adds configurable exponential retries for Git-based dependency and test-data downloads during CMake configuration.

Changes:

  • Introduces a reusable retry helper with cleanup and backoff controls.
  • Applies retries to dependencies, submodules, nanobind, and test data.
  • Adds retry-related dependency settings.
File Reviewed changes and findings
src/​cmake/​dependency_utils.cmake Adds retry handling. Moderate issues remain: final failures can bypass cleanup, and the default backoff totals 465 seconds.
src/​cmake/​testing.cmake Adds retries for test-data cloning. The final result is discarded, allowing configuration to continue after failure (moderate).
src/​cmake/​build_nanobind.cmake Adds retries for nanobind and its submodule. Clone results are discarded, allowing incomplete sources to continue (moderate).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/cmake/build_nanobind.cmake Outdated
Comment thread src/cmake/dependency_utils.cmake
execute_process_with_retry now removes the CLEANUP dir after every
failed attempt, including the last, so a leftover partial clone can't
be mistaken for a good checkout on the next configure.

nanobind: drop the hand-rolled clone + submodule step and use
build_dependency_with_cmake's GIT_SUBMODULES, which checks results and
inits submodules after verifying the pinned commit.

Assisted-by: Claude Code / claude-opus-5-5
Signed-off-by: Larry Gritz <lg@larrygritz.com>
execute_process_with_retry gains RETRY_COUNT_VARIABLE. New wrapper
git_clone_with_retry uses it to log the names of clones that succeeded
only after retrying to build/clone-retries.txt; ci-test.bash appends
"Recovered from clone failures of: ..." to the step summary when that
file is non-empty.

Assisted-by: Claude Code / claude-opus-5-5
Signed-off-by: Larry Gritz <lg@larrygritz.com>
@lgritz

lgritz commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator Author

No objections -> merging

I want this in to help reduce the incidence of spurious CI failures when a dependency has an error cloning and needs to retry.

@lgritz
lgritz merged commit 7b9f271 into AcademySoftwareFoundation:main Sep 25, 2026
63 checks passed
lgritz added a commit to lgritz/OpenImageIO that referenced this pull request Sep 27, 2026
…undation#5488)

I'm pretty fed up with GitHub's reliability. Sometimes a clone just
fails, their uptime has been spotty lately. Using our dependency
auto-build feature for more packages, more frequently in CI, the
opportunities for spurious failures have grown enough that it seems like
every CI workflow (with 29 job variants these days) has a good chance of
at least one job variant failing. That's a lot of noise in what's
supposed to be a reliable signal about whether the PR passes or fails
the testsuite on its own merits. I'm constantly poking "rerun failed
jobs" on people's PRs for no good reason, and having trouble separating
which are temporary GitHub failures from which PRs are actually broken.

So here is me being a little desperate -- I'm adding a CMake function
execute_process_with_retry, that we use with the git clone of
dependencies to try up to 5 times before a full failure. After the first
failure, it waits 15 seconds. The delay doubles with each failure. If
all attempts fail, it's a full job failure. Hopefully, any spurious
GitHub clone unavailability that lasts less than a few minutes will just
be glossed over and let us complete CI, at the cost of perhaps a minute
or two delay, which seems like a small price to pay.

Assisted by: Claude Code / claude-opus-5

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
@lgritz
lgritz deleted the lg-retryclone branch September 27, 2026 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build / testing / port / CI Affecting the build system, tests, platform support, porting, or continuous integration.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants