From 45867972e6f30b3af485a06d984d3fdbba570ed3 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Thu, 7 Jul 2022 14:17:22 -0700 Subject: [PATCH] Fix null errors in SetTestPipelineVersion, Update Package Upload step name. (#29705) Co-authored-by: Chidozie Ononiwu --- eng/common/scripts/SetTestPipelineVersion.ps1 | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/eng/common/scripts/SetTestPipelineVersion.ps1 b/eng/common/scripts/SetTestPipelineVersion.ps1 index 6bc333cd63030..56ae4ae0965f7 100644 --- a/eng/common/scripts/SetTestPipelineVersion.ps1 +++ b/eng/common/scripts/SetTestPipelineVersion.ps1 @@ -11,23 +11,34 @@ param ( . (Join-Path $PSScriptRoot common.ps1) +Write-Host "PackageName: $PackageName" +Write-Host "ServiceDirectory: $ServiceDirectory" +Write-Host "BuildID: $BuildID" + +$newVersion = [AzureEngSemanticVersion]::new("1.0.0") $latestTags = git tag -l "${PackageName}_*" + +Write-Host "Get Latest Tag : git tag -l ${PackageName}_*" $semVars = @() -Foreach ($tags in $latestTags) +if ($latestTags -and ($latestTags.Length -gt 0)) { - $semVars += $tags.Replace("${PackageName}_", "") + foreach ($tags in $latestTags) + { + $semVars += $tags.Replace("${PackageName}_", "") + } + + $semVarsSorted = [AzureEngSemanticVersion]::SortVersionStrings($semVars) + Write-Host "Last Published Version $($semVarsSorted[0])" + $newVersion = [AzureEngSemanticVersion]::new($semVarsSorted[0]) } -$semVarsSorted = [AzureEngSemanticVersion]::SortVersionStrings($semVars) -LogDebug "Last Published Version $($semVarsSorted[0])" - -$newVersion = [AzureEngSemanticVersion]::new($semVarsSorted[0]) $newVersion.PrereleaseLabel = $newVersion.DefaultPrereleaseLabel $newVersion.PrereleaseNumber = $BuildID +$newVersion.IsPrerelease = $True -LogDebug "Version to publish [ $($newVersion.ToString()) ]" +Write-Host "Version to publish [ $($newVersion.ToString()) ]" SetPackageVersion -PackageName $PackageName ` - -Version $newVersion ` + -Version $newVersion.ToString() ` -ServiceDirectory $ServiceDirectory \ No newline at end of file