Add a pipeline for automated VMR synchronization (#14805)
Adds a pipeline that will trigger on main commits and synchronize the [VMR](https://github.com/dotnet/dotnet). The pipeline has 2 parameters: - What commit of installer to sync to (defaults to commit that triggered the build) - What branch of the VMR it pushes to (defaults to branch that triggered the build)
This commit is contained in:
parent
8c1708f378
commit
01edbc3965
6 changed files with 140 additions and 3 deletions
12
.config/dotnet-tools.json
Normal file
12
.config/dotnet-tools.json
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"isRoot": true,
|
||||||
|
"tools": {
|
||||||
|
"microsoft.dotnet.darc": {
|
||||||
|
"version": "1.1.0-beta.22527.1",
|
||||||
|
"commands": [
|
||||||
|
"darc"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -206,9 +206,13 @@
|
||||||
<Uri>https://github.com/dotnet/arcade</Uri>
|
<Uri>https://github.com/dotnet/arcade</Uri>
|
||||||
<Sha>c5dd6a1da2e6d9b3423ab809fcda8af2927a408b</Sha>
|
<Sha>c5dd6a1da2e6d9b3423ab809fcda8af2927a408b</Sha>
|
||||||
</Dependency>
|
</Dependency>
|
||||||
<Dependency Name="Microsoft.DotNet.DarcLib" Version="1.1.0-beta.22519.1">
|
<Dependency Name="Microsoft.DotNet.Darc" Version="1.1.0-beta.22527.1">
|
||||||
<Uri>https://github.com/dotnet/arcade-services</Uri>
|
<Uri>https://github.com/dotnet/arcade-services</Uri>
|
||||||
<Sha>f599f273949253b9826abb99f1bb12fabdb5bb00</Sha>
|
<Sha>96b70240e35894921b5bf33acb16590f0067fb52</Sha>
|
||||||
|
</Dependency>
|
||||||
|
<Dependency Name="Microsoft.DotNet.DarcLib" Version="1.1.0-beta.22527.1">
|
||||||
|
<Uri>https://github.com/dotnet/arcade-services</Uri>
|
||||||
|
<Sha>96b70240e35894921b5bf33acb16590f0067fb52</Sha>
|
||||||
</Dependency>
|
</Dependency>
|
||||||
<Dependency Name="Microsoft.Extensions.Logging.Console" Version="7.0.0-rc.1.22426.10">
|
<Dependency Name="Microsoft.Extensions.Logging.Console" Version="7.0.0-rc.1.22426.10">
|
||||||
<Uri>https://github.com/dotnet/runtime</Uri>
|
<Uri>https://github.com/dotnet/runtime</Uri>
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!-- Dependency from https://github.com/dotnet/arcade-services -->
|
<!-- Dependency from https://github.com/dotnet/arcade-services -->
|
||||||
<MicrosoftDotNetDarcLibVersion>1.1.0-beta.22519.1</MicrosoftDotNetDarcLibVersion>
|
<MicrosoftDotNetDarcLibVersion>1.1.0-beta.22527.1</MicrosoftDotNetDarcLibVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!-- Dependency from https://github.com/dotnet/winforms -->
|
<!-- Dependency from https://github.com/dotnet/winforms -->
|
||||||
|
|
76
eng/pipelines/templates/jobs/vmr-synchronization.yml
Normal file
76
eng/pipelines/templates/jobs/vmr-synchronization.yml
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
### These steps synchronize code from product repositories into the VMR (https://github.com/dotnet/dotnet)
|
||||||
|
|
||||||
|
parameters:
|
||||||
|
- name: targetRef
|
||||||
|
displayName: Target revision in dotnet/installer to synchronize
|
||||||
|
type: string
|
||||||
|
default: $(Build.SourceVersion)
|
||||||
|
|
||||||
|
- name: vmrBranch
|
||||||
|
displayName: dotnet/dotnet branch to use
|
||||||
|
type: string
|
||||||
|
default: $(Build.SourceBranchName)
|
||||||
|
|
||||||
|
- name: vmrToken
|
||||||
|
displayName: PAT that allows pushing to dotnet/dotnet
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
- job: Synchronize
|
||||||
|
displayName: Synchronize dotnet/dotnet
|
||||||
|
timeoutInMinutes: 120
|
||||||
|
|
||||||
|
pool:
|
||||||
|
${{ if eq(variables['System.TeamProject'], 'public') }}:
|
||||||
|
name: NetCore-Public
|
||||||
|
demands:
|
||||||
|
- ImageOverride -equals Build.Ubuntu.2004.Amd64.Open
|
||||||
|
${{ else }}:
|
||||||
|
name: NetCore1ESPool-Internal
|
||||||
|
demands:
|
||||||
|
- ImageOverride -equals Build.Ubuntu.2004.Amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- checkout: self
|
||||||
|
clean: true
|
||||||
|
displayName: Checkout dotnet/installer
|
||||||
|
fetchDepth: 0
|
||||||
|
path: installer
|
||||||
|
|
||||||
|
- checkout: vmr
|
||||||
|
clean: true
|
||||||
|
displayName: Checkout dotnet/dotnet
|
||||||
|
fetchDepth: 0
|
||||||
|
path: vmr
|
||||||
|
|
||||||
|
- script: |-
|
||||||
|
source ./eng/common/tools.sh
|
||||||
|
InitializeDotNetCli true
|
||||||
|
./.dotnet/dotnet tool restore
|
||||||
|
displayName: Restore toolset
|
||||||
|
workingDirectory: $(Agent.BuildDirectory)/installer
|
||||||
|
|
||||||
|
# TODO (https://github.com/dotnet/arcade/issues/11386): Remove this step
|
||||||
|
# This step is here so that darc can find the PR commit (which might be in some fork)
|
||||||
|
# We need to make darc understand that it needs to look in the fork from this PR
|
||||||
|
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
|
||||||
|
- script: |-
|
||||||
|
cp -r $(Agent.BuildDirectory)/installer $(Agent.TempDirectory)/installer
|
||||||
|
displayName: '[PR Only] Prepare dotnet/installer clone'
|
||||||
|
|
||||||
|
- script: |-
|
||||||
|
$(Agent.BuildDirectory)/installer/.dotnet/dotnet darc vmr update --vmr $(Agent.BuildDirectory)/vmr --tmp $(Agent.TempDirectory) --azdev-pat $(System.AccessToken) --github-pat ${{ parameters.vmrToken }} --recursive --verbose installer:${{ parameters.targetRef }}
|
||||||
|
displayName: Synchronize dotnet/dotnet
|
||||||
|
workingDirectory: $(Agent.BuildDirectory)/installer
|
||||||
|
|
||||||
|
- ${{ if and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal')) }}:
|
||||||
|
- script: |-
|
||||||
|
set -x
|
||||||
|
git config --global user.email 'dotnet-maestro[bot]@users.noreply.github.com' && git config --global user.name 'dotnet-maestro[bot]'
|
||||||
|
git remote add dotnet 'https://${{ parameters.vmrToken }}@github.com/dotnet/dotnet.git'
|
||||||
|
git fetch dotnet
|
||||||
|
git branch ${{ parameters.vmrBranch }}
|
||||||
|
git branch --set-upstream-to=dotnet/${{ parameters.vmrBranch }} ${{ parameters.vmrBranch }} || echo 'Branch ${{ parameters.vmrBranch }} not found in remote'
|
||||||
|
git push dotnet ${{ parameters.vmrBranch }}
|
||||||
|
displayName: Push changes to dotnet/dotnet
|
||||||
|
workingDirectory: $(Agent.BuildDirectory)/vmr
|
41
eng/vmr-synchronization.yml
Normal file
41
eng/vmr-synchronization.yml
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
### This pipeline synchronizes code from product repositories into the VMR (https://github.com/dotnet/dotnet)
|
||||||
|
|
||||||
|
parameters:
|
||||||
|
- name: targetRef
|
||||||
|
displayName: Target revision in dotnet/installer to synchronize
|
||||||
|
type: string
|
||||||
|
default: $(Build.SourceVersion)
|
||||||
|
|
||||||
|
- name: vmrBranch
|
||||||
|
displayName: dotnet/dotnet branch to use
|
||||||
|
type: string
|
||||||
|
default: $(Build.SourceBranchName)
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branches:
|
||||||
|
include:
|
||||||
|
- main
|
||||||
|
|
||||||
|
pr: none
|
||||||
|
|
||||||
|
resources:
|
||||||
|
repositories:
|
||||||
|
- repository: vmr
|
||||||
|
type: github
|
||||||
|
name: dotnet/dotnet
|
||||||
|
endpoint: dotnet
|
||||||
|
|
||||||
|
variables:
|
||||||
|
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
|
||||||
|
- group: DotNetBot-GitHub
|
||||||
|
|
||||||
|
- ${{ else }}:
|
||||||
|
- name: BotAccount-dotnet-bot-repo-PAT
|
||||||
|
value: N/A
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
- template: ./pipelines/templates/jobs/vmr-synchronization.yml
|
||||||
|
parameters:
|
||||||
|
targetRef: ${{ parameters.targetRef }}
|
||||||
|
vmrBranch: ${{ parameters.vmrBranch }}
|
||||||
|
vmrToken: $(BotAccount-dotnet-bot-repo-PAT)
|
|
@ -2,6 +2,7 @@
|
||||||
// The .NET Foundation licenses this file to you under the MIT license.
|
// The .NET Foundation licenses this file to you under the MIT license.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -48,6 +49,9 @@ public class VirtualMonoRepo_Initialize : Build.Utilities.Task, ICancelableTask
|
||||||
|
|
||||||
private async Task<bool> ExecuteAsync()
|
private async Task<bool> ExecuteAsync()
|
||||||
{
|
{
|
||||||
|
VmrPath = Path.GetFullPath(VmrPath);
|
||||||
|
TmpPath = Path.GetFullPath(TmpPath);
|
||||||
|
|
||||||
var vmrInitializer = _serviceProvider.Value.GetRequiredService<IVmrInitializer>();
|
var vmrInitializer = _serviceProvider.Value.GetRequiredService<IVmrInitializer>();
|
||||||
await vmrInitializer.InitializeRepository(Repository, Revision, PackageVersion, Recursive, _cancellationToken.Token);
|
await vmrInitializer.InitializeRepository(Repository, Revision, PackageVersion, Recursive, _cancellationToken.Token);
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue