From f8b0829d1d00620a3dbc89fa3412d97ae527e4a8 Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Sun, 8 Mar 2026 20:48:32 +1100 Subject: [PATCH] Improve ImageType detection in 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 improves readability and expands supported image type distinctions. --- CHANGELOG.md | 4 ++++ Evergreen/Shared/Get-AzulZulu.ps1 | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49fdfe07..d801bc47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change log +## VERSION + +* 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) + ## 2511.2826.0 * Fix `JRE` or `JDK` string match in `Get-AzulZulu` diff --git a/Evergreen/Shared/Get-AzulZulu.ps1 b/Evergreen/Shared/Get-AzulZulu.ps1 index ff7fd63f..f6322b52 100644 --- a/Evergreen/Shared/Get-AzulZulu.ps1 +++ b/Evergreen/Shared/Get-AzulZulu.ps1 @@ -49,10 +49,24 @@ function Get-AzulZulu { Write-Verbose -Message "$($MyInvocation.MyCommand): Filter for latest releases." foreach ($Release in ($Releases | Where-Object { ($_.$DISTRO_VERSION -join ".") -eq ($Version.$DISTRO_VERSION -join ".") })) { + + # Match the download URL to determine the image type + $ImageType = if ($Release.$DOWNLOAD_URL -match "(fx-jre)(?=\d)") { + "JREFX" + } elseif ($Release.$DOWNLOAD_URL -match "(fx-jdk)(?=\d)") { + "JDKFX" + } elseif ($Release.$DOWNLOAD_URL -match "(jre)(?=\d)") { + "JRE" + } elseif ($Release.$DOWNLOAD_URL -match "(jdk)(?=\d)") { + "JDK" + } else { + "Unknown" + } + $PSObject = [PSCustomObject]@{ Version = $Release.$DISTRO_VERSION -join "." JavaVersion = "$($Release.java_version -join ".")$(if ($null -ne $Release.openjdk_build_number) { "+$($Release.openjdk_build_number)" })" - ImageType = if ($Release.$DOWNLOAD_URL -match "(jre)(?=\d)") { "JRE" } else { "JDK" } + ImageType = $ImageType Architecture = Get-Architecture -String $Release.$DOWNLOAD_URL Type = Get-FileType -File $Release.$DOWNLOAD_URL URI = $Release.$DOWNLOAD_URL