Skip to content

Skip CI build/test legs for documentation- and .github-only changes - #14371

Merged
jankratochvilcz merged 2 commits into
mainfrom
jankratochvilcz-skip-ci-for-docs-only-changes
Jul 15, 2026
Merged

jankratochvilcz merged 2 commits into
mainfrom
jankratochvilcz-skip-ci-for-docs-only-changes

Conversation

@jankratochvilcz

Copy link
Copy Markdown
Contributor

Problem

PRs that touch only .github/** or documentation/** still run full multi-minute builds on every msbuild-pr leg. For example, on #14369 (two .github/workflows/* files) the legs ran: Windows Full 12m, Windows Core 9m46s, Linux Core 8m54s, Windows Full Release 6m42s — none of which exercise anything real for a docs/workflow change.

Root cause

The onlyDocChanged detection (azure-pipelines/check-documentation-only-change.yml) already covers .github/ and works correctly — it set onlyDocChanged=1 for #14369. The problem is what onlyDocChanged=1 did:

  • cibuild_bootstrapped_msbuild.sh/.ps1 still run both build stages when onlyDocChanged=1; they only drop --test and bootstrap creation.
  • The CI Build steps on Linux Core and macOS Core had no condition — the eq(variables.onlyDocChanged, 0) line beneath them actually belonged to the coverage step — so they always did a full build.
  • Only Linux Core Multithreaded Mode was correctly gated with a step-level condition.
  • msbuild-quarantine hardcoded -onlyDocChanged 0 and had no skip at all.

Fix

Gate every heavy build step on condition: eq(variables.onlyDocChanged, 0), matching the one leg that already did this, and remove the now-redundant cibuild.cmd without test fallback in the Windows Full Release leg. Apply the same inline skip to the three msbuild-quarantine legs.

This reuses the existing inline check-documentation-only-change.yml template in each job — no new cross-job dependency, no added latency for normal PRs, no hardcoded container definitions or Arcade-internal edits. Doc/.github-only PRs now finish these legs in agent + checkout time.

Note: the arcade Source-Build (Managed) leg (~4 min) is intentionally left as-is. Gating it would require duplicating Arcade's default source-build platform/container definition in this repo (a drift/fragility risk), which isn't worth it for a ~4 min leg.

Behavior for required checks

Jobs still run and report success; only their build/test steps are skipped, so required status checks stay green quickly rather than being left unreported.

The onlyDocChanged mechanism only skipped tests, not the build: several
build steps (Linux Core, macOS Core, Windows legs) had no condition and
always ran a full ~8-12 min build even for PRs touching only .github/**
or documentation/** (the eq(onlyDocChanged, 0) line beneath them belonged
to the coverage step). Only the "Linux Core Multithreaded Mode" leg was
correctly gated.

Gate every build step on eq(variables.onlyDocChanged, 0), matching the
one leg that already did this, and remove the now-redundant
"cibuild.cmd without test" fallback. Apply the same inline skip to the
three msbuild-quarantine legs, which previously hardcoded onlyDocChanged=0
and always ran.

Uses the existing check-documentation-only-change.yml template inline in
each job (no cross-job dependency, no build latency for normal PRs), so
doc/.github-only PRs finish these legs in agent+checkout time instead of
running full builds.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 95de2e0b-cc2f-47fc-a95a-3d66f8cd1d1a
Copilot AI review requested due to automatic review settings July 15, 2026 12:13
@jankratochvilcz
jankratochvilcz requested a review from a team as a code owner July 15, 2026 12:13

Copilot AI left a comment

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.

Pull request overview

This PR optimizes MSBuild’s Azure Pipelines validation by skipping expensive build/test steps when a PR changes only documentation (documentation/**) or workflow/config content (.github/**), while still allowing required checks to complete quickly.

Changes:

  • Gate heavyweight CI build steps in .vsts-dotnet-ci.yml on onlyDocChanged == 0, and remove the Windows Full Release “build without test” fallback.
  • Apply the same doc-only detection template to azure-pipelines/quarantine.yml jobs and gate the quarantined-test build steps on onlyDocChanged == 0.

Reviewed changes

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

File Description
azure-pipelines/quarantine.yml Adds doc-only change detection and skips quarantined-test build steps when appropriate.
.vsts-dotnet-ci.yml Adds onlyDocChanged gating to previously-ungated CI build steps and removes redundant fallback build step.

Comment thread azure-pipelines/quarantine.yml Resolved
Comment thread azure-pipelines/quarantine.yml Resolved
Comment thread azure-pipelines/quarantine.yml Resolved
Comment thread .vsts-dotnet-ci.yml Resolved
Comment thread .vsts-dotnet-ci.yml Resolved
Comment thread .vsts-dotnet-ci.yml Resolved
Comment thread .vsts-dotnet-ci.yml Resolved
Comment thread .vsts-dotnet-ci.yml Resolved
Comment thread azure-pipelines/quarantine.yml Resolved
…runs

quarantine.yml also runs on a daily schedule (and rolling main builds) to
collect quarantined-test data. Gating purely on onlyDocChanged would skip
that revalidation whenever the latest commit is docs-only. Guard the skip
with Build.Reason == PullRequest so only PR validation skips doc-only
changes; scheduled and CI runs always execute.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 95de2e0b-cc2f-47fc-a95a-3d66f8cd1d1a

@github-actions github-actions Bot left a comment

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.

Code Review Summary

✅ 24/24 dimensions clean — no findings.

This PR correctly extends the existing onlyDocChanged gating pattern to additional CI legs and quarantine jobs. The template paths are correct (repo-root-relative), the condition syntax matches established usage, and removing the redundant build-without-test fallback is a good simplification.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

Generated by Expert Code Review (on open) for #14371 · 65 AIC · ⌖ 7.36 AIC · ⊞ 4.8K

@jankratochvilcz

Copy link
Copy Markdown
Contributor Author

/azp run msbuild-pr

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@jankratochvilcz
jankratochvilcz merged commit 611b7e3 into main Jul 15, 2026
10 checks passed
@jankratochvilcz
jankratochvilcz deleted the jankratochvilcz-skip-ci-for-docs-only-changes branch July 15, 2026 16:17
AlesProkop pushed a commit that referenced this pull request Jul 24, 2026
Quarantines 2 intermittently failing tests detected across multiple
independent CI sources.

---

## `NuGetStaticGraphRestore_InheritsCoordinatorGrant_DoesNotDeadlock`

**Flaky-test key** (automated de-duplication — do not edit):
```text
flaky-test-id: Microsoft.Build.Coordinator.UnitTests.CoordinatorIntegration_Tests.NuGetStaticGraphRestore_InheritsCoordinatorGrant_DoesNotDeadlock
```

**Action:** Quarantine (6a)
Tracked by #14488

- **Distinct sources:** 5 (2 PRs + 3 rolling builds)
- **PRs:** #14371, #14401
- **Rolling builds:**
[1511941](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1511941),
[1517682](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1517682),
[1519967](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1519967)
- **Legs/TFMs:** CoreOnMac, FullOnWindows, FullOnWindows Release /
net10.0, net472
- **Assembly:** MSBuild.Coordinator.UnitTests
- **Window:** 2026-07-15 – 2026-07-21
- **Sample error:** `System.TimeoutException : Test failed due to
timeout: process is active for more than 60 sec.`

---

## `TaskExceptionHandlingTest`

**Flaky-test key** (automated de-duplication — do not edit):
```text
flaky-test-id: Microsoft.Build.UnitTests.BackEnd.TaskExecutionHost_Tests.TaskExceptionHandlingTest
```

**Action:** Quarantine (6a)
Tracked by #14459

- **Distinct sources:** 5 (1 PR + 4 rolling builds)
- **PRs:** #14315
- **Rolling builds:**
[1510684](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1510684),
[1517216](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1517216),
[1519472](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1519472),
[1519928](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1519928)
- **Legs/TFMs:** FullOnWindows Release / net472
- **Assembly:** Microsoft.Build.Engine.UnitTests
- **Window:** 2026-07-15 – 2026-07-21
- **Sample error:** `Shouldly.ShouldAssertException` in
`TaskExceptionHandlingTest`




> [!WARNING]
> <details>
> <summary>Firewall blocked 2 domains</summary>
>
> The following domains were blocked by the firewall during workflow
execution:
>
> - `awmgmcpg`
> - `southcentralus0.in.applicationinsights.azure.com`
>> To allow these domains, add them to the `network.allowed` list in
your workflow frontmatter:
>
> ```yaml
> network:
>   allowed:
>     - defaults
>     - "awmgmcpg"
>     - "southcentralus0.in.applicationinsights.azure.com"
> ```
>
> See [Network
Configuration](https://github.github.com/gh-aw/reference/network/) for
more information.
>
> </details>


> Generated by [Flaky Test
Triage](https://github.com/dotnet/msbuild/actions/runs/30006270630) ·
126 AIC · ⌖ 6.2 AIC · ⊞ 14.8K ·
[◷](https://github.com/search?q=repo%3Adotnet%2Fmsbuild+%22gh-aw-workflow-id%3A+flaky-test-detector.agent%22&type=pullrequests)

<!-- gh-aw-agentic-workflow: Flaky Test Triage, engine: copilot,
version: 1.0.70, model: claude-sonnet-4.6, id: 30006270630, workflow_id:
flaky-test-detector.agent, run:
https://github.com/dotnet/msbuild/actions/runs/30006270630 -->

<!-- gh-aw-workflow-id: flaky-test-detector.agent -->
<!-- gh-aw-workflow-call-id: dotnet/msbuild/flaky-test-detector.agent
-->

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <[email protected]>
AR-May added a commit that referenced this pull request Sep 7, 2026
The quarantine pipeline has not run since #14371. It fails
while parsing YAML.

Cause: `template:` paths resolve relative to the file that contains
them.
`quarantine.yml` is already in `azure-pipelines/`, so the extra prefix
pointed to
a folder that does not exist.

Co-authored-by: Copilot App <[email protected]>
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