Skip to content

Backport #64657: Use shallow clones for CI jobs#64677

Merged
wtgodbe merged 2 commits intorelease/9.0from
copilot/add-shallow-clones-for-ci
Jan 9, 2026
Merged

Backport #64657: Use shallow clones for CI jobs#64677
wtgodbe merged 2 commits intorelease/9.0from
copilot/add-shallow-clones-for-ci

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
@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
@wtgodbe wtgodbe added the tell-mode Indicates a PR which is being merged during tell-mode label Dec 6, 2025
@wtgodbe
Copy link
Member

wtgodbe commented Jan 7, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@adityamandaleeka adityamandaleeka marked this pull request as ready for review January 7, 2026 21:30
@adityamandaleeka adityamandaleeka requested a review from a team as a code owner January 7, 2026 21:30
Copilot AI review requested due to automatic review settings January 7, 2026 21:30
Copy link
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

This PR backports optimization changes from #64657 to the release/9.0 branch to improve CI efficiency by using shallow git clones. The changes reduce checkout time across parallel build jobs by avoiding full history and tag fetching where not needed.

Key changes:

  • Added fetchDepth and fetchTags parameters to the default-build template with defaults of 1 and false respectively
  • Set fetchDepth: 0 for Code_check jobs that require full git history for branch comparison operations

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
.azure/pipelines/jobs/default-build.yml Added fetchDepth and fetchTags parameters with optimization defaults; updated both public and internal checkout steps to use these parameters
.azure/pipelines/ci.yml Override fetchDepth to 0 for Code_check job which uses git diff against origin branch
.azure/pipelines/ci-public.yml Override fetchDepth to 0 for Code_check job which uses git diff against origin branch

@adityamandaleeka
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@wtgodbe
Copy link
Member

wtgodbe commented Jan 8, 2026

Will still fail until #64980 is in

@wtgodbe
Copy link
Member

wtgodbe commented Jan 9, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@wtgodbe wtgodbe merged commit c51e0b2 into release/9.0 Jan 9, 2026
29 of 31 checks passed
@wtgodbe wtgodbe deleted the copilot/add-shallow-clones-for-ci branch January 9, 2026 03:11
@dotnet-policy-service dotnet-policy-service bot modified the milestones: 9.0.x, 9.0.12 Jan 9, 2026
This was referenced Feb 12, 2026
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