From b485e5eac3455fd92dc0c48c561585e4048401cb Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Sun, 8 Mar 2026 21:26:57 +1100 Subject: [PATCH] Improve AzulZulu release checks and filtering Refine the selection to exclude gzipped downloads when filtering latest releases. --- CHANGELOG.md | 4 ++++ Evergreen/Shared/Get-AzulZulu.ps1 | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4df46aa7..1dc183d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change log +## VERSION + +* Update `Shared/Get-AzulZulu.ps1` - Refine the selection to exclude gzipped downloads when filtering latest releases. + ## 2603.2829.0 * Update `Shared/Get-AzulZulu.ps1` - Refactor image type detection by extracting URL-matching logic into a dedicated variable. Add explicit handling for fx-jre -> JREFX and fx-jdk -> JDKFX, retain jre -> JRE and jdk -> JDK, and default to Unknown when no pattern matches. This expands supported image type distinctions. [https://github.com/EUCPilots/evergreen-apps/issues/87](https://github.com/EUCPilots/evergreen-apps/issues/87) diff --git a/Evergreen/Shared/Get-AzulZulu.ps1 b/Evergreen/Shared/Get-AzulZulu.ps1 index f6322b52..61c78f95 100644 --- a/Evergreen/Shared/Get-AzulZulu.ps1 +++ b/Evergreen/Shared/Get-AzulZulu.ps1 @@ -31,6 +31,7 @@ function Get-AzulZulu { } $Releases = Invoke-EvergreenRestMethod @params + # Check if releases were found if ($null -eq $Releases -or $Releases.Count -eq 0) { Write-Warning -Message "$($MyInvocation.MyCommand): No releases found." return @@ -39,7 +40,7 @@ function Get-AzulZulu { Write-Verbose -Message "$($MyInvocation.MyCommand): found $($Releases.count) releases." } - # Find the latest version + # Find the latest version by sorting the releases based on the distro_version property $Version = $Releases | ` Where-Object { $null -ne $_.$DISTRO_VERSION } | ` Sort-Object { [System.Version]($_.$DISTRO_VERSION -join ".") } -Descending | ` @@ -47,8 +48,9 @@ function Get-AzulZulu { $LatestVersion = $Version.$DISTRO_VERSION -join "." Write-Verbose -Message "$($MyInvocation.MyCommand): found latest version: $LatestVersion" + # Filter the releases for the latest version and exclude any gzipped files Write-Verbose -Message "$($MyInvocation.MyCommand): Filter for latest releases." - foreach ($Release in ($Releases | Where-Object { ($_.$DISTRO_VERSION -join ".") -eq ($Version.$DISTRO_VERSION -join ".") })) { + foreach ($Release in ($Releases | Where-Object { ($_.$DISTRO_VERSION -join ".") -eq ($Version.$DISTRO_VERSION -join ".") -and $_.$DOWNLOAD_URL -notmatch ".*gz?" })) { # Match the download URL to determine the image type $ImageType = if ($Release.$DOWNLOAD_URL -match "(fx-jre)(?=\d)") { @@ -63,6 +65,7 @@ function Get-AzulZulu { "Unknown" } + # Output a custom object with release info $PSObject = [PSCustomObject]@{ Version = $Release.$DISTRO_VERSION -join "." JavaVersion = "$($Release.java_version -join ".")$(if ($null -ne $Release.openjdk_build_number) { "+$($Release.openjdk_build_number)" })"