2022-11-08 16:47:32 +00:00
|
|
|
### These steps clone the VMR (https://github.com/dotnet/dotnet) into $(Agent.BuildDirectory)/vmr
|
|
|
|
### Component Governance scan is also triggered over the VMR's non-repo sources
|
|
|
|
|
|
|
|
parameters:
|
|
|
|
- name: vmrBranch
|
|
|
|
displayName: dotnet/dotnet branch to use
|
|
|
|
type: string
|
|
|
|
default: $(Build.SourceBranchName)
|
|
|
|
|
2022-12-01 09:51:39 +00:00
|
|
|
- name: installerBuildResourceId
|
|
|
|
displayName: Installer build to get the commit hash to check out from
|
|
|
|
type: string
|
|
|
|
default: current
|
|
|
|
|
|
|
|
- name: skipComponentGovernanceDetection
|
|
|
|
type: boolean
|
|
|
|
default: false
|
|
|
|
|
2022-11-08 16:47:32 +00:00
|
|
|
steps:
|
|
|
|
- checkout: vmr
|
|
|
|
displayName: Clone dotnet/dotnet
|
|
|
|
path: vmr
|
2022-12-01 09:51:39 +00:00
|
|
|
clean: true
|
|
|
|
fetchDepth: 0 # We need this so that we can check out the new commit
|
|
|
|
|
|
|
|
- ${{ if ne(parameters.installerBuildResourceId, 'current') }}:
|
|
|
|
- download: ${{ parameters.installerBuildResourceId }}
|
|
|
|
artifact: VmrRevision
|
|
|
|
displayName: Download VmrRevision
|
2022-11-08 16:47:32 +00:00
|
|
|
|
2022-12-01 09:51:39 +00:00
|
|
|
- script: |
|
|
|
|
set -ex
|
|
|
|
sha=`head -n 1 $(Pipeline.Workspace)/${{ parameters.installerBuildResourceId }}/VmrRevision/VmrRevision.txt`
|
|
|
|
git checkout $sha
|
|
|
|
displayName: Check out dotnet/dotnet commit
|
|
|
|
workingDirectory: $(Agent.BuildDirectory)/vmr
|
|
|
|
- ${{ else }}:
|
|
|
|
- script: |
|
|
|
|
git switch -c ${{ parameters.vmrBranch }}
|
|
|
|
displayName: Checkout ${{ parameters.vmrBranch }}
|
|
|
|
workingDirectory: $(Agent.BuildDirectory)/vmr
|
2022-11-08 16:47:32 +00:00
|
|
|
|
|
|
|
# TODO (https://github.com/dotnet/arcade/issues/11332): Allow full CG?
|
|
|
|
# Currently, we ignore dirs of individual repos - they have been scanned before
|
2022-12-01 09:51:39 +00:00
|
|
|
- ${{ if and(not(parameters.skipComponentGovernanceDetection), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal')) }}:
|
2022-11-08 16:47:32 +00:00
|
|
|
- task: ComponentGovernanceComponentDetection@0
|
|
|
|
inputs:
|
|
|
|
sourceScanPath: $(Agent.BuildDirectory)/vmr
|
|
|
|
ignoreDirectories: $(Agent.BuildDirectory)/vmr/src
|