Skip to content

Commit

Permalink
Fix null errors in SetTestPipelineVersion, Update Package Upload step…
Browse files Browse the repository at this point in the history
… name. (#29705)

Co-authored-by: Chidozie Ononiwu <[email protected]>
  • Loading branch information
azure-sdk and chidozieononiwu authored Jul 7, 2022
1 parent 7ae9b07 commit 4586797
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions eng/common/scripts/SetTestPipelineVersion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 4586797

Please sign in to comment.