Skip to content

Commit 2ec938f

Browse files
committed
Switch to using darc vmr forwardflow
1 parent 11150c0 commit 2ec938f

File tree

3 files changed

+27
-154
lines changed

3 files changed

+27
-154
lines changed

Diff for: eng/pipelines/templates/steps/vmr-pull-updates.yml

-7
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ steps:
4848
--tmp $(Agent.TempDirectory) \
4949
--azdev-pat '$(dn-bot-all-orgs-code-r)' \
5050
--branch ${{ parameters.vmrBranch }} \
51-
--repository "sdk:${{ parameters.targetRef }}" \
52-
--recursive \
53-
--remote "sdk:$(Agent.BuildDirectory)/sdk" \
54-
--tpn-template $(Agent.BuildDirectory)/sdk/src/VirtualMonoRepo/THIRD-PARTY-NOTICES.template.txt \
5551
--ci \
5652
--debug
5753
@@ -75,9 +71,6 @@ steps:
7571
-tmp $(Agent.TempDirectory) `
7672
-azdevPat '$(dn-bot-all-orgs-code-r)' `
7773
-branch ${{ parameters.vmrBranch }} `
78-
-repository "sdk:${{ parameters.targetRef }}" `
79-
-recursive `
80-
-tpnTemplate $(Agent.BuildDirectory)/sdk/src/VirtualMonoRepo/THIRD-PARTY-NOTICES.template.txt `
8174
-ci `
8275
-debugOutput
8376

Diff for: eng/vmr-sync.ps1

+12-60
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,31 @@
11
<#
22
.SYNOPSIS
33
4-
This script is used for synchronizing the dotnet/dotnet VMR locally. This means pulling new
5-
code from various repositories into the 'dotnet/dotnet' repository.
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.
67
78
.DESCRIPTION
89
9-
The script is used during CI to ingest new code based on dotnet/sdk but it can also help
10-
for reproducing potential failures during sdk's PRs, namely to fix the Source-Build.
11-
Another usecase is to try manually synchronizing a given commit of some repo into the VMR and
12-
trying to Source-Build the VMR. This can help when fixing the Source-Build but using a commit
13-
from a not-yet merged branch (or fork) to test the fix will help.
14-
15-
The tooling that synchronizes the VMR will need to clone the various repositories into a temporary
16-
folder. These clones can be re-used in future synchronizations so it is advised you dedicate a
17-
folder to this to speed up your re-runs.
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.
1813
1914
.EXAMPLE
20-
Synchronize current sdk and all dependencies into a local VMR:
15+
Synchronize current repository into a local VMR:
2116
./vmr-sync.ps1 -vmrDir "$HOME/repos/dotnet" -tmpDir "$HOME/repos/tmp"
2217
23-
Synchronize the VMR to a specific commit of dotnet/runtime using custom fork:
24-
./vmr-sync.ps1 `
25-
-repository runtime:e7e71da303af8dc97df99b098f21f526398c3943 `
26-
-remote runtime:https://github.com/yourfork/runtime `
27-
-tmpDir "$HOME/repos/tmp"
28-
2918
.PARAMETER tmpDir
3019
Required. Path to the temporary folder where repositories will be cloned
3120
3221
.PARAMETER vmrBranch
3322
Optional. Branch of the 'dotnet/dotnet' repo to synchronize. The VMR will be checked out to this branch
3423
35-
.PARAMETER recursive
36-
Optional. Recursively synchronize all the source build dependencies (declared in Version.Details.xml)
37-
This is used when performing the full synchronization during sdk's CI and the final VMR sync.
38-
Defaults to false unless no repository is supplied in which case a recursive sync of sdk is performed.
39-
4024
.PARAMETER remote
4125
Optional. Additional remote to use during the synchronization
4226
This can be used to synchronize to a commit from a fork of the repository
4327
Example: 'runtime:https://github.com/yourfork/runtime'
4428
45-
.PARAMETER repository
46-
Optional. Repository + git ref separated by colon to synchronize to.
47-
This can be a specific commit, branch, tag.
48-
If not supplied, the revision of the parent sdk repository of this script will be used (recursively).
49-
Example: 'runtime:my-branch-name'
50-
51-
.PARAMETER tpnTemplate
52-
Optional. Template for the header of VMRs THIRD-PARTY-NOTICES file.
53-
Defaults to src/VirtualMonoRepo/THIRD-PARTY-NOTICES.template.txt
54-
5529
.PARAMETER azdevPat
5630
Optional. Azure DevOps PAT to use for cloning private repositories.
5731
@@ -68,10 +42,7 @@ param (
6842
[Parameter(Mandatory=$true, HelpMessage="Path to the temporary folder where repositories will be cloned")]
6943
[string][Alias('t', 'tmp')]$tmpDir,
7044
[string][Alias('b', 'branch')]$vmrBranch,
71-
[switch]$recursive,
7245
[string]$remote,
73-
[string][Alias('r')]$repository,
74-
[string]$tpnTemplate = "src/VirtualMonoRepo/THIRD-PARTY-NOTICES.template.txt",
7546
[string]$azdevPat,
7647
[string][Alias('v', 'vmr')]$vmrDir,
7748
[switch]$ci,
@@ -115,19 +86,8 @@ if (-not $tmpDir) {
11586
exit 1
11687
}
11788

118-
if (-not (Test-Path -Path $tpnTemplate -PathType Leaf)) {
119-
Fail "File '$tpnTemplate' does not exist. Please specify a valid path to the THIRD-PARTY-NOTICES template"
120-
exit 1
121-
}
122-
12389
# Sanitize the input
12490

125-
# Default when no repository is provided
126-
if (-not $repository) {
127-
$repository = "sdk:$(git -C $sdkDir rev-parse HEAD)"
128-
$recursive = $true
129-
}
130-
13191
if (-not $vmrDir) {
13292
$vmrDir = Join-Path $tmpDir 'dotnet'
13393
}
@@ -169,24 +129,16 @@ $dotnetRoot = InitializeDotNetCli -install:$true
169129
$dotnet = "$dotnetRoot\dotnet.exe"
170130
& "$dotnet" tool restore
171131

172-
Highlight "Starting the synchronization of '$repository'.."
132+
Highlight "Starting the synchronization of VMR.."
173133

174134
# Synchronize the VMR
175135
$darcArgs = (
176-
"darc", "vmr", "update",
177-
"--vmr", $vmrDir,
136+
"darc", "vmr", "forwardflow",
137+
$vmrDir,
178138
"--tmp", $tmpDir,
179-
"--$verbosity",
180-
"--tpn-template", $tpnTemplate,
181-
"--discard-patches",
182-
"--generate-credscansuppressions",
183-
$repository
139+
"--$verbosity"
184140
)
185141

186-
if ($recursive) {
187-
$darcArgs += ("--recursive")
188-
}
189-
190142
if ($ci) {
191143
$darcArgs += ("--ci")
192144
}
@@ -205,7 +157,7 @@ if ($LASTEXITCODE -eq 0) {
205157
Highlight "Synchronization succeeded"
206158
}
207159
else {
208-
Fail "Synchronization of dotnet/dotnet to '$repository' failed!"
160+
Fail "Synchronization of repo to VMR failed!"
209161
Fail "'$vmrDir' is left in its last state (re-run of this script will reset it)."
210162
Fail "Please inspect the logs which contain path to the failing patch file (use -debugOutput to get all the details)."
211163
Fail "Once you make changes to the conflicting VMR patch, commit it locally and re-run this script."

Diff for: eng/vmr-sync.sh

+15-87
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,16 @@
11
#!/bin/bash
22

3-
### This script is used for synchronizing the dotnet/dotnet VMR locally. This means pulling new
4-
### code from various repositories into the 'dotnet/dotnet' repository.
3+
### This script is used for synchronizing the current repository into a local VMR.
4+
### It pulls the current repository's code into the specified VMR directory for local testing or
5+
### Source-Build validation.
56
###
6-
### The script is used during CI to ingest new code based on dotnet/sdk but it can also help
7-
### for reproducing potential failures during sdk's PRs, namely to fix the Source-Build.
8-
### Another usecase is to try manually synchronizing a given commit of some repo into the VMR and
9-
### trying to Source-Build the VMR. This can help when fixing the Source-Build but using a commit
10-
### from a not-yet merged branch (or fork) to test the fix will help.
11-
###
12-
### The tooling that synchronizes the VMR will need to clone the various repositories into a temporary
13-
### folder. These clones can be re-used in future synchronizations so it is advised you dedicate a
14-
### folder to this to speed up your re-runs.
7+
### The tooling used for synchronization will clone the VMR repository into a temporary folder if
8+
### it does not already exist. These clones can be reused in future synchronizations, so it is
9+
### recommended to dedicate a folder for this to speed up re-runs.
1510
###
1611
### USAGE:
17-
### Synchronize current sdk and all dependencies into a local VMR:
18-
### ./vmr-sync.sh --vmr "$HOME/repos/dotnet" --tmp "$HOME/repos/tmp"
19-
###
20-
### Synchronize the VMR to a specific commit of dotnet/runtime using custom fork:
21-
### ./vmr-sync.sh \
22-
### --repository runtime:e7e71da303af8dc97df99b098f21f526398c3943 \
23-
### --remote runtime:https://github.com/yourfork/runtime \
24-
### --tmp "$HOME/repos/tmp"
12+
### Synchronize current repository into a local VMR:
13+
### ./vmr-sync.sh --tmp "$HOME/repos/tmp" "$HOME/repos/dotnet"
2514
###
2615
### Options:
2716
### -t, --tmp, --tmp-dir PATH
@@ -33,26 +22,11 @@
3322
### --debug
3423
### Optional. Turns on the most verbose logging for the VMR tooling
3524
###
36-
### --recursive
37-
### Optional. Recursively synchronize all the source build dependencies (declared in Version.Details.xml)
38-
### This is used when performing the full synchronization during sdk's CI and the final VMR sync.
39-
### Defaults to false unless no repository is supplied in which case a recursive sync of sdk is performed.
40-
###
4125
### --remote name:URI
4226
### Optional. Additional remote to use during the synchronization
4327
### This can be used to synchronize to a commit from a fork of the repository
4428
### Example: 'runtime:https://github.com/yourfork/runtime'
4529
###
46-
### -r, --repository name:GIT_REF
47-
### Optional. Repository + git ref separated by colon to synchronize to.
48-
### This can be a specific commit, branch, tag.
49-
### If not supplied, the revision of the parent sdk repository of this script will be used (recursively).
50-
### Example: 'runtime:my-branch-name'
51-
###
52-
### --tpn-template
53-
### Optional. Template for the header of VMRs THIRD-PARTY-NOTICES file.
54-
### Defaults to src/VirtualMonoRepo/THIRD-PARTY-NOTICES.template.txt
55-
###
5630
### --azdev-pat
5731
### Optional. Azure DevOps PAT to use for cloning private repositories.
5832
###
@@ -90,25 +64,16 @@ function highlight () {
9064
}
9165

9266
# realpath is not available in macOS 12, try horrible-but-portable workaround
93-
sdk_dir=$(cd "$scriptroot/../"; pwd -P)
67+
repo_dir=$(cd "$scriptroot/../"; pwd -P)
9468

9569
tmp_dir=''
9670
vmr_dir=''
9771
vmr_branch=''
98-
repository=''
9972
additional_remotes=''
100-
recursive=false
10173
verbosity=verbose
102-
tpn_template="$sdk_dir/src/VirtualMonoRepo/THIRD-PARTY-NOTICES.template.txt"
103-
enable_build_lookup=''
10474
azdev_pat=''
10575
ci=false
10676

107-
# If sdk is a repo, we're in an sdk and not in the dotnet/dotnet repo
108-
if [[ -d "$sdk_dir/.git" ]]; then
109-
additional_remotes="sdk:$sdk_dir"
110-
fi
111-
11277
while [[ $# -gt 0 ]]; do
11378
opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")"
11479
case "$opt" in
@@ -124,24 +89,10 @@ while [[ $# -gt 0 ]]; do
12489
vmr_branch=$2
12590
shift
12691
;;
127-
-r|--repository)
128-
repository=$2
129-
shift
130-
;;
131-
--recursive)
132-
recursive=true
133-
;;
13492
--remote)
13593
additional_remotes="$additional_remotes $2"
13694
shift
13795
;;
138-
--tpn-template)
139-
tpn_template=$2
140-
shift
141-
;;
142-
--enable-build-lookup)
143-
enable_build_lookup="--enable-build-lookup"
144-
;;
14596
--azdev-pat)
14697
azdev_pat=$2
14798
shift
@@ -168,8 +119,8 @@ done
168119

169120
# Validation
170121

171-
if [[ ! -d "$sdk_dir" ]]; then
172-
fail "Directory '$sdk_dir' does not exist. Please specify the path to the dotnet/sdk repo"
122+
if [[ ! -d "$repo_dir" ]]; then
123+
fail "Directory '$repo_dir' does not exist. Please specify the path to the dotnet/sdk repo"
173124
exit 1
174125
fi
175126

@@ -178,19 +129,8 @@ if [[ -z "$tmp_dir" ]]; then
178129
exit 1
179130
fi
180131

181-
if [[ ! -f "$tpn_template" ]]; then
182-
fail "File '$tpn_template' does not exist. Please specify a valid path to the THIRD-PARTY-NOTICES template"
183-
exit 1
184-
fi
185-
186132
# Sanitize the input
187133

188-
# Default when no repository is provided
189-
if [[ -z "$repository" ]]; then
190-
repository="sdk:$(git -C "$sdk_dir" rev-parse HEAD)"
191-
recursive=true
192-
fi
193-
194134
if [[ -z "$vmr_dir" ]]; then
195135
vmr_dir="$tmp_dir/dotnet"
196136
fi
@@ -236,14 +176,9 @@ dotnetDir=$( cd $scriptroot/../.dotnet/; pwd -P )
236176
dotnet=$dotnetDir/dotnet
237177
"$dotnet" tool restore
238178

239-
highlight "Starting the synchronization of '$repository'.."
179+
highlight "Starting the synchronization of VMR.."
240180
set +e
241181

242-
recursive_arg=''
243-
if [[ "$recursive" == "true" ]]; then
244-
recursive_arg="--recursive"
245-
fi
246-
247182
if [[ -n "$additional_remotes" ]]; then
248183
additional_remotes="--additional-remotes $additional_remotes"
249184
fi
@@ -259,24 +194,17 @@ fi
259194

260195
# Synchronize the VMR
261196

262-
"$dotnet" darc vmr update \
263-
--vmr "$vmr_dir" \
197+
"$dotnet" darc vmr forwardflow "$vmr_dir" \
264198
--tmp "$tmp_dir" \
265199
$azdev_pat \
266200
--$verbosity \
267-
$recursive_arg \
268201
$ci_arg \
269-
$additional_remotes \
270-
--tpn-template "$tpn_template" \
271-
--discard-patches \
272-
--generate-credscansuppressions \
273-
$enable_build_lookup \
274-
"$repository"
202+
$additional_remotes
275203

276204
if [[ $? == 0 ]]; then
277205
highlight "Synchronization succeeded"
278206
else
279-
fail "Synchronization of dotnet/dotnet to '$repository' failed!"
207+
fail "Synchronization of repo to VMR failed!"
280208
fail "'$vmr_dir' is left in its last state (re-run of this script will reset it)."
281209
fail "Please inspect the logs which contain path to the failing patch file (use --debug to get all the details)."
282210
fail "Once you make changes to the conflicting VMR patch, commit it locally and re-run this script."

0 commit comments

Comments
 (0)