Skip to content

Use treeless checkout in linux build and test workflows - #172545

Closed
zklaus wants to merge 5 commits into
gh/zklaus/26/basefrom
gh/zklaus/26/head
Closed

zklaus wants to merge 5 commits into
gh/zklaus/26/basefrom
gh/zklaus/26/head

Conversation

@zklaus

@zklaus zklaus commented Jan 15, 2026 •

Copy link
Copy Markdown
Collaborator

This PR uses the treeless checkout mode introduced in the first PR in this stack to do a (faster) treeless checkout in the _linux-build and _linux-test workflows.

It is a draft for now because until the first PR in this stack (#172544) has made it into main, it needs to refer to a temporary branch.

Stack from ghstack (oldest at bottom):

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Jan 15, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/172545

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit a3743bf with merge base a6cd1b0 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

[ghstack-poisoned]
SergeyTyshkevich pushed a commit to SergeyTyshkevich/chart2 that referenced this pull request Jan 19, 2026
suncapitalllc007-star pushed a commit to suncapitalllc007-star/pytorch that referenced this pull request Jan 25, 2026
[ghstack-poisoned]
@zklaus zklaus closed this Jan 28, 2026
@zklaus zklaus reopened this Jan 28, 2026
[ghstack-poisoned]
[ghstack-poisoned]
@zklaus zklaus changed the title Use treeless checkout in linux-build workflow Use treeless checkout in linux build and test workflows Jan 29, 2026
@malfet

malfet commented Jan 29, 2026

Copy link
Copy Markdown
Collaborator

Do you know how it will work with our TD/known flaky tests detection (when we fetch some stats from commit base? I.e. treeless checkout will break all that, wouldn't it?)

@zklaus

zklaus commented Jan 29, 2026

Copy link
Copy Markdown
Collaborator Author

@malfet, I don't think so: In general, Git will fetch trees and blobs as needed. But if you could point me in the direction of where this is happening, I'm happy to have a closer look.

@zklaus
zklaus marked this pull request as ready for review January 30, 2026 16:07
@zklaus
zklaus requested a review from a team as a code owner January 30, 2026 16:07
@zklaus

zklaus commented Feb 3, 2026

Copy link
Copy Markdown
Collaborator Author

I've spent some time doing my best to review the flaky test detection machinery with regards to risks from treeless checkouts. I think we are good, though there are some aspects that I can't check due to lack of access, for example to the webhook setup and s3 internals.

@malfet, please let me know if you would like greater assurances and how to achieve them.

@zklaus
zklaus requested review from atalman and malfet February 3, 2026 13:48
@atalman

atalman commented Feb 3, 2026

Copy link
Copy Markdown
Collaborator

HI @malfet please provide some details on the concern. I believe flaky tests are using this https://github.com/pytorch/test-infra/tree/main/aws/lambda/clickhouse-replicator-s3 to populate the data

@malfet

malfet commented Feb 3, 2026

Copy link
Copy Markdown
Collaborator

@zklaus , @atalman our TD/flaky detection relies on being able to get branch merge point, to figure out what known broken tests etc to fetch. In the past (12+ month ago) it used to call git merge-base --fork-point main to find the sha. May be we've been using GH API to get this info (which would be great) If not, that doing any kind of shallow checkout will break that

@atalman

atalman commented Feb 3, 2026 •

Copy link
Copy Markdown
Collaborator

@zklaus

zklaus commented Feb 3, 2026

Copy link
Copy Markdown
Collaborator Author

@malfet, thanks for clarifying!

This is not a shallow checkout/clone. Here, we fetch all the history, i.e. all the commits that make up the fetched branches. We just tell Git that it is enough to fetch the commits themselves (i.e. metadata like hash, comment, parents,...) and that we don't need all the files and directories that are associated with the individual commits.
Git will fetch the directories and files for the ref that is checked out after the fetch, of course.

This way, merge-base commands do still work, in principle.

There is another part to this effort that put merge-base at risk, namely the single-branch option, which makes it so that not all 5000 branches are fetched in every checkout, but only the one pertaining to the active branch or PR. This made it necessary to add the target branch to the fetched branches as well. Currently, we always fetch origin/main in addition to the active branch.

As long as these are the only two refs that we need to use merge-base with, we are good.

Does that clear things up?

@atalman atalman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm. Lets validate that its not breaking the td workflow

@atalman

atalman commented Feb 17, 2026

Copy link
Copy Markdown
Collaborator

@pytorchmergebot merge -f "validated via clickhouse db table, this will not break"

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

sandy-gags pushed a commit to sandy-gags/pytorch that referenced this pull request Mar 12, 2026
@github-actions
github-actions Bot deleted the gh/zklaus/26/head branch March 20, 2026 02:22
EmanueleCoradin pushed a commit to EmanueleCoradin/pytorch that referenced this pull request Mar 30, 2026
This PR uses the treeless checkout mode introduced in the first PR in this stack to do a (faster) treeless checkout in the `_linux-build` and `_linux-test` workflows.

~It is a draft for now because until the first PR in this stack (pytorch#172544) has made it into `main`, it needs to refer to a temporary branch.~

Pull Request resolved: pytorch#172545
Approved by: https://github.com/atalman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants