dotnet-installer/eng/pipelines/templates/jobs/vmr-synchronization.yml

66 lines
2.5 KiB
YAML

### This job synchronizes code from product repositories into the VMR (https://github.com/dotnet/dotnet)
### It synchronizes the content of the VMR to this new commit and pushes the changes
parameters:
- name: targetRef
displayName: Target revision of dotnet/installer to synchronize
type: string
default: $(Build.SourceVersion)
- name: vmrBranch
displayName: dotnet/dotnet branch to use
type: string
default: $(Build.SourceBranchName)
- name: noPush
displayName: Don't push changes to dotnet/dotnet
type: boolean
default: false
jobs:
- job: Synchronize_VMR
displayName: Synchronize dotnet/dotnet
timeoutInMinutes: 120
variables:
- template: /eng/common/templates/variables/pool-providers.yml
- name: vmrPath
value: $(Agent.BuildDirectory)/vmr
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
- group: DotNetBot-GitHub
- ${{ else }}:
- name: BotAccount-dotnet-bot-repo-PAT
value: N/A
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
name: $(DncEngPublicBuildPool)
demands: ImageOverride -equals Build.Ubuntu.2004.Amd64.Open
${{ if eq(variables['System.TeamProject'], 'internal') }}:
name: $(DncEngInternalBuildPool)
demands: ImageOverride -equals Build.Ubuntu.2004.Amd64
steps:
- template: ../steps/vmr-prepare.yml
parameters:
vmrBranch: ${{ parameters.vmrBranch }}
isBuiltFromVmr: false
- template: ../steps/vmr-pull-updates.yml
parameters:
vmrPath: $(vmrPath)
vmrBranch: ${{ parameters.vmrBranch }}
targetRef: ${{ parameters.targetRef }}
# For official builds, push the changes to the VMR
# Push only main and release branches
- ${{ if and(not(parameters.noPush), or(eq(parameters.vmrBranch, 'main'), startsWith(parameters.vmrBranch, 'release/')), not(in(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://$(BotAccount-dotnet-bot-repo-PAT)@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: $(vmrPath)