103 lines
3.5 KiB
YAML
103 lines
3.5 KiB
YAML
### 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
|
|
|
|
- name: noPush
|
|
displayName: Don't push changes to dotnet/dotnet
|
|
type: boolean
|
|
default: false
|
|
|
|
jobs:
|
|
- job: Synchronize
|
|
displayName: Synchronize dotnet/dotnet
|
|
timeoutInMinutes: 120
|
|
|
|
variables:
|
|
- name: vmrPath
|
|
value: $(Agent.BuildDirectory)/vmr
|
|
|
|
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
|
|
|
|
# TODO (https://github.com/dotnet/arcade/issues/11332): Allow full CG?
|
|
# Currently, we ignore dirs of individual repos - they have been scanned before
|
|
- ${{ if and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal')) }}:
|
|
- task: ComponentGovernanceComponentDetection@0
|
|
inputs:
|
|
sourceScanPath: $(vmrPath)
|
|
ignoreDirectories: $(vmrPath)/src
|
|
|
|
- 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: git checkout -B ${{ parameters.vmrBranch }}
|
|
displayName: Prepare branch ${{ parameters.vmrBranch }}
|
|
workingDirectory: $(vmrPath)
|
|
|
|
- script: >
|
|
$(Agent.BuildDirectory)/installer/.dotnet/dotnet darc vmr update
|
|
--vmr $(vmrPath)
|
|
--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(not(parameters.noPush), 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 --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)
|