Skip to content

Commit d956f00

Browse files
Update dependencies from https://github.com/dotnet/dotnet build 268973 (#490)
No dependency updates to commit Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
1 parent 6eacb34 commit d956f00

File tree

6 files changed

+587
-4
lines changed

6 files changed

+587
-4
lines changed

eng/Version.Details.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Dependencies>
3-
<Source Uri="https://github.com/dotnet/dotnet" Mapping="source-build-externals" Sha="170498a9429a5553fe7ac0ec2341d19bbb97cbe8" BarId="268722" />
3+
<Source Uri="https://github.com/dotnet/dotnet" Mapping="source-build-externals" Sha="d60c3fe894af16cd15dc86420af0fc9d02be4997" BarId="268973" />
44
<ToolsetDependencies>
55
<Dependency Name="Microsoft.Build" Version="17.14.0-preview-24619-01">
66
<Uri>https://github.com/dotnet/msbuild</Uri>
77
<Sha>e9b99f554a3c298e1106ea171f5a0462780af2c5</Sha>
88
</Dependency>
9-
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="10.0.0-beta.25267.102">
9+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="10.0.0-beta.25269.109">
1010
<Uri>https://github.com/dotnet/dotnet</Uri>
11-
<Sha>170498a9429a5553fe7ac0ec2341d19bbb97cbe8</Sha>
11+
<Sha>d60c3fe894af16cd15dc86420af0fc9d02be4997</Sha>
1212
</Dependency>
1313
</ToolsetDependencies>
1414
</Dependencies>
Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
### These steps synchronize new code from product repositories into the VMR (https://github.com/dotnet/dotnet).
2+
### They initialize the darc CLI and pull the new updates.
3+
### Changes are applied locally onto the already cloned VMR (located in $vmrPath).
4+
5+
parameters:
6+
- name: targetRef
7+
displayName: Target revision in dotnet/<repo> to synchronize
8+
type: string
9+
default: $(Build.SourceVersion)
10+
11+
- name: vmrPath
12+
displayName: Path where the dotnet/dotnet is checked out to
13+
type: string
14+
default: $(Agent.BuildDirectory)/vmr
15+
16+
- name: additionalSyncs
17+
displayName: Optional list of package names whose repo's source will also be synchronized in the local VMR, e.g. NuGet.Protocol
18+
type: object
19+
default: []
20+
21+
steps:
22+
- checkout: vmr
23+
displayName: Clone dotnet/dotnet
24+
path: vmr
25+
clean: true
26+
27+
- checkout: self
28+
displayName: Clone $(Build.Repository.Name)
29+
path: repo
30+
fetchDepth: 0
31+
32+
# This step is needed so that when we get a detached HEAD / shallow clone,
33+
# we still pull the commit into the temporary repo clone to use it during the sync.
34+
# Also unshallow the clone so that forwardflow command would work.
35+
- script: |
36+
git branch repo-head
37+
git rev-parse HEAD
38+
displayName: Label PR commit
39+
workingDirectory: $(Agent.BuildDirectory)/repo
40+
41+
- script: |
42+
vmr_sha=$(grep -oP '(?<=Sha=")[^"]*' $(Agent.BuildDirectory)/repo/eng/Version.Details.xml)
43+
echo "##vso[task.setvariable variable=vmr_sha]$vmr_sha"
44+
displayName: Obtain the vmr sha from Version.Details.xml (Unix)
45+
condition: ne(variables['Agent.OS'], 'Windows_NT')
46+
workingDirectory: $(Agent.BuildDirectory)/repo
47+
48+
- powershell: |
49+
[xml]$xml = Get-Content -Path $(Agent.BuildDirectory)/repo/eng/Version.Details.xml
50+
$vmr_sha = $xml.SelectSingleNode("//Source").Sha
51+
Write-Output "##vso[task.setvariable variable=vmr_sha]$vmr_sha"
52+
displayName: Obtain the vmr sha from Version.Details.xml (Windows)
53+
condition: eq(variables['Agent.OS'], 'Windows_NT')
54+
workingDirectory: $(Agent.BuildDirectory)/repo
55+
56+
- script: |
57+
git fetch --all
58+
git checkout $(vmr_sha)
59+
displayName: Checkout VMR at correct sha for repo flow
60+
workingDirectory: ${{ parameters.vmrPath }}
61+
62+
- script: |
63+
git config --global user.name "dotnet-maestro[bot]"
64+
git config --global user.email "dotnet-maestro[bot]@users.noreply.github.com"
65+
displayName: Set git author to dotnet-maestro[bot]
66+
workingDirectory: ${{ parameters.vmrPath }}
67+
68+
- script: |
69+
./eng/common/vmr-sync.sh \
70+
--vmr ${{ parameters.vmrPath }} \
71+
--tmp $(Agent.TempDirectory) \
72+
--azdev-pat '$(dn-bot-all-orgs-code-r)' \
73+
--ci \
74+
--debug
75+
76+
if [ "$?" -ne 0 ]; then
77+
echo "##vso[task.logissue type=error]Failed to synchronize the VMR"
78+
exit 1
79+
fi
80+
displayName: Sync repo into VMR (Unix)
81+
condition: ne(variables['Agent.OS'], 'Windows_NT')
82+
workingDirectory: $(Agent.BuildDirectory)/repo
83+
84+
- script: |
85+
git config --global diff.astextplain.textconv echo
86+
git config --system core.longpaths true
87+
displayName: Configure Windows git (longpaths, astextplain)
88+
condition: eq(variables['Agent.OS'], 'Windows_NT')
89+
90+
- powershell: |
91+
./eng/common/vmr-sync.ps1 `
92+
-vmr ${{ parameters.vmrPath }} `
93+
-tmp $(Agent.TempDirectory) `
94+
-azdevPat '$(dn-bot-all-orgs-code-r)' `
95+
-ci `
96+
-debugOutput
97+
98+
if ($LASTEXITCODE -ne 0) {
99+
echo "##vso[task.logissue type=error]Failed to synchronize the VMR"
100+
exit 1
101+
}
102+
displayName: Sync repo into VMR (Windows)
103+
condition: eq(variables['Agent.OS'], 'Windows_NT')
104+
workingDirectory: $(Agent.BuildDirectory)/repo
105+
106+
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
107+
- task: CopyFiles@2
108+
displayName: Collect failed patches
109+
condition: failed()
110+
inputs:
111+
SourceFolder: '$(Agent.TempDirectory)'
112+
Contents: '*.patch'
113+
TargetFolder: '$(Build.ArtifactStagingDirectory)/FailedPatches'
114+
115+
- publish: '$(Build.ArtifactStagingDirectory)/FailedPatches'
116+
artifact: $(System.JobDisplayName)_FailedPatches
117+
displayName: Upload failed patches
118+
condition: failed()
119+
120+
- ${{ each assetName in parameters.additionalSyncs }}:
121+
# The vmr-sync script ends up staging files in the local VMR so we have to commit those
122+
- script:
123+
git commit --allow-empty -am "Forward-flow $(Build.Repository.Name)"
124+
displayName: Commit local VMR changes
125+
workingDirectory: ${{ parameters.vmrPath }}
126+
127+
- script: |
128+
set -ex
129+
130+
echo "Searching for details of asset ${{ assetName }}..."
131+
132+
# Use darc to get dependencies information
133+
dependencies=$(./.dotnet/dotnet darc get-dependencies --name '${{ assetName }}' --ci)
134+
135+
# Extract repository URL and commit hash
136+
repository=$(echo "$dependencies" | grep 'Repo:' | sed 's/Repo:[[:space:]]*//' | head -1)
137+
138+
if [ -z "$repository" ]; then
139+
echo "##vso[task.logissue type=error]Asset ${{ assetName }} not found in the dependency list"
140+
exit 1
141+
fi
142+
143+
commit=$(echo "$dependencies" | grep 'Commit:' | sed 's/Commit:[[:space:]]*//' | head -1)
144+
145+
echo "Updating the VMR from $repository / $commit..."
146+
cd ..
147+
git clone $repository ${{ assetName }}
148+
cd ${{ assetName }}
149+
git checkout $commit
150+
git branch "sync/$commit"
151+
152+
./eng/common/vmr-sync.sh \
153+
--vmr ${{ parameters.vmrPath }} \
154+
--tmp $(Agent.TempDirectory) \
155+
--azdev-pat '$(dn-bot-all-orgs-code-r)' \
156+
--ci \
157+
--debug
158+
159+
if [ "$?" -ne 0 ]; then
160+
echo "##vso[task.logissue type=error]Failed to synchronize the VMR"
161+
exit 1
162+
fi
163+
displayName: Sync ${{ assetName }} into (Unix)
164+
condition: ne(variables['Agent.OS'], 'Windows_NT')
165+
workingDirectory: $(Agent.BuildDirectory)/repo
166+
167+
- powershell: |
168+
$ErrorActionPreference = 'Stop'
169+
170+
Write-Host "Searching for details of asset ${{ assetName }}..."
171+
172+
$dependencies = .\.dotnet\dotnet darc get-dependencies --name '${{ assetName }}' --ci
173+
174+
$repository = $dependencies | Select-String -Pattern 'Repo:\s+([^\s]+)' | Select-Object -First 1
175+
$repository -match 'Repo:\s+([^\s]+)' | Out-Null
176+
$repository = $matches[1]
177+
178+
if ($repository -eq $null) {
179+
Write-Error "Asset ${{ assetName }} not found in the dependency list"
180+
exit 1
181+
}
182+
183+
$commit = $dependencies | Select-String -Pattern 'Commit:\s+([^\s]+)' | Select-Object -First 1
184+
$commit -match 'Commit:\s+([^\s]+)' | Out-Null
185+
$commit = $matches[1]
186+
187+
Write-Host "Updating the VMR from $repository / $commit..."
188+
cd ..
189+
git clone $repository ${{ assetName }}
190+
cd ${{ assetName }}
191+
git checkout $commit
192+
git branch "sync/$commit"
193+
194+
.\eng\common\vmr-sync.ps1 `
195+
-vmr ${{ parameters.vmrPath }} `
196+
-tmp $(Agent.TempDirectory) `
197+
-azdevPat '$(dn-bot-all-orgs-code-r)' `
198+
-ci `
199+
-debugOutput
200+
201+
if ($LASTEXITCODE -ne 0) {
202+
echo "##vso[task.logissue type=error]Failed to synchronize the VMR"
203+
exit 1
204+
}
205+
displayName: Sync ${{ assetName }} into (Windows)
206+
condition: ne(variables['Agent.OS'], 'Windows_NT')
207+
workingDirectory: $(Agent.BuildDirectory)/repo

eng/common/templates/vmr-build-pr.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
trigger: none
2+
pr:
3+
branches:
4+
include:
5+
- main
6+
- release/*
7+
paths:
8+
exclude:
9+
- documentation/*
10+
- README.md
11+
- CODEOWNERS
12+
13+
variables:
14+
- template: /eng/common/templates/variables/pool-providers.yml@self
15+
16+
- name: skipComponentGovernanceDetection # we run CG on internal builds only
17+
value: true
18+
19+
- name: Codeql.Enabled # we run CodeQL on internal builds only
20+
value: false
21+
22+
resources:
23+
repositories:
24+
- repository: vmr
25+
type: github
26+
name: dotnet/dotnet
27+
endpoint: dotnet
28+
29+
stages:
30+
- template: /eng/pipelines/templates/stages/vmr-build.yml@vmr
31+
parameters:
32+
isBuiltFromVmr: false
33+
scope: lite

eng/common/vmr-sync.ps1

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
<#
2+
.SYNOPSIS
3+
4+
This script is used for synchronizing the current repository into a local VMR.
5+
It pulls the current repository's code into the specified VMR directory for local testing or
6+
Source-Build validation.
7+
8+
.DESCRIPTION
9+
10+
The tooling used for synchronization will clone the VMR repository into a temporary folder if
11+
it does not already exist. These clones can be reused in future synchronizations, so it is
12+
recommended to dedicate a folder for this to speed up re-runs.
13+
14+
.EXAMPLE
15+
Synchronize current repository into a local VMR:
16+
./vmr-sync.ps1 -vmrDir "$HOME/repos/dotnet" -tmpDir "$HOME/repos/tmp"
17+
18+
.PARAMETER tmpDir
19+
Required. Path to the temporary folder where repositories will be cloned
20+
21+
.PARAMETER vmrBranch
22+
Optional. Branch of the 'dotnet/dotnet' repo to synchronize. The VMR will be checked out to this branch
23+
24+
.PARAMETER azdevPat
25+
Optional. Azure DevOps PAT to use for cloning private repositories.
26+
27+
.PARAMETER vmrDir
28+
Optional. Path to the dotnet/dotnet repository. When null, gets cloned to the temporary folder
29+
30+
.PARAMETER debugOutput
31+
Optional. Enables debug logging in the darc vmr command.
32+
33+
.PARAMETER ci
34+
Optional. Denotes that the script is running in a CI environment.
35+
#>
36+
param (
37+
[Parameter(Mandatory=$true, HelpMessage="Path to the temporary folder where repositories will be cloned")]
38+
[string][Alias('t', 'tmp')]$tmpDir,
39+
[string][Alias('b', 'branch')]$vmrBranch,
40+
[string]$remote,
41+
[string]$azdevPat,
42+
[string][Alias('v', 'vmr')]$vmrDir,
43+
[switch]$ci,
44+
[switch]$debugOutput
45+
)
46+
47+
function Fail {
48+
Write-Host "> $($args[0])" -ForegroundColor 'Red'
49+
}
50+
51+
function Highlight {
52+
Write-Host "> $($args[0])" -ForegroundColor 'Cyan'
53+
}
54+
55+
$verbosity = 'verbose'
56+
if ($debugOutput) {
57+
$verbosity = 'debug'
58+
}
59+
# Validation
60+
61+
if (-not $tmpDir) {
62+
Fail "Missing -tmpDir argument. Please specify the path to the temporary folder where the repositories will be cloned"
63+
exit 1
64+
}
65+
66+
# Sanitize the input
67+
68+
if (-not $vmrDir) {
69+
$vmrDir = Join-Path $tmpDir 'dotnet'
70+
}
71+
72+
if (-not (Test-Path -Path $tmpDir -PathType Container)) {
73+
New-Item -ItemType Directory -Path $tmpDir | Out-Null
74+
}
75+
76+
# Prepare the VMR
77+
78+
if (-not (Test-Path -Path $vmrDir -PathType Container)) {
79+
Highlight "Cloning 'dotnet/dotnet' into $vmrDir.."
80+
git clone https://github.com/dotnet/dotnet $vmrDir
81+
82+
if ($vmrBranch) {
83+
git -C $vmrDir switch -c $vmrBranch
84+
}
85+
}
86+
else {
87+
if ((git -C $vmrDir diff --quiet) -eq $false) {
88+
Fail "There are changes in the working tree of $vmrDir. Please commit or stash your changes"
89+
exit 1
90+
}
91+
92+
if ($vmrBranch) {
93+
Highlight "Preparing $vmrDir"
94+
git -C $vmrDir checkout $vmrBranch
95+
git -C $vmrDir pull
96+
}
97+
}
98+
99+
Set-StrictMode -Version Latest
100+
101+
# Prepare darc
102+
103+
Highlight 'Installing .NET, preparing the tooling..'
104+
. .\eng\common\tools.ps1
105+
$dotnetRoot = InitializeDotNetCli -install:$true
106+
$dotnet = "$dotnetRoot\dotnet.exe"
107+
& "$dotnet" tool restore
108+
109+
Highlight "Starting the synchronization of VMR.."
110+
111+
# Synchronize the VMR
112+
$darcArgs = (
113+
"darc", "vmr", "forwardflow",
114+
"--tmp", $tmpDir,
115+
"--$verbosity",
116+
$vmrDir
117+
)
118+
119+
if ($ci) {
120+
$darcArgs += ("--ci")
121+
}
122+
123+
if ($azdevPat) {
124+
$darcArgs += ("--azdev-pat", $azdevPat)
125+
}
126+
127+
& "$dotnet" $darcArgs
128+
129+
if ($LASTEXITCODE -eq 0) {
130+
Highlight "Synchronization succeeded"
131+
}
132+
else {
133+
Fail "Synchronization of repo to VMR failed!"
134+
Fail "'$vmrDir' is left in its last state (re-run of this script will reset it)."
135+
Fail "Please inspect the logs which contain path to the failing patch file (use -debugOutput to get all the details)."
136+
Fail "Once you make changes to the conflicting VMR patch, commit it locally and re-run this script."
137+
exit 1
138+
}

0 commit comments

Comments
 (0)