Skip to content

Retry git fetches, fall back to the cached clone - #91

Merged
adrpo merged 1 commit into
OpenModelica:masterfrom
adrpo:retry-git-fetch
Oct 29, 2026
Merged

adrpo merged 1 commit into
OpenModelica:masterfrom
adrpo:retry-git-fetch

Conversation

@adrpo

@adrpo adrpo commented Oct 25, 2026

Copy link
Copy Markdown
Member

Fixes #90.

A short outage on one git server (a 504 from the gateway in front of it) made "Update Package Index" fail for every library, and the error didn't say which repository it was.

Changes in getgitrepo (ompackagemanager/updateinfo.py):

  • Retries: fetch and clone are tried 3 times, waiting 30 s and then 60 s. Before each clone retry, a half-written clone left by the failed attempt is removed.
  • Cached clone: if the fetch still fails, the cached clone is used and a warning is printed. That library keeps its index entries from the previous run, and the other libraries are updated normally. When the caller needs a specific commit (the checkout in main) and the cached clone doesn't have it, the call still fails.
  • Which repository: the retry lines, the warning and the final error now include the URL and the cache path. The end of the run lists every repository whose cached clone was used:
    1 repositories could not be fetched, their libraries are as of the previous run:
      https://gitlab.pam-retd.fr/...
        Fetching ... failed after 3 attempts: unexpected http status code: 504
    

Tests: tests/test_git_retry.py builds local repositories and mocks the fetch to fail with the 504. It covers:

  • a fetch that succeeds after retries;
  • a server that stays down, so the cached clone is used and listed in the summary;
  • a server that stays down while the needed commit isn't cached, so the call fails with an error naming the URL and the commit;
  • a failed clone that leaves a partial directory and is then retried from scratch.

Unrelated, but it affects the same host: #88 moves TAeZoSysPro from gitlab.pam-retd.fr to GitHub.


🤖 Generated with Claude Code

One git server answering 504 stopped the whole index update (OpenModelica#90).
getgitrepo now retries fetch and clone three times, waiting 30 s and
then 60 s. If the fetch still fails, it uses the cached clone, unless
the commit to check out is missing from it. The warning and the error
name the repository, and the end of the run lists the repositories
that could not be fetched.

Fixes OpenModelica#90

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adrpo adrpo self-assigned this Oct 25, 2026
@adrpo
adrpo merged commit 7eac83c into OpenModelica:master Oct 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Package Index fails on one git server's 504 and does not say which repository

1 participant