From a7cd569e898289eceaa0e34227676d787e196810 Mon Sep 17 00:00:00 2001 From: Ben Villalobos <4691428+BenVillalobos@users.noreply.github.com> Date: Tue, 4 May 2021 14:18:04 -0700 Subject: [PATCH 1/3] Ideal scenario --- .vsts-dotnet.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.vsts-dotnet.yml b/.vsts-dotnet.yml index 72c45c9b52f..3919573a4c3 100644 --- a/.vsts-dotnet.yml +++ b/.vsts-dotnet.yml @@ -11,11 +11,14 @@ trigger: # SkipApplyOptimizationData: false variables: - - name: SourceBranch - value: $(IbcSourceBranchName) - - ${{ if startsWith(variables['Build.SourceBranch'], 'refs/heads/exp/') }}: + - name: OptProfDrop + value: $(OptProfDropName) + - ${{ if eq(variables['Build.OptProfDrop'], '') }}: - name: SourceBranch - value: main + value: $(IbcSourceBranchName) + - ${{ if and(ne(variables['Build.SourceBranch'], 'refs/heads/main'), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/vs'))) }}: + - name: SourceBranch + value: main - name: _DotNetArtifactsCategory value: .NETCore - name: _DotNetValidationArtifactsCategory From eafdd445060bd74fc60a73e00cb8c1ef8175a5a9 Mon Sep 17 00:00:00 2001 From: Ben Villalobos <4691428+BenVillalobos@users.noreply.github.com> Date: Tue, 4 May 2021 16:03:05 -0700 Subject: [PATCH 2/3] Use optprofdrop var when building. --- .vsts-dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vsts-dotnet.yml b/.vsts-dotnet.yml index 3919573a4c3..0c794dcaa79 100644 --- a/.vsts-dotnet.yml +++ b/.vsts-dotnet.yml @@ -103,7 +103,7 @@ stages: /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) /p:TeamName=MSBuild /p:DotNetPublishUsingPipelines=true - /p:VisualStudioIbcDrop=$(OptProfDropName) + /p:VisualStudioIbcDrop=$(OptProfDrop) displayName: Build condition: succeeded() From 4ffeee71c55a5bbb4a6f496e13032483f452b141 Mon Sep 17 00:00:00 2001 From: Ben Villalobos <4691428+BenVillalobos@users.noreply.github.com> Date: Tue, 4 May 2021 17:24:31 -0700 Subject: [PATCH 3/3] Pass OptProfDropName as a pipeline parameter to use at compile-time. Set OptProfDrop and SourceBranch accordingly --- .vsts-dotnet.yml | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/.vsts-dotnet.yml b/.vsts-dotnet.yml index 0c794dcaa79..f4e59708348 100644 --- a/.vsts-dotnet.yml +++ b/.vsts-dotnet.yml @@ -10,15 +10,28 @@ trigger: # SignType: real # SkipApplyOptimizationData: false +parameters: +- name: OptProfDropName + displayName: Optional OptProfDrop Override + type: string + default: 'default' + variables: + # if OptProfDrop is not set, string '$(OptProfDrop)' will be passed to the build script. - name: OptProfDrop - value: $(OptProfDropName) - - ${{ if eq(variables['Build.OptProfDrop'], '') }}: + value: '' + - name: SourceBranch + value: $(IbcSourceBranchName) + # If we're not on a vs* branch, use main as our optprof collection branch + - ${{ if not(startsWith(variables['Build.SourceBranch'], 'refs/heads/vs')) }}: + - name: SourceBranch + value: main + # if OptProfDropName is set as a parameter, set OptProfDrop to the parameter and unset SourceBranch + - ${{ if ne(parameters.OptProfDropName, 'default') }}: + - name: OptProfDrop + value: ${{parameters.OptProfDropName}} - name: SourceBranch - value: $(IbcSourceBranchName) - - ${{ if and(ne(variables['Build.SourceBranch'], 'refs/heads/main'), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/vs'))) }}: - - name: SourceBranch - value: main + value: '' - name: _DotNetArtifactsCategory value: .NETCore - name: _DotNetValidationArtifactsCategory