Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 6, 2025

Backport #64657: Use shallow clones for CI jobs

Optimize git checkout across CI jobs using shallow clones (fetchDepth: 1) and disable tag fetching.

Description

Backport of #64657 to release/9.0 (manual backport due to merge conflict with auto-backport PR #64676).

Changes:

  • .azure/pipelines/jobs/default-build.yml: Add fetchDepth: 1 and fetchTags: false parameters; update both checkout steps (public/internal builds)
  • .azure/pipelines/ci.yml: Add fetchDepth: 0 to Code_check job (needs full history for git log comparison in CodeCheck.ps1)
  • .azure/pipelines/ci-public.yml: Add fetchDepth: 0 to Code_check job

Note: ci-unofficial.yml does not exist on release/9.0 branch.

Customer Impact

Improved CI efficiency—reduces checkout time across ~17 parallel jobs by avoiding full history/tags fetch. No customer-facing impact.

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

CI-only change. No runtime code affected.

Verification

  • Manual (required)
  • Automated

YAML syntax validated. Changes match original PR #64657 pattern.

Packaging changes reviewed?

  • Yes
  • No
  • N/A

When servicing release/2.1

  • Make necessary changes in eng/PatchConfig.props
Original prompt

Backport of #64657 to release/9.0 (manual backport due to merge conflict with auto-backport PR #64676)

Summary

Use shallow clones for CI jobs to improve build performance by reducing the amount of git history that needs to be fetched.

Changes Required

Apply the following changes to the release/9.0 branch, adapting to the file structure on this branch:

1. .azure/pipelines/jobs/default-build.yml

Add new parameters for checkout optimization:

# Checkout optimization parameters
fetchDepth: 1
fetchTags: false

And update the existing checkout: self steps (there are two in the file - one for public builds around line 169, and one for internal builds around line 396) to include the fetchDepth and fetchTags parameters:

- checkout: self
  clean: true
  fetchDepth: ${{ parameters.fetchDepth }}
  fetchTags: ${{ parameters.fetchTags }}

2. .azure/pipelines/ci.yml

For the Code_check job, add fetchDepth: 0 to ensure full history is available for git log comparison in CodeCheck.ps1:

# Need full history for git log comparison in CodeCheck.ps1
fetchDepth: 0

3. .azure/pipelines/ci-public.yml

For the Code_check job, add fetchDepth: 0:

# Need full history for git log comparison in CodeCheck.ps1
fetchDepth: 0

4. .azure/pipelines/ci-unofficial.yml

For the Code_check job, add fetchDepth: 0:

# Need full history for git log comparison in CodeCheck.ps1
fetchDepth: 0

Reference

/cc @adityamandaleeka

This pull request was created as a result of the following prompt from Copilot chat.

Backport of #64657 to release/9.0 (manual backport due to merge conflict with auto-backport PR #64676)

Summary

Use shallow clones for CI jobs to improve build performance by reducing the amount of git history that needs to be fetched.

Changes Required

Apply the following changes to the release/9.0 branch, adapting to the file structure on this branch:

1. .azure/pipelines/jobs/default-build.yml

Add new parameters for checkout optimization:

# Checkout optimization parameters
fetchDepth: 1
fetchTags: false

And update the existing checkout: self steps (there are two in the file - one for public builds around line 169, and one for internal builds around line 396) to include the fetchDepth and fetchTags parameters:

- checkout: self
  clean: true
  fetchDepth: ${{ parameters.fetchDepth }}
  fetchTags: ${{ parameters.fetchTags }}

2. .azure/pipelines/ci.yml

For the Code_check job, add fetchDepth: 0 to ensure full history is available for git log comparison in CodeCheck.ps1:

# Need full history for git log comparison in CodeCheck.ps1
fetchDepth: 0

3. .azure/pipelines/ci-public.yml

For the Code_check job, add fetchDepth: 0:

# Need full history for git log comparison in CodeCheck.ps1
fetchDepth: 0

4. .azure/pipelines/ci-unofficial.yml

For the Code_check job, add fetchDepth: 0:

# Need full history for git log comparison in CodeCheck.ps1
fetchDepth: 0

Reference

/cc @adityamandaleeka


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: adityamandaleeka <219224+adityamandaleeka@users.noreply.github.com>
Copilot AI changed the title [WIP] Add shallow clones for CI jobs to improve performance Backport #64657: Use shallow clones for CI jobs Dec 6, 2025
Copilot finished work on behalf of adityamandaleeka December 6, 2025 01:15
@adityamandaleeka adityamandaleeka added area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework and removed Attention: Shared Code Modified labels Dec 6, 2025
@dotnet-policy-service
Copy link
Contributor

Hey @dotnet/aspnet-build, looks like this PR is something you want to take a look at.

@wtgodbe wtgodbe added the tell-mode Indicates a PR which is being merged during tell-mode label Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework tell-mode Indicates a PR which is being merged during tell-mode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants