Skip to content

Commit

Permalink
Update Get-DockerDesktop.ps1
Browse files Browse the repository at this point in the history
Fix an issue with multiple versions deployed, return both MSI and EXE installers
  • Loading branch information
aaronparker committed Apr 10, 2024
1 parent fafe7d7 commit 3f6123a
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions Evergreen/Apps/Get-DockerDesktop.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Function Get-DockerDesktop {
function Get-DockerDesktop {
<#
.SYNOPSIS
Returns the available Docker Desktop versions.
Expand All @@ -16,19 +16,23 @@ Function Get-DockerDesktop {
$res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1])
)

# Get the releases data
$Updates = Invoke-EvergreenRestMethod -Uri $res.Get.Update.Uri

foreach ($Update in $Updates) {
if ($Null -ne $Update) {
$PSObject = [PSCustomObject] @{
Version = $Update.enclosure.shortVersionString
Build = $Update.enclosure.version
Size = $Update.enclosure.length
Type = Get-FileType -File $($Update.enclosure.url | Where-Object { $_ -match "\.exe$" } | Select-Object -First 1)
URI = $Update.enclosure.url | Where-Object { $_ -match "\.exe$" } | Select-Object -First 1
}
Write-Output -InputObject $PSObject
# Select the latest version
$Latest = $Updates | `
Sort-Object -Property @{ Expression = { [System.Version]$_.enclosure.shortVersionString }; Descending = $true } | `
Select-Object -First 1

# Output the latest version
foreach ($Item in $Latest.enclosure.url) {
$PSObject = [PSCustomObject] @{
Version = $Latest.enclosure.shortVersionString
Build = $Latest.enclosure.version
Size = $Latest.enclosure.length
Type = Get-FileType -File $Item
URI = $Item
}
Write-Output -InputObject $PSObject
}

}

0 comments on commit 3f6123a

Please sign in to comment.