Skip to content

[release/9.0.1xx] Backport a number of CI changes to make PRs work. - #25345

Merged
rolfbjarne merged 5 commits into
release/9.0.1xxfrom
dev/rolf/devops-9.0.1xx-backports-triggers
May 7, 2026
Merged

rolfbjarne merged 5 commits into
release/9.0.1xxfrom
dev/rolf/devops-9.0.1xx-backports-triggers

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

rolfbjarne and others added 5 commits May 6, 2026 08:21
The pull request #25177 ran the PR pipeline twice:

* https://dev.azure.com/devdiv/DevDiv/_build/results?buildId=13868591&view=results
* https://dev.azure.com/devdiv/DevDiv/_build/results?buildId=13868592&view=results

when it should only have been done once.

So I asked Copilot, which said:

    It was triggered twice because two different Azure triggers fired for the same change.

     - 13868591 was queued as individualCI for refs/heads/dev/rolf/nsurlsession-cleanup on commit b3223c4.
     - 13868592 was queued seconds later as pullRequest for refs/pull/25177/merge on the synthetic merge commit 7fccb8c.

    That matches the repo’s PR pipeline config in tools/devops/automation/build-pull-request.yml, which has both a branch trigger: for refs/heads/dev/* and a pr: trigger for '*'. So opening/updating PR #25177 caused one normal branch CI run and one PR-validation run.

So disable the branched-based trigger.
…25211)

Without an explicit trigger section, Azure DevOps defaults to enabling
CI triggers on all branches. This causes duplicate builds when a branch
(e.g. darc-main-*) has an open PR — one from the implicit CI trigger
and one from the PR trigger.

Adding 'trigger: none' ensures only PR-triggered builds run.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Treat PR merge refs as PR builds regardless of the reported build
reason, and consider synthetic merge commits current when one of their
parents matches the PR head. Also pass the checkout template's isPR flag
correctly so the fixed commit hash is used for PR comment handling.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Unfortunately Azure DevOps doesn't properly report GitHub checks for pipelines triggered by another pipeline, when that other pipeline was triggered from a pr trigger.

So go back to triggering the API diff pipeline using a pr: trigger.

This effectively reverts #21880 ("[CI] Make the API diff be triggered as soon as the config of the build is done.")

References:

* https://stackoverflow.com/questions/78443654/reporting-stage-statuses-to-github-for-pipeline-triggered-by-another-pipeline
Unfortunately Azure DevOps doesn't properly report GitHub checks for pipelines
triggered by another pipeline, when that other pipeline was triggered from a
pr trigger.

So start triggering this pipeline using a pr: trigger.

References:

* https://stackoverflow.com/questions/78443654/reporting-stage-statuses-to-github-for-pipeline-triggered-by-another-pipeline

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 6, 2026 06:23

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

Backports several Azure DevOps pipeline adjustments into release/9.0.1xx to improve GitHub PR check reporting and make PR validation behave correctly (especially around PR-triggered pipelines and latest-commit detection).

Changes:

  • Switch PR-related pipelines to use explicit pr: triggers (and disable unintended/implicit CI triggers where needed).
  • Add an option for the tests pipeline to build packages within the same pipeline (buildPackages) and wire stage dependencies accordingly.
  • Improve PR detection / latest-commit logic in the GitHub automation PowerShell module, with accompanying test updates.

Reviewed changes

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

Show a summary per file
File Description
tools/devops/automation/templates/windows/stage.yml Make Windows integration stage optionally depend on build_packages when not running as a post-pipeline.
tools/devops/automation/templates/tests-stage.yml Introduce buildPackages parameter, optionally add a build_packages stage, and adjust downstream stage dependencies and postPipeline wiring.
tools/devops/automation/templates/pipelines/run-tests-pipeline.yml Expose buildPackages pipeline parameter and pass through to the tests stage template.
tools/devops/automation/templates/common/configure.yml Emit TEST_MATRIX as an output variable and compute an output SIMULATOR_TEST_MATRIX for dependent stages.
tools/devops/automation/templates/common/checkout.yml Pass isPR through directly to IS_PR environment variable for checkout/merge-fix logic.
tools/devops/automation/scripts/GitHub.Tests.ps1 Extend tests for synthetic-merge/latest-commit detection and PR merge-ref PR detection (but currently contains a broken call site).
tools/devops/automation/scripts/GitHub.psm1 Add git helper functions and enhance IsCurrentCommitLatestInPR() to handle synthetic merge commits and cache results.
tools/devops/automation/run-pr-api-diff.yml Convert API diff pipeline to a pr: trigger with path filters.
tools/devops/automation/run-post-pr-build-tests.yml Convert post-build tests pipeline to a pr: trigger and configure it to build packages in-pipeline.
tools/devops/automation/build-pull-request.yml Disable branch CI triggers (trigger: none) to prevent duplicate PR builds when pr: is present.

Comment on lines +189 to +201
Write-Host "##vso[task.setvariable variable=TEST_MATRIX;isOutput=true]$testMatrix"

# also compute the simulator test matrix and set it as output variable so that
# dependent stages in post-build test pipelines can consume it
$simulatorTestMatrix = Get-TestConfiguration `
-TestConfigurations "$Env:TEST_CONFIGURATIONS" `
-SupportedPlatforms "$Env:SUPPORTED_PLATFORMS" `
-EnabledPlatforms "$Env:CONFIGURE_PLATFORMS_DOTNET_PLATFORMS" `
-TestsLabels "${{ parameters.testsLabels }}" `
-StatusContext "${{ parameters.statusContext }}" `
-StageFilter "simulator_tests"
$simulatorTestMatrix = $simulatorTestMatrix | ConvertFrom-Json | ConvertTo-Json -Compress
Write-Host "##vso[task.setvariable variable=SIMULATOR_TEST_MATRIX;isOutput=true]$simulatorTestMatrix"
Comment on lines +293 to +361
It 'returns true when the current commit is a synthetic merge commit for the latest PR head' {
Mock Invoke-Request {
return @{
"head" = @{
"sha" = "abc123def456"
}
"base" = @{
"ref" = "main"
}
}
} -ModuleName 'GitHub'
Mock Test-GitIsAncestor {
return $false
} -ModuleName 'GitHub'
Mock Get-GitCommitParents {
return @("basebranch123", "abc123def456")
} -ModuleName 'GitHub'

$result = Get-IsCurrentCommitLatestInPR -Org "testorg" -Repo "testrepo" -Token "test-token" -Hash "merge123456" -PrIDs @("123")
$result | Should -Be $true
}

It 'returns false when commit is in the base branch despite having the PR head as a parent' {
Mock Invoke-Request {
return @{
"head" = @{
"sha" = "prhead123"
}
"base" = @{
"ref" = "main"
}
}
} -ModuleName 'GitHub'
Mock Test-GitIsAncestor {
param ($Commit, $Branch)
# The commit is in the base branch
return $Branch -eq "origin/main"
} -ModuleName 'GitHub'
Mock Get-GitCommitParents {
return @("prhead123", "someothercommit")
} -ModuleName 'GitHub'

$result = Get-IsCurrentCommitLatestInPR -Org "testorg" -Repo "testrepo" -Token "test-token" -Hash "mergecommit456" -PrIDs @("123")
$result | Should -Be $false
}

It 'returns false when commit is in the PR branch despite having the PR head as a parent' {
Mock Invoke-Request {
return @{
"head" = @{
"sha" = "prhead123"
}
"base" = @{
"ref" = "main"
}
}
} -ModuleName 'GitHub'
Mock Test-GitIsAncestor {
param ($Commit, $Branch)
# The commit is in the PR branch (ancestor of PR head)
return $Branch -eq "prhead123"
} -ModuleName 'GitHub'
Mock Get-GitCommitParents {
return @("prhead123", "someothercommit")
} -ModuleName 'GitHub'

$result = Get-IsCurrentCommitLatestInPR -Org "testorg" -Repo "testrepo" -Token "test-token" -Hash "mergecommit456" -PrIDs @("123")
$result | Should -Be $false
}
@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #a071674] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: a071674c613fde997f5802b887656f29fe3b6d6a [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [CI Build #a071674] Build passed (Build packages) ✅

Pipeline on Agent
Hash: a071674c613fde997f5802b887656f29fe3b6d6a [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #a071674] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: a071674c613fde997f5802b887656f29fe3b6d6a [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: a071674c613fde997f5802b887656f29fe3b6d6a [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

💻 [PR Build #a071674] Tests on macOS X64 - Mac Sonoma (14) passed 💻

✅ All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: a071674c613fde997f5802b887656f29fe3b6d6a [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

💻 [PR Build #a071674] Tests on macOS M1 - Mac Monterey (12) passed 💻

✅ All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: a071674c613fde997f5802b887656f29fe3b6d6a [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

💻 [PR Build #a071674] Tests on macOS M1 - Mac Ventura (13) passed 💻

✅ All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: a071674c613fde997f5802b887656f29fe3b6d6a [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

💻 [PR Build #a071674] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

✅ All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: a071674c613fde997f5802b887656f29fe3b6d6a [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

💻 [PR Build #a071674] Tests on macOS arm64 - Mac Tahoe (26) passed 💻

✅ All tests on macOS arm64 - Mac Tahoe (26) passed.

Pipeline on Agent
Hash: a071674c613fde997f5802b887656f29fe3b6d6a [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne
rolfbjarne enabled auto-merge (squash) May 6, 2026 12:02
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [CI Build #a071674] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 128 tests passed 🎉

Tests counts

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 6 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 10 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 15 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 12 tests passed. [attempt 7] Html Report (VSDrops) Download
✅ monotouch (tvOS): All 10 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: a071674c613fde997f5802b887656f29fe3b6d6a [PR build]

@rolfbjarne
rolfbjarne merged commit fde6239 into release/9.0.1xx May 7, 2026
51 checks passed
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.

4 participants