diff --git a/.github/workflows/fwb-azure-marketplace-release.yml b/.github/workflows/fwb-azure-marketplace-release.yml index 99b0d78a..8c84e960 100644 --- a/.github/workflows/fwb-azure-marketplace-release.yml +++ b/.github/workflows/fwb-azure-marketplace-release.yml @@ -51,15 +51,14 @@ jobs: ForEach-Object { $_.Group | Sort-Object -Property Patch -Descending | Select-Object -First 2 } - $filteredVersions.FullVersion + $sortedVersions = $filteredVersions | Sort-Object -Property Major, Minor, Patch -Descending + $sortedVersions.FullVersion } $buildingBlocks = @("A-Single-VM", "Active-Active") $marketplaceVersions = @() $marketplaceVersionsUI = @() - $marketplaceVersions += Get-LatestVersions $(Get-AzVMImage -PublisherName "${env:PUBLISHER}" -Location eastus -Offer "${env:PRODUCTOFFER}" -sku "${env:PRODUCTSKU}").Version - $marketplaceVersions += "latest" - [array]::Reverse($marketplaceVersions) + $marketplaceVersions += @("latest") + $(Get-LatestVersions $(Get-AzVMImage -PublisherName "${env:PUBLISHER}" -Location eastus -Offer "${env:PRODUCTOFFER}" -sku "${env:PRODUCTSKU}").Version) $marketplaceVersions | ForEach-Object { $marketplaceVersionsUI += [pscustomobject]@{label=$_;value=$_} } foreach ($buildingBlock in $buildingBlocks) { diff --git a/.github/workflows/fwb-azure-marketplace-version-update.yml b/.github/workflows/fwb-azure-marketplace-version-update.yml index 2d989a44..32ceeeae 100644 --- a/.github/workflows/fwb-azure-marketplace-version-update.yml +++ b/.github/workflows/fwb-azure-marketplace-version-update.yml @@ -29,13 +29,28 @@ jobs: uses: azure/powershell@v2 with: inlineScript: | + function Sort-Versions { + param ( + [string[]]$Versions + ) + $parsedVersions = $Versions | ForEach-Object { + $versionParts = $_ -split '\.' + [pscustomobject]@{ + Major = [int]$versionParts[0] + Minor = [int]$versionParts[1] + Patch = [int]$versionParts[2] + FullVersion = $_ + } + } + $sortedVersions = $parsedVersions | Sort-Object -Property Major, Minor, Patch -Descending + $sortedVersions.FullVersion + } $buildingBlocks = @("A-Single-VM", "Active-Active","Active-Passive") $marketplaceVersions = @() $marketplaceVersionsUI = @() $marketplaceVersions = $(Get-AzVMImage -PublisherName "fortinet" -Location eastus -Offer "${env:PRODUCTOFFER}" -sku "${env:PRODUCTSKU}").Version - $marketplaceVersions += "latest" - [array]::Reverse($marketplaceVersions) + $marketplaceVersions = @("latest") + $(Sort-Versions($marketplaceVersions)) $marketplaceVersions | ConvertTo-Json | Out-File -Filepath "./fwbversion.json" $marketplaceVersions | ForEach-Object { $marketplaceVersionsUI += [pscustomobject]@{label=$_;value=$_} } $marketplaceVersionsUI | ConvertTo-Json | Out-File -Filepath "./fwbversionui.json"