Skip to content

Make pipelines checkout faster with fetchDepth: 1 and fetchTags: false#27342

Open
CraigMacomber wants to merge 7 commits into
microsoft:mainfrom
CraigMacomber:fetchDepth
Open

Make pipelines checkout faster with fetchDepth: 1 and fetchTags: false#27342
CraigMacomber wants to merge 7 commits into
microsoft:mainfrom
CraigMacomber:fetchDepth

Conversation

@CraigMacomber
Copy link
Copy Markdown
Contributor

@CraigMacomber CraigMacomber commented May 19, 2026

Description

For small agents, the checkout step took:

Repo policy check also showed the same change.

This also removes some console spam from all the tags and branches.

This seems like a nice win for pipeline performance, saving around a minute. Other pipelines on larger agents might benefit less.

Large agents, like used for client build show less of a gain:

One test was found (and fixed) which depended on having tags present in the repo when the test ran.

Reviewer Guidance

The review process is outlined on this wiki page.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

Hi! Thank you for opening this PR. Want me to review it?

Based on the diff (159 lines, 17 files), I've queued these reviewers:

  • Correctness — logic errors, race conditions, lifecycle issues
  • Security — vulnerabilities, secret exposure, injection
  • API Compatibility — breaking changes, release tags, type design
  • Performance — algorithmic regressions, memory leaks
  • Testing — coverage gaps, hollow tests

How this works

  • Adjust the reviewer set by ticking/unticking boxes above. Reviewer toggles alone don't trigger anything.

  • Tick Start review below to dispatch the review fleet.

  • After review finishes, tick Start review again to request another run — it auto-resets after each dispatch.

  • This comment updates as new commits land; your reviewer selections are preserved.

  • Start review

@CraigMacomber CraigMacomber marked this pull request as ready for review May 19, 2026 20:21
Copilot AI review requested due to automatic review settings May 19, 2026 20:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Speeds up Azure Pipelines checkout by adding fetchDepth: 1 and fetchTags: false to all checkout steps across the pipeline YAMLs, reducing checkout time significantly (e.g., 63s→7s on small agents). A unit test that depended on real git tags being present is refactored to mock the git client.

Changes:

  • Add fetchDepth: 1 and fetchTags: false to every checkout step in the pipeline YAMLs.
  • Refactor fromTag.test.ts to mock simpleGit so the test no longer relies on real tags being checked out.
  • Keep the real-git variant of the test as a manually-enabled (skipped-by-default) path.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tools/pipelines/test-perf-benchmarks.yml Shallow checkout for self and ff_pipeline_host.
tools/pipelines/templates/upload-telemetry/include-stage-upload-telemetry.yml Shallow checkout for ff_pipeline_host.
tools/pipelines/templates/upload-server-manifest.yml Shallow checkout for self.
tools/pipelines/templates/upload-dev-manifest.yml Shallow checkout for self.
tools/pipelines/templates/include-test-real-service.yml Shallow checkout for ff_pipeline_host and self.
tools/pipelines/templates/include-publish-npm-package-deployment.yml Shallow checkout for self.
tools/pipelines/templates/include-publish-docker-service-steps.yml Shallow checkout for self.
tools/pipelines/templates/include-policy-check.yml Shallow checkout for self.
tools/pipelines/templates/build-npm-package.yml Shallow checkout for build job.
tools/pipelines/templates/build-npm-client-package.yml Shallow checkout in three build jobs.
tools/pipelines/templates/build-docker-service.yml Shallow checkout for build job.
tools/pipelines/repo-policy-check.yml Shallow checkout for self.
tools/pipelines/publish-api-model-artifact.yml Shallow checkout in two stages.
tools/pipelines/deploy-website.yml Shallow checkout across four stages.
tools/pipelines/build-performance-observability.yml Shallow checkout for self.
tools/pipelines/build-docs.yml Shallow checkout across five stages.
build-tools/packages/build-cli/src/test/commands/release/fromTag.test.ts Mock simpleGit.tags/show so the test no longer depends on local tags; gate real-git path behind this.skip().

Comment on lines +75 to +83
} else {
// Skip real git test by default, as it requires specific tags to be present in the local repo, which may not be the case in all environments.
// Disable this skip if you want to test against the actual git repo and tags.
this.skip();
const { stdout } = await runCommand(["release:fromTag", tag, "--json"], {
root: import.meta.url,
});
output = JSON.parse(stdout);
}
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.

This is intended and documented.

Comment thread build-tools/packages/build-cli/src/test/commands/release/fromTag.test.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment on lines +164 to +165
fetchDepth: 1
fetchTags: false
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.

This one would be my main concern, together with the corresponding one in include-publish-docker-service-steps.yml‎. As I mentioned in Teams, I think flub does need the tags to be available at some point during the release/publish process, but I can't recall where exactly. @tylerbutler might remember.

@alexvy86
Copy link
Copy Markdown
Contributor

Besides the two referenced the comment above, I think all the other shallow clones are probably safe and worth it.

@CraigMacomber
Copy link
Copy Markdown
Contributor Author

Some interesting cases are called out in a previous attempt at this in #26193 : I need to review those and accommodate them.

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.

3 participants