Skip to content

[cd] Stop fetching all tags when searching for ancestor tag#94302

Merged
eps1lon merged 2 commits into
canaryfrom
sebbie/shallow-not-deepen
Jun 2, 2026
Merged

[cd] Stop fetching all tags when searching for ancestor tag#94302
eps1lon merged 2 commits into
canaryfrom
sebbie/shallow-not-deepen

Conversation

@eps1lon
Copy link
Copy Markdown
Member

@eps1lon eps1lon commented Jun 1, 2026

A normal checkout during release is a shallow clone with the last 25 commits. 25 commits can be too shallow to find the closest ancestor tag.

We used to deepen to 1k to increase chances of finding a tag. However, we were also fetching all tags.
This is wasteful in a default config that auto-follows tags i.e. by default, Git already includes the tags in the commits it fetches. So if there was a tag in the clone depth, it was included. Deepening a clone is also expensive. That's why you should only use shallow clones in CI and never locally where you commonly need to deepen.

Now we always clone with a depth of 1000 immediately.

test plan

cherry-picked to branch that won't do any mutative actions: https://github.com/vercel/next.js/actions/runs/26754284162/job/78849950644

Clone with 1000 depth is around 20-25s. Deepen + --tags is ~120s (https://github.com/vercel/next.js/actions/runs/26697902192/job/78685430123#step:7:1)

A normal checkout during release is a shallow clone with the last 25 commits.
25 commits can be too shallow to find the parent commit.

We used to deepen to 1k to increase chances of finding a tag.
However, we were also fetching **all** tags.
This is wasteful in a default config that auto-follows tags i.e. by default, Git already includes the tags in the commits it fetches.
So if there was a tag in the clone depth, it was included.
Deepening a clone is also expensive. That's why you should only use shallow clones in CI and never locally where you commonly need to deepen.

Now we always clone with a depth of 1000 immediately.
@eps1lon eps1lon requested a review from bgw June 1, 2026 12:27
@eps1lon eps1lon marked this pull request as ready for review June 1, 2026 12:27
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

Stats cancelled

Commit: 4a65b7d
View workflow run

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

Tests Passed

Commit: 4a65b7d

Copy link
Copy Markdown
Member

@bgw bgw left a comment

Choose a reason for hiding this comment

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

Thanks!

Comment thread .github/workflows/trigger_release.yml Outdated
@eps1lon eps1lon enabled auto-merge (squash) June 1, 2026 20:49
@eps1lon eps1lon changed the title [cd] Stop fetching all tags when searching parent tag [cd] Stop fetching all tags when searching for ancestor tag Jun 1, 2026
@eps1lon eps1lon merged commit 06080d0 into canary Jun 2, 2026
297 of 302 checks passed
@eps1lon eps1lon deleted the sebbie/shallow-not-deepen branch June 2, 2026 06:54
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.

2 participants