Skip to content

Commit 010bc05

Browse files
authored
Merge pull request #900 from EUCPilots/zulu2
Improve AzulZulu release checks and filtering
2 parents e4bff61 + b485e5e commit 010bc05

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change log
22

3+
## VERSION
4+
5+
* Update `Shared/Get-AzulZulu.ps1` - Refine the selection to exclude gzipped downloads when filtering latest releases.
6+
37
## 2603.2829.0
48

59
* 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)

Evergreen/Shared/Get-AzulZulu.ps1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ function Get-AzulZulu {
3131
}
3232
$Releases = Invoke-EvergreenRestMethod @params
3333

34+
# Check if releases were found
3435
if ($null -eq $Releases -or $Releases.Count -eq 0) {
3536
Write-Warning -Message "$($MyInvocation.MyCommand): No releases found."
3637
return
@@ -39,16 +40,17 @@ function Get-AzulZulu {
3940
Write-Verbose -Message "$($MyInvocation.MyCommand): found $($Releases.count) releases."
4041
}
4142

42-
# Find the latest version
43+
# Find the latest version by sorting the releases based on the distro_version property
4344
$Version = $Releases | `
4445
Where-Object { $null -ne $_.$DISTRO_VERSION } | `
4546
Sort-Object { [System.Version]($_.$DISTRO_VERSION -join ".") } -Descending | `
4647
Select-Object -First 1
4748
$LatestVersion = $Version.$DISTRO_VERSION -join "."
4849
Write-Verbose -Message "$($MyInvocation.MyCommand): found latest version: $LatestVersion"
4950

51+
# Filter the releases for the latest version and exclude any gzipped files
5052
Write-Verbose -Message "$($MyInvocation.MyCommand): Filter for latest releases."
51-
foreach ($Release in ($Releases | Where-Object { ($_.$DISTRO_VERSION -join ".") -eq ($Version.$DISTRO_VERSION -join ".") })) {
53+
foreach ($Release in ($Releases | Where-Object { ($_.$DISTRO_VERSION -join ".") -eq ($Version.$DISTRO_VERSION -join ".") -and $_.$DOWNLOAD_URL -notmatch ".*gz?" })) {
5254

5355
# Match the download URL to determine the image type
5456
$ImageType = if ($Release.$DOWNLOAD_URL -match "(fx-jre)(?=\d)") {
@@ -63,6 +65,7 @@ function Get-AzulZulu {
6365
"Unknown"
6466
}
6567

68+
# Output a custom object with release info
6669
$PSObject = [PSCustomObject]@{
6770
Version = $Release.$DISTRO_VERSION -join "."
6871
JavaVersion = "$($Release.java_version -join ".")$(if ($null -ne $Release.openjdk_build_number) { "+$($Release.openjdk_build_number)" })"

0 commit comments

Comments
 (0)