Skip to content

Commit 76cb375

Browse files
max-charlambMax Charlamb
andauthored
Sync cDAC and universal DBI source together (#6195)
## Summary - Replace the separate cDAC and universal DBI mirroring workflows with one scheduled/manual workflow and one update PR. - Resolve dotnet/runtime main once, pass that exact commit to both import scripts, and verify both source markers match before publishing. - Stage both source trees and commit markers together whenever either mirror changes, keeping the private DAC/DBI ABI aligned. - Update both READMEs for the consolidated workflow and automation branch. This prevents mismatched cDAC and DBI updates such as #6192. The branch allowlist in the unmerged #6160 will need a separate update for `automation/sync-runtime-source`. ## Validation - Parsed workflow YAML and checked embedded PowerShell and Bash syntax. - Exercised pinned-commit propagation, failures in either updater, mismatched source markers, and invalid commits. - Exercised staging for cDAC-only, DBI-only, combined, and marker-only changes. Co-authored-by: Max Charlamb <maxcharlamb@microsoft.com> Copilot-Session: 56b7f1ec-323f-44e6-bee9-b2af0e9fc062
1 parent e84c09c commit 76cb375

4 files changed

Lines changed: 34 additions & 109 deletions

File tree

‎.github/workflows/sync-dbi.yml‎

Lines changed: 0 additions & 88 deletions
This file was deleted.
Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: Sync cDAC source
1+
name: Sync cDAC and universal DBI source
22

33
on:
44
workflow_dispatch:
55
schedule:
66
- cron: '0 8 * * *'
77

88
concurrency:
9-
group: cdac-source-sync
9+
group: runtime-source-sync
1010
cancel-in-progress: false
1111

1212
jobs:
@@ -28,37 +28,42 @@ jobs:
2828
path: runtime
2929
ref: main
3030
persist-credentials: false
31-
- name: Update the runtime source snapshot
31+
- name: Update the cDAC and DBI runtime source snapshots
3232
id: mirror
3333
shell: pwsh
3434
working-directory: diagnostics
3535
run: |
3636
$ErrorActionPreference = 'Stop'
37-
./src/cdac/update-source.ps1 -RuntimeRoot ../runtime
38-
$commit = (Get-Content src/cdac/runtime-source.txt -Raw).Trim()
39-
if ($commit -notmatch '^[0-9a-f]{40}$') { throw 'The runtime source commit is invalid.' }
37+
$commit = (& git -C ../runtime rev-parse 'HEAD^{commit}').Trim()
38+
if ($LASTEXITCODE -ne 0 -or $commit -notmatch '^[0-9a-f]{40}$') { throw 'The runtime source commit is invalid.' }
39+
./src/cdac/update-source.ps1 -RuntimeRoot ../runtime -Commit $commit
40+
./src/dbi/update-source.ps1 -RuntimeRoot ../runtime -Commit $commit
41+
foreach ($component in 'cdac', 'dbi') {
42+
$mirroredCommit = (Get-Content "src/$component/runtime-source.txt" -Raw).Trim()
43+
if ($mirroredCommit -ne $commit) { throw "The $component source snapshot does not match runtime commit '$commit'." }
44+
}
4045
"commit=$commit" >> $env:GITHUB_OUTPUT
4146
- name: Create or update the source-sync pull request
4247
working-directory: diagnostics
4348
env:
4449
GH_TOKEN: ${{ github.token }}
4550
BASE_BRANCH: ${{ github.event.repository.default_branch }}
46-
PR_BRANCH: automation/sync-cdac
51+
PR_BRANCH: automation/sync-runtime-source
4752
RUNTIME_COMMIT: ${{ steps.mirror.outputs.commit }}
4853
run: |
4954
set -euo pipefail
5055
51-
git add -- src/cdac/runtime
56+
git add -- src/cdac/runtime src/dbi/runtime
5257
if git diff --cached --quiet; then
5358
echo "The mirrored source is already current."
5459
exit 0
5560
fi
56-
git add -- src/cdac/runtime-source.txt
61+
git add -- src/cdac/runtime-source.txt src/dbi/runtime-source.txt
5762
5863
git config user.name "github-actions[bot]"
5964
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
6065
git switch -c "$PR_BRANCH"
61-
git commit -m "Update cDAC source to runtime $RUNTIME_COMMIT"
66+
git commit -m "Update cDAC and DBI source to runtime $RUNTIME_COMMIT"
6267
6368
push_options=(--force-with-lease="refs/heads/$PR_BRANCH:")
6469
if remote_ref=$(git ls-remote --exit-code --heads origin "$PR_BRANCH" | cut -f1); then
@@ -79,7 +84,9 @@ jobs:
7984
--repo "$GITHUB_REPOSITORY" \
8085
--base "$BASE_BRANCH" \
8186
--head "$PR_BRANCH" \
82-
--title "Update mirrored cDAC source" \
83-
--body "Updates the managed cDAC reader, generator and linked sources from [dotnet/runtime@$RUNTIME_COMMIT](https://github.com/dotnet/runtime/commit/$RUNTIME_COMMIT).
87+
--title "Update mirrored cDAC and universal DBI source" \
88+
--body "Updates the managed cDAC reader, generator and linked sources together with the universal DBI and its private PAL from [dotnet/runtime@$RUNTIME_COMMIT](https://github.com/dotnet/runtime/commit/$RUNTIME_COMMIT).
8489
85-
The mirrored source tracks the latest \`dotnet/runtime\` main commit resolved when this workflow runs. The imported paths come from runtime's \`src/native/managed/cdac/SourceManifest.props\`."
90+
Both snapshots use the same runtime commit so the DAC/DBI interface stays in sync. The mirrored source tracks the latest \`dotnet/runtime\` main commit resolved when this workflow runs.
91+
92+
The imported paths come from runtime's \`src/native/managed/cdac/SourceManifest.props\` and \`src/coreclr/dlls/mscordbi_universal/SourceManifest.props\`."

‎src/cdac/README.md‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ exact runtime commit used for the current copy.
1010

1111
## Updating the mirrored source
1212

13-
1. Open the [Sync cDAC source](https://github.com/dotnet/diagnostics/actions/workflows/sync-cdac.yml) workflow.
13+
1. Open the [Sync cDAC and universal DBI source](https://github.com/dotnet/diagnostics/actions/workflows/sync-runtime-source.yml) workflow.
1414
2. Select **Run workflow** and run it from the default branch.
1515
3. Review the pull request created or updated by the workflow.
1616
4. Merge the pull request after its normal validation completes.
1717

18-
The workflow copies the latest source from the runtime `main` branch using
19-
runtime's `src/native/managed/cdac/SourceManifest.props` manifest. It maintains
20-
the `automation/sync-cdac` branch and reuses its existing pull request when one
21-
is open.
18+
The workflow updates cDAC and the universal DBI together from the same runtime
19+
`main` commit so their private DAC/DBI interface stays in sync. It uses runtime's
20+
`src/native/managed/cdac/SourceManifest.props` and
21+
`src/coreclr/dlls/mscordbi_universal/SourceManifest.props` manifests. It maintains
22+
the `automation/sync-runtime-source` branch and reuses its existing pull request
23+
when one is open.

‎src/dbi/README.md‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@ output directory. The cDAC transport package is not used.
1414

1515
## Updating the mirrored source
1616

17-
1. Open the **Sync universal DBI source** workflow.
17+
1. Open the [Sync cDAC and universal DBI source](https://github.com/dotnet/diagnostics/actions/workflows/sync-runtime-source.yml) workflow.
1818
2. Run it from the default branch.
1919
3. Review the pull request created or updated by the workflow.
2020
4. Merge the pull request after its normal validation completes.
2121

22-
The workflow uses runtime's
23-
`src/coreclr/dlls/mscordbi_universal/SourceManifest.props` manifest.
22+
The workflow updates cDAC and the universal DBI together from the same runtime
23+
`main` commit so their private DAC/DBI interface stays in sync. It uses runtime's
24+
`src/native/managed/cdac/SourceManifest.props` and
25+
`src/coreclr/dlls/mscordbi_universal/SourceManifest.props` manifests. It maintains
26+
the `automation/sync-runtime-source` branch and reuses its existing pull request
27+
when one is open.

0 commit comments

Comments
 (0)