From bb026c2f5506efb2a33e32910d4f308b9c015a11 Mon Sep 17 00:00:00 2001 From: Stephen Bonikowsky Date: Tue, 22 Oct 2019 18:03:43 -0700 Subject: [PATCH] Fixing branch name logic. * The existing logic didn't account for a branch name being "release/3.1.0" * We leveraged the azure devops variable 'Build.SourceBranchName' which returned the "last path segment in the ref string". --- eng/UpdatePRService.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/eng/UpdatePRService.yml b/eng/UpdatePRService.yml index 78cd3046aad..5b8ed0cc0cd 100644 --- a/eng/UpdatePRService.yml +++ b/eng/UpdatePRService.yml @@ -44,7 +44,11 @@ steps: :branch echo Set the repo branch to be what build.SourceBranchName is: %BUILD_SOURCEBRANCHNAME% REM The following vso call sets a variable that is accessible further down in the PowerShell script to Sync the PR Service. - echo ##vso[task.setvariable variable=branchNameorPrId]origin/%BUILD_SOURCEBRANCHNAME% + IF '%BUILD_SOURCEBRANCHNAME%'=='master' ( + echo ##vso[task.setvariable variable=branchNameorPrId]origin/%BUILD_SOURCEBRANCHNAME% + ) ELSE ( + echo ##vso[task.setvariable variable=branchNameorPrId]origin/release/%BUILD_SOURCEBRANCHNAME% + ) goto done :done @@ -74,7 +78,11 @@ steps: echo "Operation mode has been set to: $_OPERATION" echo "##vso[task.setvariable variable=operation]$_OPERATION" echo "Set the repo branch to be what build.SourceBranchName is: $BUILD_SOURCEBRANCHNAME" - echo "##vso[task.setvariable variable=branchNameorPrId]origin/$BUILD_SOURCEBRANCHNAME" + if [[ $BUILD_SOURCEBRANCHNAME = master ]]; then + echo "##vso[task.setvariable variable=branchNameorPrId]origin/$BUILD_SOURCEBRANCHNAME" + else + echo "##vso[task.setvariable variable=branchNameorPrId]origin/release/$BUILD_SOURCEBRANCHNAME" + fi fi displayName: Set_Operation_PR_or_Branch_Unix