Skip to content

Stop branch builds from downloading the whole git history on every build - #848

Open
stratakis wants to merge 2 commits into
python:mainfrom
stratakis:no_lazy_fetch_revision_check
Open

stratakis wants to merge 2 commits into
python:mainfrom
stratakis:no_lazy_fetch_revision_check

Conversation

@stratakis

Copy link
Copy Markdown
Contributor

Follow-up to #833. On blobless clones, branch builds download the whole commit and tree history on every build and keep it as a new pack, which is what grew build directories considerably once the git gc step was removed.

Before fetching, buildbot's Git step checks for the build revision with git cat-file -e <revision>. In a partial clone, git lazily fetches the missing commit from origin without negotiation, so GitHub sends every commit and tree reachable from it (that would make it about 122 MB for the main branch). The check then succeeds and the regular filtered fetch is skipped. PR builds are not affected, as they build /merge refs without a revision.

Tested with buildbot 4.4.0rc1, and the git behaviour with git 2.39.5, 2.43.0 and 2.56.1.

This can be removed when it's fixed on the buildbot, I'm basically overriding buildbot's config here. Existing build directories will still keep the current duplicate packs, so a one-time git gc is required (or just remove the build directories). On cstratak-fedora-stable-s390x, the git gc took the 3.x checkout from 18 GB to 278 MB.

@stratakis

Copy link
Copy Markdown
Contributor Author

Buildbot PR: buildbot/buildbot#9352

Comment thread master/custom/steps.py Resolved
Comment thread master/custom/steps.py Resolved
Comment thread master/custom/steps.py
# transport instead, including ones allowed per protocol.
disallow = [
arg
for protocol in ('', 'file.', 'git.', 'http.', 'https.', 'ssh.')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

protocol.allow=never is surprising. What does it disable?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

On git < 2.45 it blocks the only network access cat-file -e makes, the lazy fetch of a missing revision so that the check fails fast and buildbot's normal git fetch runs instead. On 2.45+, --no-lazy-fetch does the same.

Should I expand the comment on that?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No need to expand the comment. I just wanted to double check that it's not a typo, but that protocol.allow=never is a real option :-)

In blobless clones, the check lazily downloads the whole commit history
on every branch build. Use --no-lazy-fetch on git 2.45 and newer so the
regular fetch runs instead.
Git before 2.45 has no --no-lazy-fetch, so disallow all protocols for
the check instead.
@stratakis
stratakis force-pushed the no_lazy_fetch_revision_check branch from 33230d8 to 9a48967 Compare December 2, 2026 18:46
@vstinner

vstinner commented Dec 3, 2026

Copy link
Copy Markdown
Member

Buildbot PR: buildbot/buildbot#9352

I would feel safer to wait until the buildbot change is merged, before backporting it. Let's wait for 1 or 2 weeks to see if someone reviews it.

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.

4 participants