Skip to content

Commit b1a9b86

Browse files
[release/6.0] Disable CG in non-prod branches (#13229)
* Disable CG in non-prod branches * Add file --------- Co-authored-by: wtgodbe <[email protected]>
1 parent 585743e commit b1a9b86

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

eng/common/templates/job/job.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ parameters:
2424
enablePublishBuildAssets: false
2525
enablePublishTestResults: false
2626
enablePublishUsingPipelines: false
27-
disableComponentGovernance: false
27+
disableComponentGovernance: ''
2828
mergeTestResults: false
2929
testRunTitle: ''
3030
testResultsFormat: ''
@@ -141,9 +141,13 @@ jobs:
141141
richNavLogOutputDirectory: $(Build.SourcesDirectory)/artifacts/bin
142142
continueOnError: true
143143

144-
- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), ne(parameters.disableComponentGovernance, 'true')) }}:
145-
- task: ComponentGovernanceComponentDetection@0
146-
continueOnError: true
144+
- template: /eng/common/templates/steps/component-governance.yml
145+
parameters:
146+
${{ if eq(parameters.disableComponentGovernance, '') }}:
147+
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.runAsPublic, 'false'), or(contains(variables['Build.SourceBranch'], 'internal/release'), eq(variables['Build.SourceBranch'], 'main'))) }}:
148+
disableComponentGovernance: false
149+
${{ else }}:
150+
disableComponentGovernance: true
147151

148152
- ${{ if eq(parameters.enableMicrobuild, 'true') }}:
149153
- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
parameters:
2+
disableComponentGovernance: false
3+
4+
steps:
5+
- ${{ if eq(parameters.disableComponentGovernance, 'true') }}:
6+
- script: "echo ##vso[task.setvariable variable=skipComponentGovernanceDetection]true"
7+
displayName: Set skipComponentGovernanceDetection variable
8+
- ${{ if ne(parameters.disableComponentGovernance, 'true') }}:
9+
- task: ComponentGovernanceComponentDetection@0
10+
continueOnError: true

0 commit comments

Comments
 (0)