Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
7 changes: 5 additions & 2 deletions Evergreen/Shared/Get-AzulZulu.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -39,16 +40,17 @@ 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 | `
Select-Object -First 1
$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)") {
Expand All @@ -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)" })"
Expand Down