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
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
|
Loading…
Add table
Add a link
Reference in a new issue