From 9cdd570f6937709dfa6c6da24981206b3216dab4 Mon Sep 17 00:00:00 2001 From: Chidozie Ononiwu Date: Tue, 10 Nov 2020 16:26:31 -0800 Subject: [PATCH] Use BuildID to fix race ondition --- .../templates/jobs/archetype-sdk-client.yml | 1 + .../templates/stages/archetype-java-release.yml | 1 + eng/scripts/SetTestPipelineVersion.ps1 | 12 ++++++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-client.yml b/eng/pipelines/templates/jobs/archetype-sdk-client.yml index ef89732b40cdc..0e34b83dd0532 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-client.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-client.yml @@ -62,6 +62,7 @@ jobs: pwsh: true workingDirectory: $(Build.SourcesDirectory) filePath: eng/scripts/SetTestPipelineVersion.ps1 + arguments: '-BuildNumber $(Build.BuildNumber)' - script: | echo "##vso[build.addbuildtag]Scheduled" diff --git a/eng/pipelines/templates/stages/archetype-java-release.yml b/eng/pipelines/templates/stages/archetype-java-release.yml index 7b9048ce10963..e2f808b83c634 100644 --- a/eng/pipelines/templates/stages/archetype-java-release.yml +++ b/eng/pipelines/templates/stages/archetype-java-release.yml @@ -70,6 +70,7 @@ stages: pwsh: true workingDirectory: $(Build.SourcesDirectory) filePath: eng/scripts/SetTestPipelineVersion.ps1 + arguments: '-BuildNumber $(Build.BuildNumber)' - task: UsePythonVersion@0 displayName: 'Use Python 3.6' diff --git a/eng/scripts/SetTestPipelineVersion.ps1 b/eng/scripts/SetTestPipelineVersion.ps1 index 302f0be77e600..b4e75785b5030 100644 --- a/eng/scripts/SetTestPipelineVersion.ps1 +++ b/eng/scripts/SetTestPipelineVersion.ps1 @@ -1,5 +1,11 @@ -# Overides the project file and CHANGELOG.md for the template project using the next publishable version +# Overides the project file and CHANGELOG.md for the template project. # This is to help with testing the release pipeline. + +param ( + [Parameter(mandatory = $true)] + $BuildNumber +) + . "${PSScriptRoot}\..\common\scripts\common.ps1" $latestTags = git tag -l "azure-sdk-template_*" $semVars = @() @@ -16,7 +22,9 @@ $semVarsSorted = [AzureEngSemanticVersion]::SortVersionStrings($semVars) LogDebug "Last Published Version $($semVarsSorted[0])" $newVersion = [AzureEngSemanticVersion]::ParseVersionString($semVarsSorted[0]) -$newVersion.IncrementAndSetToPrerelease() +$newVersion.PrereleaseLabel = "beta" +$newVersion.PrereleaseNumber = $BuildNumber + LogDebug "Version to publish [ $($newVersion.ToString()) ]" $pomFileContent = New-Object -TypeName XML