From a69e93f1ec2ceada589f1b278f7bb3a768e18b28 Mon Sep 17 00:00:00 2001 From: Jan Krivanek Date: Fri, 21 Apr 2023 19:58:03 +0200 Subject: [PATCH 1/3] Customize opt-in for CG step --- .vsts-dotnet.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.vsts-dotnet.yml b/.vsts-dotnet.yml index c32ce098b34..45259b8ae5d 100644 --- a/.vsts-dotnet.yml +++ b/.vsts-dotnet.yml @@ -249,7 +249,14 @@ stages: - task: ms-vseng.MicroBuildTasks.521a94ea-9e68-468a-8167-6dcf361ea776.MicroBuildCleanup@1 displayName: Execute cleanup tasks condition: succeededOrFailed() - + + - template: /eng/common/templates/steps/component-governance.yml + parameters: + ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.runAsPublic, 'false'), or(startsWith(variables['Build.SourceBranch'], 'vs'), eq(variables['Build.SourceBranch'], 'main'))) }}: + disableComponentGovernance: false + ${{ else }}: + disableComponentGovernance: true + - template: /eng/common/templates/job/source-build.yml parameters: platform: From 1630db43a02c97d0a8d5ebe0f5a7b35b304bc606 Mon Sep 17 00:00:00 2001 From: Jan Krivanek Date: Fri, 21 Apr 2023 20:08:25 +0200 Subject: [PATCH 2/3] Reflected suggestion from @wtgodbe --- .vsts-dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vsts-dotnet.yml b/.vsts-dotnet.yml index 45259b8ae5d..f20b1233fc4 100644 --- a/.vsts-dotnet.yml +++ b/.vsts-dotnet.yml @@ -252,7 +252,7 @@ stages: - template: /eng/common/templates/steps/component-governance.yml parameters: - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.runAsPublic, 'false'), or(startsWith(variables['Build.SourceBranch'], 'vs'), eq(variables['Build.SourceBranch'], 'main'))) }}: + ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), or(startsWith(variables['Build.SourceBranch'], 'vs'), eq(variables['Build.SourceBranch'], 'main'))) }}: disableComponentGovernance: false ${{ else }}: disableComponentGovernance: true From b1f1d2e364c1a64c9985567ff9db60f004c26b33 Mon Sep 17 00:00:00 2001 From: Jan Krivanek Date: Mon, 24 Apr 2023 12:16:47 +0200 Subject: [PATCH 3/3] Improve the branch naming syntax --- .vsts-dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vsts-dotnet.yml b/.vsts-dotnet.yml index f20b1233fc4..591e41871ec 100644 --- a/.vsts-dotnet.yml +++ b/.vsts-dotnet.yml @@ -252,7 +252,7 @@ stages: - template: /eng/common/templates/steps/component-governance.yml parameters: - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), or(startsWith(variables['Build.SourceBranch'], 'vs'), eq(variables['Build.SourceBranch'], 'main'))) }}: + ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), or(startsWith(variables['Build.SourceBranch'], 'refs/heads/vs'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))) }}: disableComponentGovernance: false ${{ else }}: disableComponentGovernance: true