From 9b7993a3ee1630c4101ca71f7f332fc410c7793a Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Mon, 18 Sep 2023 09:18:11 +1000 Subject: [PATCH 01/25] #381 --- Evergreen/Apps/Get-OracleJava17.ps1 | 18 +++++++++++ Evergreen/Apps/Get-OracleJava20.ps1 | 18 +++++++++++ Evergreen/Manifests/OracleJava17.json | 40 ++++++++++++++++++++++++ Evergreen/Manifests/OracleJava20.json | 40 ++++++++++++++++++++++++ Evergreen/Private/Get-OracleJava.ps1 | 44 +++++++++++++++++++++++++++ docs/changelog.md | 4 +++ 6 files changed, 164 insertions(+) create mode 100644 Evergreen/Apps/Get-OracleJava17.ps1 create mode 100644 Evergreen/Apps/Get-OracleJava20.ps1 create mode 100644 Evergreen/Manifests/OracleJava17.json create mode 100644 Evergreen/Manifests/OracleJava20.json create mode 100644 Evergreen/Private/Get-OracleJava.ps1 diff --git a/Evergreen/Apps/Get-OracleJava17.ps1 b/Evergreen/Apps/Get-OracleJava17.ps1 new file mode 100644 index 00000000..d1f6f098 --- /dev/null +++ b/Evergreen/Apps/Get-OracleJava17.ps1 @@ -0,0 +1,18 @@ +function Get-OracleJava17 { + <# + .NOTES + Author: Aaron Parker + Twitter: @stealthpuppy + #> + [OutputType([System.Management.Automation.PSObject])] + [CmdletBinding(SupportsShouldProcess = $false)] + param ( + [Parameter(Mandatory = $false, Position = 0)] + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSObject] + $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) + ) + + $Output = Get-OracleJava -res $res + Write-Output -InputObject $Output +} diff --git a/Evergreen/Apps/Get-OracleJava20.ps1 b/Evergreen/Apps/Get-OracleJava20.ps1 new file mode 100644 index 00000000..c270d817 --- /dev/null +++ b/Evergreen/Apps/Get-OracleJava20.ps1 @@ -0,0 +1,18 @@ +function Get-OracleJava20 { + <# + .NOTES + Author: Aaron Parker + Twitter: @stealthpuppy + #> + [OutputType([System.Management.Automation.PSObject])] + [CmdletBinding(SupportsShouldProcess = $false)] + param ( + [Parameter(Mandatory = $false, Position = 0)] + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSObject] + $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) + ) + + $Output = Get-OracleJava -res $res + Write-Output -InputObject $Output +} diff --git a/Evergreen/Manifests/OracleJava17.json b/Evergreen/Manifests/OracleJava17.json new file mode 100644 index 00000000..75cf1b26 --- /dev/null +++ b/Evergreen/Manifests/OracleJava17.json @@ -0,0 +1,40 @@ +{ + "Name": "Oracle Java 17", + "Source": "https://www.java.com", + "Get": { + "Update": { + "Uri": "https://www.java.com/releases/releases.json", + "Headers": { + "scheme": "https", + "accept-language": "en-AU,en-GB;q=0.9,en;q=0.8,en-US;q=0.7", + "accept-encoding": "gzip, deflate, br", + "method": "GET", + "path": "/releases/releases.json", + "accept": "application/json", + "cache-control": "max-age=0", + "authority": "www.java.com" + }, + "UserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 Edg/116.0.1938.81", + "Family": 17, + "DateFormat": "yyyy-MM-dd" + }, + "Download": { + "Uri": { + "zip": "https://download.oracle.com/java/17/latest/jdk-17_windows-x64_bin.zip", + "exe": "https://download.oracle.com/java/17/latest/jdk-17_windows-x64_bin.exe", + "msi": "https://download.oracle.com/java/17/latest/jdk-17_windows-x64_bin.msi" + } + } + }, + "Install": { + "Setup": "", + "Physical": { + "Arguments": "", + "PostInstall": [] + }, + "Virtual": { + "Arguments": "", + "PostInstall": [] + } + } +} diff --git a/Evergreen/Manifests/OracleJava20.json b/Evergreen/Manifests/OracleJava20.json new file mode 100644 index 00000000..b96152f6 --- /dev/null +++ b/Evergreen/Manifests/OracleJava20.json @@ -0,0 +1,40 @@ +{ + "Name": "Oracle Java 20", + "Source": "https://www.java.com", + "Get": { + "Update": { + "Uri": "https://www.java.com/releases/releases.json", + "Headers": { + "scheme": "https", + "accept-language": "en-AU,en-GB;q=0.9,en;q=0.8,en-US;q=0.7", + "accept-encoding": "gzip, deflate, br", + "method": "GET", + "path": "/releases/releases.json", + "accept": "application/json", + "cache-control": "max-age=0", + "authority": "www.java.com" + }, + "UserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 Edg/116.0.1938.81", + "Family": 20, + "DateFormat": "yyyy-MM-dd" + }, + "Download": { + "Uri": { + "zip": "https://download.oracle.com/java/20/latest/jdk-20_windows-x64_bin.zip", + "exe": "https://download.oracle.com/java/20/latest/jdk-20_windows-x64_bin.exe", + "msi": "https://download.oracle.com/java/20/latest/jdk-20_windows-x64_bin.msi" + } + } + }, + "Install": { + "Setup": "", + "Physical": { + "Arguments": "", + "PostInstall": [] + }, + "Virtual": { + "Arguments": "", + "PostInstall": [] + } + } +} diff --git a/Evergreen/Private/Get-OracleJava.ps1 b/Evergreen/Private/Get-OracleJava.ps1 new file mode 100644 index 00000000..2f0d1303 --- /dev/null +++ b/Evergreen/Private/Get-OracleJava.ps1 @@ -0,0 +1,44 @@ +function Get-OracleJava { + <# + .SYNOPSIS + Returns details for Oracle Java + + .NOTES + Author: Aaron Parker + Twitter: @stealthpuppy + #> + [OutputType([System.Management.Automation.PSObject])] + [CmdletBinding(SupportsShouldProcess = $false)] + param ( + [Parameter(Mandatory = $false, Position = 0)] + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSObject] $res + ) + + # Get the Oracle Java releases JSON + $params = @{ + Uri = $res.Get.Update.Uri + Headers = $res.Get.Update.Headers + UserAgent = $res.Get.Update.UserAgent + } + $UpdateFeed = Invoke-RestMethodWrapper @params + + # Sort the data for the latest version + $LatestVersion = $UpdateFeed.data.releases | ` + Where-Object { $_.family -eq $res.Get.Update.Family } | ` + Sort-Object -Property @{ Expression = { [System.Version]$_.version }; Descending = $true } -ErrorAction "SilentlyContinue" | ` + Select-Object -First 1 + Write-Verbose -Message "$($MyInvocation.MyCommand): Found version: $($LatestVersion.version)" + + # Return an object for each of the download URIs listed in the manifest + foreach ($Type in $res.Get.Download.Uri.GetEnumerator()) { + Write-Verbose -Message "$($MyInvocation.MyCommand): Build object for $($Type.Name)." + [PSCustomObject] @{ + Version = $LatestVersion.version + Date = ConvertTo-DateTime -DateTime $LatestVersion.ga -Pattern $res.Get.Update.DateFormat + Sha256 = Invoke-WebRequestWrapper -uri "$($res.Get.Download.Uri[$Type.Key]).sha256" -ReturnObject "Content" + Type = Get-FileType -File $res.Get.Download.Uri[$Type.Key] + URI = $res.Get.Download.Uri[$Type.Key] + } | Write-Output + } +} diff --git a/docs/changelog.md b/docs/changelog.md index 78b4237f..2e7bd80c 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,9 @@ # Change log +## VERSION + +* Adds `OracleJava20`, `OracleJava17` [#381](https://github.com/aaronparker/evergreen/issues/381) + ## 2309.850 * Adds `UnitySetup` [#245](https://github.com/aaronparker/evergreen/issues/245) From 23789ae2f7325ac7a3028abf9b829f64e9974cac Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Mon, 18 Sep 2023 09:30:22 +1000 Subject: [PATCH 02/25] Update Get-OracleJava8.ps1 Add file type to output --- Evergreen/Apps/Get-OracleJava8.ps1 | 67 +++++++++++++----------------- 1 file changed, 30 insertions(+), 37 deletions(-) diff --git a/Evergreen/Apps/Get-OracleJava8.ps1 b/Evergreen/Apps/Get-OracleJava8.ps1 index ddaf64c3..22ceb699 100644 --- a/Evergreen/Apps/Get-OracleJava8.ps1 +++ b/Evergreen/Apps/Get-OracleJava8.ps1 @@ -8,50 +8,43 @@ Twitter: @stealthpuppy #> [OutputType([System.Management.Automation.PSObject])] - [CmdletBinding(SupportsShouldProcess = $False)] + [CmdletBinding(SupportsShouldProcess = $false)] param ( - [Parameter(Mandatory = $False, Position = 0)] - [ValidateNotNull()] + [Parameter(Mandatory = $false, Position = 0)] + [ValidateNotNullOrEmpty()] [System.Management.Automation.PSObject] $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) ) # Read the update RSS feed - $params = @{ - Uri = $res.Get.Update.Uri - } - $UpdateFeed = Invoke-RestMethodWrapper @params - - If ($Null -ne $UpdateFeed) { - - # Latest version is the last item in the feed - # Can't cast $_.version to [System.Version] because underscore character is in the string - $Count = $UpdateFeed.'java-update-map'.mapping.Count - Write-Verbose -Message "$($MyInvocation.MyCommand): Filter $Count items in feed for latest update." - $latestUpdate = $UpdateFeed.'java-update-map'.mapping | Where-Object { $_.url -notlike "*-cb.xml" } | Select-Object -Last 1 - - # Read the XML listed in the most recent update - $params = @{ - Uri = $latestUpdate.url - } - $Feed = Invoke-RestMethodWrapper @params - - If ($Null -ne $Feed) { - - # Select the update info - Write-Verbose -Message "$($MyInvocation.MyCommand): Select item in feed for $($res.Get.Update.Filter)." - $Update = $Feed.'java-update'.information | Where-Object { $_.lang -eq $res.Get.Update.Filter } | Select-Object -First 1 - - # Construct the output; Return the custom object to the pipeline - ForEach ($item in $res.Get.Update.FileStrings.GetEnumerator()) { - Write-Verbose -Message "$($MyInvocation.MyCommand): Build object for $($item.Name)." - $PSObject = [PSCustomObject] @{ - Version = $($Update.version | Select-Object -Last 1) - Architecture = $item.Name - URI = $Update.url -replace $res.Get.Update.ReplaceText, $res.Get.Update.FileStrings[$item.Key] - } - Write-Output -InputObject $PSObject + $UpdateFeed = Invoke-RestMethodWrapper -Uri $res.Get.Update.Uri + + # Latest version is the last item in the feed + # Can't cast $_.version to [System.Version] because underscore character is in the string + $Count = $UpdateFeed.'java-update-map'.mapping.Count + Write-Verbose -Message "$($MyInvocation.MyCommand): Filter $Count items in feed for latest update." + $latestUpdate = $UpdateFeed.'java-update-map'.mapping | ` + Where-Object { $_.url -notlike "*-cb.xml" } | ` + Select-Object -Last 1 + + # Read the XML listed in the most recent update + $Feed = Invoke-RestMethodWrapper -Uri $latestUpdate.url + if ($null -ne $Feed) { + + # Select the update info + Write-Verbose -Message "$($MyInvocation.MyCommand): Select item in feed for $($res.Get.Update.Filter)." + $Update = $Feed.'java-update'.information | Where-Object { $_.lang -eq $res.Get.Update.Filter } | Select-Object -First 1 + + # Construct the output; Return the custom object to the pipeline + foreach ($item in $res.Get.Update.FileStrings.GetEnumerator()) { + Write-Verbose -Message "$($MyInvocation.MyCommand): Build object for $($item.Name)." + $PSObject = [PSCustomObject] @{ + Version = $($Update.version | Select-Object -Last 1) + Architecture = $item.Name + Type = Get-FileType -File $($Update.url -replace $res.Get.Update.ReplaceText, $res.Get.Update.FileStrings[$item.Key]) + URI = $Update.url -replace $res.Get.Update.ReplaceText, $res.Get.Update.FileStrings[$item.Key] } + Write-Output -InputObject $PSObject } } } From 0de3151e77dd57da852162a777a4db54eb914945 Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Mon, 18 Sep 2023 16:53:22 +1000 Subject: [PATCH 03/25] Update Get-OracleJava.ps1 Remove data property which is inconsistent --- Evergreen/Private/Get-OracleJava.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/Evergreen/Private/Get-OracleJava.ps1 b/Evergreen/Private/Get-OracleJava.ps1 index 2f0d1303..8070ef1c 100644 --- a/Evergreen/Private/Get-OracleJava.ps1 +++ b/Evergreen/Private/Get-OracleJava.ps1 @@ -35,7 +35,6 @@ function Get-OracleJava { Write-Verbose -Message "$($MyInvocation.MyCommand): Build object for $($Type.Name)." [PSCustomObject] @{ Version = $LatestVersion.version - Date = ConvertTo-DateTime -DateTime $LatestVersion.ga -Pattern $res.Get.Update.DateFormat Sha256 = Invoke-WebRequestWrapper -uri "$($res.Get.Download.Uri[$Type.Key]).sha256" -ReturnObject "Content" Type = Get-FileType -File $res.Get.Download.Uri[$Type.Key] URI = $res.Get.Download.Uri[$Type.Key] From 3efdb9366a85e2555a02cbb85efd12538a2547c7 Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Tue, 19 Sep 2023 21:50:50 +1000 Subject: [PATCH 04/25] #550 --- Evergreen/Apps/Get-GoogleChrome.ps1 | 45 +++++++++------------------ Evergreen/Manifests/GoogleChrome.json | 15 ++++----- docs/changelog.md | 1 + 3 files changed, 21 insertions(+), 40 deletions(-) diff --git a/Evergreen/Apps/Get-GoogleChrome.ps1 b/Evergreen/Apps/Get-GoogleChrome.ps1 index 4b1f5762..6919322f 100644 --- a/Evergreen/Apps/Get-GoogleChrome.ps1 +++ b/Evergreen/Apps/Get-GoogleChrome.ps1 @@ -34,7 +34,8 @@ function Get-GoogleChrome { } Write-Output -InputObject $PSObject - if ($Channel -eq "stable") { + if ($Channel -eq $res.Get.Download.BundleFilter) { + # Output the version and URI for the bundle download $PSObject = [PSCustomObject] @{ Version = $Version Architecture = Get-Architecture -String $res.Get.Download.Bundle @@ -44,35 +45,17 @@ function Get-GoogleChrome { } Write-Output -InputObject $PSObject } - } - - # Read the JSON and convert to a PowerShell object. Return the current release version of Chrome - # $UpdateFeed = Invoke-RestMethodWrapper -Uri $res.Get.Update.Uri - - # # Read the JSON and build an array of platform, channel, version - # foreach ($channel in $res.Get.Download.Uri.GetEnumerator()) { - # Write-Verbose -Message "$($MyInvocation.MyCommand): Channel: $($channel.Name)." - # # Step through each platform property - # foreach ($platform in $res.Get.Download.Platforms) { - # Write-Verbose -Message "$($MyInvocation.MyCommand): Platform: $platform." - - # # Filter the feed for the specific channel and platform - # $UpdateItem = $UpdateFeed.versions | Where-Object { ($_.channel -eq $channel.Name) -and ($_.os -eq $platform) } - # foreach ($item in $UpdateItem) { - - # # Output the version and URI object - # Write-Verbose -Message "$($MyInvocation.MyCommand): Found $($item.Count) item/s for $($channel.Name), $platform." - # $PSObject = [PSCustomObject] @{ - # Version = $item.Version - # Architecture = Get-Architecture -String $item.Os - # Channel = $item.Channel - # Date = ConvertTo-DateTime -DateTime $item.Current_RelDate.Trim() -Pattern $res.Get.Download.DatePattern - # Type = [System.IO.Path]::GetExtension($($res.Get.Download.Uri[$channel.Key].($Platform))).Split(".")[-1] - # URI = $($res.Get.Download.Uri[$channel.Key].($Platform)) - # } - # Write-Output -InputObject $PSObject - # } - # } - # } + if ($Channel -match $res.Get.Download.'32bitFilter') { + # Output the version and URI object for the 32-bit version + $PSObject = [PSCustomObject] @{ + Version = $Version + Architecture = Get-Architecture -String $($res.Get.Download.Uri.$Channel -replace "64", "") + Channel = $Channel + Type = Get-FileType -File $res.Get.Download.Uri.$Channel + URI = $res.Get.Download.Uri.$Channel -replace "64", "" + } + Write-Output -InputObject $PSObject + } + } } diff --git a/Evergreen/Manifests/GoogleChrome.json b/Evergreen/Manifests/GoogleChrome.json index 213f970d..38d22144 100644 --- a/Evergreen/Manifests/GoogleChrome.json +++ b/Evergreen/Manifests/GoogleChrome.json @@ -1,10 +1,10 @@ { - "Name": "Google Chrome", + "Name": "Google Chrome Enterprise", "Source": "https://cloud.google.com/chrome-enterprise/browser/download/", "Get": { "Update": { - "Uri2": "https://chromiumdash.appspot.com/fetch_releases?channel=#channel&platform=Windows", "Uri": "https://versionhistory.googleapis.com/v1/chrome/platforms/win64/channels/#channel/versions/all/releases", + "Uri2": "https://chromiumdash.appspot.com/fetch_releases?channel=#channel&platform=Windows", "Channels": [ "extended", "stable", @@ -21,13 +21,10 @@ "dev": "https://dl.google.com/dl/chrome/install/dev/googlechromedevstandaloneenterprise64.msi", "canary": "https://dl.google.com/update2/installers/ChromeSetup.exe" }, - "Bundle": "https://dl.google.com/dl/chrome/install/GoogleChromeEnterpriseBundle64.zip" - }, - "Platforms": [ - "win64", - "win" - ], - "DatePattern": "MM/dd/yy" + "Bundle": "https://dl.google.com/dl/chrome/install/GoogleChromeEnterpriseBundle64.zip", + "BundleFilter": "stable", + "32bitFilter": "stable|beta|extended|dev" + } }, "Install": { "Setup": "googlechrome*standaloneenterprise*.msi", diff --git a/docs/changelog.md b/docs/changelog.md index 2e7bd80c..447c7092 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -3,6 +3,7 @@ ## VERSION * Adds `OracleJava20`, `OracleJava17` [#381](https://github.com/aaronparker/evergreen/issues/381) +* Updates `GoogleChrome` to address missing `x86` installers [#550](https://github.com/aaronparker/evergreen/issues/550) ## 2309.850 From 2f211eb25ddc6755c5c625c08332c3384a5a44df Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Wed, 20 Sep 2023 08:38:44 +1000 Subject: [PATCH 05/25] Update Get-InstallerType.ps1 Add Minimal installer type --- Evergreen/Private/Get-InstallerType.ps1 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Evergreen/Private/Get-InstallerType.ps1 b/Evergreen/Private/Get-InstallerType.ps1 index 332a90d9..33b3cd8f 100644 --- a/Evergreen/Private/Get-InstallerType.ps1 +++ b/Evergreen/Private/Get-InstallerType.ps1 @@ -7,10 +7,11 @@ function Get-InstallerType { ) switch -Regex ($String.ToLower()) { - "user" { $Type = "User"; break } - "portable" { $Type = "Portable"; break } - "no-installer" { $Type = "Portable"; break } - "debug" { $Type = "Debug"; break } + "min" { $Type = "Minimal"; break } + "user" { $Type = "User"; break } + "portable" { $Type = "Portable"; break } + "no-installer" { $Type = "Portable"; break } + "debug" { $Type = "Debug"; break } default { Write-Verbose -Message "$($MyInvocation.MyCommand): Installer type not found in $String, defaulting to 'Default'." $Type = "Default" From ccb3a31aab16e238febc73e601610dda174a22d7 Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Wed, 20 Sep 2023 13:47:22 +1000 Subject: [PATCH 06/25] Update Get-GitHubRepoRelease.ps1 Add support for replacing text in tag/version string returned from the target repo #511 --- Evergreen/Private/Get-GitHubRepoRelease.ps1 | 32 +++++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/Evergreen/Private/Get-GitHubRepoRelease.ps1 b/Evergreen/Private/Get-GitHubRepoRelease.ps1 index 87cd2727..d06db2ab 100644 --- a/Evergreen/Private/Get-GitHubRepoRelease.ps1 +++ b/Evergreen/Private/Get-GitHubRepoRelease.ps1 @@ -32,6 +32,9 @@ function Get-GitHubRepoRelease { [ValidateNotNullOrEmpty()] [System.String] $Filter = "\.exe$|\.msi$|\.msp$|\.zip$", + [Parameter(Mandatory = $false, Position = 4)] + [System.Array] $VersionReplace, + [Parameter()] [System.Management.Automation.SwitchParameter] $ReturnVersionOnly ) @@ -126,27 +129,32 @@ function Get-GitHubRepoRelease { if ($Uri -match "^*tags$") { try { # Uri matches tags fo the repo; find the latest tag - $version = [RegEx]::Match($release[0].name, $MatchVersion).Captures.Groups[1].Value + $Version = [RegEx]::Match($release[0].name, $MatchVersion).Captures.Groups[1].Value } catch { Write-Verbose -Message "$($MyInvocation.MyCommand): Failed to match version number as-is, returning: $($release[0].$VersionTag)." - $version = $release[0].name + $Version = $release[0].name } } else { try { # Uri matches releases for the repo; return just the version string - $version = [RegEx]::Match($release[0].$VersionTag, $MatchVersion).Captures.Groups[1].Value + $Version = [RegEx]::Match($release[0].$VersionTag, $MatchVersion).Captures.Groups[1].Value } catch { Write-Verbose -Message "$($MyInvocation.MyCommand): Failed to match version number as-is, returning: $($release[0].$VersionTag)." - $version = $item.$VersionTag + $Version = $item.$VersionTag } } + if ($PSBoundParameters.ContainsKey("VersionReplace")) { + # Replace string in version + $Version = $Version -replace $res.Get.VersionReplace[0], $res.Get.VersionReplace[1] + } + # Build the output object $PSObject = [PSCustomObject] @{ - Version = $version + Version = $Version } Write-Output -InputObject $PSObject } @@ -162,17 +170,23 @@ function Get-GitHubRepoRelease { # Capture the version string from the specified release tag try { Write-Verbose -Message "$($MyInvocation.MyCommand): Matching version number against: $($item.$VersionTag)." - $version = [RegEx]::Match($item.$VersionTag, $MatchVersion).Captures.Groups[1].Value - Write-Verbose -Message "$($MyInvocation.MyCommand): Found version number: $version." + $Version = [RegEx]::Match($item.$VersionTag, $MatchVersion).Captures.Groups[1].Value + Write-Verbose -Message "$($MyInvocation.MyCommand): Found version number: $Version." } catch { Write-Verbose -Message "$($MyInvocation.MyCommand): Failed to match version number, returning: $($item.$VersionTag)." - $version = $item.$VersionTag + $Version = $item.$VersionTag + } + + if ($PSBoundParameters.ContainsKey("VersionReplace")) { + # Replace string in version + Write-Verbose -Message "$($MyInvocation.MyCommand): Replace $($res.Get.VersionReplace[0])." + $Version = $Version -replace $res.Get.VersionReplace[0], $res.Get.VersionReplace[1] } # Build the output object $PSObject = [PSCustomObject] @{ - Version = $version + Version = $Version Platform = Get-Platform -String $asset.browser_download_url Architecture = Get-Architecture -String $asset.browser_download_url Type = [System.IO.Path]::GetExtension($asset.browser_download_url).Split(".")[-1] From 63ce08f148472436c0098e6146902bb89fdc48dd Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Wed, 20 Sep 2023 13:50:05 +1000 Subject: [PATCH 07/25] #511 Add replace ".windows" in version tag to return a proper version number. Return .exe installers only to simplify returning installer downloads (remove .zip installers that return mingit and busybox versions) --- Evergreen/Apps/Get-GitForWindows.ps1 | 17 +++++++++-------- Evergreen/Manifests/GitForWindows.json | 9 +++++++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Evergreen/Apps/Get-GitForWindows.ps1 b/Evergreen/Apps/Get-GitForWindows.ps1 index 9a5e33f9..c08d5ef1 100644 --- a/Evergreen/Apps/Get-GitForWindows.ps1 +++ b/Evergreen/Apps/Get-GitForWindows.ps1 @@ -1,4 +1,4 @@ -Function Get-GitForWindows { +function Get-GitForWindows { <# .SYNOPSIS Returns the available Git for Windows versions. @@ -8,20 +8,21 @@ Function Get-GitForWindows { Twitter: @xenappblog #> [OutputType([System.Management.Automation.PSObject])] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification="Product name is a plural")] - [CmdletBinding(SupportsShouldProcess = $False)] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "Product name is a plural")] + [CmdletBinding(SupportsShouldProcess = $false)] param ( - [Parameter(Mandatory = $False, Position = 0)] - [ValidateNotNull()] + [Parameter(Mandatory = $false, Position = 0)] + [ValidateNotNullOrEmpty()] [System.Management.Automation.PSObject] $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) ) # Pass the repo releases API URL and return a formatted object $params = @{ - Uri = $res.Get.Uri - MatchVersion = $res.Get.MatchVersion - Filter = $res.Get.MatchFileTypes + Uri = $res.Get.Uri + MatchVersion = $res.Get.MatchVersion + VersionReplace = $res.Get.VersionReplace + Filter = $res.Get.MatchFileTypes } $object = Get-GitHubRepoRelease @params Write-Output -InputObject $object diff --git a/Evergreen/Manifests/GitForWindows.json b/Evergreen/Manifests/GitForWindows.json index 4b43de8d..43b25771 100644 --- a/Evergreen/Manifests/GitForWindows.json +++ b/Evergreen/Manifests/GitForWindows.json @@ -3,8 +3,13 @@ "Source": "https://gitforwindows.org/", "Get": { "Uri": "https://api.github.com/repos/git-for-windows/git/releases/latest", - "MatchVersion": "(\\d+(\\.\\d+){1,4}).*", - "MatchFileTypes": "\\.exe$|\\.msi$|\\.msp$|\\.zip$" + "MatchVersion": "(\\d+.*)", + "OldMatchVersion": "(\\d+(\\.\\d+){1,4}).*", + "MatchFileTypes": "\\.exe$|\\.msi$", + "VersionReplace": [ + ".windows", + "" + ] }, "Install": { "Setup": "Git*.exe", From ebc2e3a7b121a614550186c24642d70d96af45c2 Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Wed, 20 Sep 2023 13:51:17 +1000 Subject: [PATCH 08/25] Update Get-EvergreenApp.ps1 Put output from app into a variable, then return that variable data to the pipeline to simplify output on throw --- Evergreen/Public/Get-EvergreenApp.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Evergreen/Public/Get-EvergreenApp.ps1 b/Evergreen/Public/Get-EvergreenApp.ps1 index 5c8c5130..8d208e26 100644 --- a/Evergreen/Public/Get-EvergreenApp.ps1 +++ b/Evergreen/Public/Get-EvergreenApp.ps1 @@ -75,7 +75,9 @@ Function Get-EvergreenApp { } # Run the application function and sort the output Write-Verbose -Message "Calling: Get-$Name." - & Get-$Name @params | Sort-Object -Property "Ring", "Channel", "Track", @{ Expression = { [System.Version]$_.Version }; Descending = $true } -ErrorAction "SilentlyContinue" + $Output = & Get-$Name @params + $Output | Sort-Object -Property "Ring", "Channel", "Track", @{ Expression = { [System.Version]$_.Version }; Descending = $true } -ErrorAction "SilentlyContinue" + Remove-Variable -Name Output -Force -ErrorAction "SilentlyContinue" } catch { $Msg = "Run 'Get-EvergreenApp -Name `"$Name`" -Verbose' to review additional details for troubleshooting." From 86beb579c2ed393f4012f16dae1f9f263bb4537d Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Thu, 21 Sep 2023 08:58:56 +1000 Subject: [PATCH 09/25] Move shared app functions into Shared Different directory structure for shared app functions from module private functions --- Evergreen/Evergreen.psm1 | 14 ++++++++------ .../{Private => Shared}/Get-AdoptiumTemurin.ps1 | 0 .../Get-BellSoftLibericaJDK.ps1 | 0 .../{Private => Shared}/Get-GitHubRepoRelease.ps1 | 0 Evergreen/{Private => Shared}/Get-JetBrainsApp.ps1 | 0 Evergreen/{Private => Shared}/Get-OracleJava.ps1 | 0 .../Get-SourceForgeRepoRelease.ps1 | 0 7 files changed, 8 insertions(+), 6 deletions(-) rename Evergreen/{Private => Shared}/Get-AdoptiumTemurin.ps1 (100%) rename Evergreen/{Private => Shared}/Get-BellSoftLibericaJDK.ps1 (100%) rename Evergreen/{Private => Shared}/Get-GitHubRepoRelease.ps1 (100%) rename Evergreen/{Private => Shared}/Get-JetBrainsApp.ps1 (100%) rename Evergreen/{Private => Shared}/Get-OracleJava.ps1 (100%) rename Evergreen/{Private => Shared}/Get-SourceForgeRepoRelease.ps1 (100%) diff --git a/Evergreen/Evergreen.psm1 b/Evergreen/Evergreen.psm1 index 66a6be8c..7a642321 100644 --- a/Evergreen/Evergreen.psm1 +++ b/Evergreen/Evergreen.psm1 @@ -6,15 +6,17 @@ param () #region Get public and private function definition files -$publicRoot = Join-Path -Path $PSScriptRoot -ChildPath "Public" -$privateRoot = Join-Path -Path $PSScriptRoot -ChildPath "Private" -$Public = @( Get-ChildItem -Path (Join-Path $publicRoot "*.ps1") -ErrorAction "SilentlyContinue" ) -$Private = @( Get-ChildItem -Path (Join-Path $privateRoot "*.ps1") -ErrorAction "SilentlyContinue" ) +$PublicRoot = Join-Path -Path $PSScriptRoot -ChildPath "Public" +$PrivateRoot = Join-Path -Path $PSScriptRoot -ChildPath "Private" +$SharedRoot = Join-Path -Path $PSScriptRoot -ChildPath "Shared" +$Public = @( Get-ChildItem -Path (Join-Path -Path $PublicRoot -ChildPath "*.ps1") -ErrorAction "SilentlyContinue" ) +$Private = @( Get-ChildItem -Path (Join-Path -Path $PrivateRoot -ChildPath "*.ps1") -ErrorAction "SilentlyContinue" ) +$Shared = @( Get-ChildItem -Path (Join-Path -Path $SharedRoot -ChildPath "*.ps1") -ErrorAction "SilentlyContinue" ) # Dot source the files -foreach ($import in @($Public + $Private)) { +foreach ($Import in @($Public + $Private + $Shared)) { try { - . $import.FullName + . $Import.FullName } catch { throw $_ diff --git a/Evergreen/Private/Get-AdoptiumTemurin.ps1 b/Evergreen/Shared/Get-AdoptiumTemurin.ps1 similarity index 100% rename from Evergreen/Private/Get-AdoptiumTemurin.ps1 rename to Evergreen/Shared/Get-AdoptiumTemurin.ps1 diff --git a/Evergreen/Private/Get-BellSoftLibericaJDK.ps1 b/Evergreen/Shared/Get-BellSoftLibericaJDK.ps1 similarity index 100% rename from Evergreen/Private/Get-BellSoftLibericaJDK.ps1 rename to Evergreen/Shared/Get-BellSoftLibericaJDK.ps1 diff --git a/Evergreen/Private/Get-GitHubRepoRelease.ps1 b/Evergreen/Shared/Get-GitHubRepoRelease.ps1 similarity index 100% rename from Evergreen/Private/Get-GitHubRepoRelease.ps1 rename to Evergreen/Shared/Get-GitHubRepoRelease.ps1 diff --git a/Evergreen/Private/Get-JetBrainsApp.ps1 b/Evergreen/Shared/Get-JetBrainsApp.ps1 similarity index 100% rename from Evergreen/Private/Get-JetBrainsApp.ps1 rename to Evergreen/Shared/Get-JetBrainsApp.ps1 diff --git a/Evergreen/Private/Get-OracleJava.ps1 b/Evergreen/Shared/Get-OracleJava.ps1 similarity index 100% rename from Evergreen/Private/Get-OracleJava.ps1 rename to Evergreen/Shared/Get-OracleJava.ps1 diff --git a/Evergreen/Private/Get-SourceForgeRepoRelease.ps1 b/Evergreen/Shared/Get-SourceForgeRepoRelease.ps1 similarity index 100% rename from Evergreen/Private/Get-SourceForgeRepoRelease.ps1 rename to Evergreen/Shared/Get-SourceForgeRepoRelease.ps1 From acaeb0a4d8d0e6a3f3ebc889c029436fd1a68af7 Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Thu, 21 Sep 2023 09:02:22 +1000 Subject: [PATCH 10/25] Move Shared tests --- tests/{Private => Shared}/Get-GitHubRepoRelease.Tests.ps1 | 0 tests/{Private => Shared}/Get-SourceForgeRepoRelease.Tests.ps1 | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename tests/{Private => Shared}/Get-GitHubRepoRelease.Tests.ps1 (100%) rename tests/{Private => Shared}/Get-SourceForgeRepoRelease.Tests.ps1 (100%) diff --git a/tests/Private/Get-GitHubRepoRelease.Tests.ps1 b/tests/Shared/Get-GitHubRepoRelease.Tests.ps1 similarity index 100% rename from tests/Private/Get-GitHubRepoRelease.Tests.ps1 rename to tests/Shared/Get-GitHubRepoRelease.Tests.ps1 diff --git a/tests/Private/Get-SourceForgeRepoRelease.Tests.ps1 b/tests/Shared/Get-SourceForgeRepoRelease.Tests.ps1 similarity index 100% rename from tests/Private/Get-SourceForgeRepoRelease.Tests.ps1 rename to tests/Shared/Get-SourceForgeRepoRelease.Tests.ps1 From 6aa82adc9af4afae86b2834dd61b5e5f933dbeec Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Thu, 21 Sep 2023 09:18:45 +1000 Subject: [PATCH 11/25] Optimise code for Opera apps #487 --- Evergreen/Apps/Get-OperaBrowser.ps1 | 32 +++------------ Evergreen/Apps/Get-OperaCryptoBrowser.ps1 | 32 +++------------ Evergreen/Apps/Get-OperaGXBrowser.ps1 | 32 +++------------ Evergreen/Manifests/OperaBrowser.json | 3 +- Evergreen/Manifests/OperaCryptoBrowser.json | 3 +- Evergreen/Manifests/OperaGXBrowser.json | 3 +- Evergreen/Shared/Get-OperaApp.ps1 | 45 +++++++++++++++++++++ 7 files changed, 63 insertions(+), 87 deletions(-) create mode 100644 Evergreen/Shared/Get-OperaApp.ps1 diff --git a/Evergreen/Apps/Get-OperaBrowser.ps1 b/Evergreen/Apps/Get-OperaBrowser.ps1 index 605b5f3e..ce5e63e7 100644 --- a/Evergreen/Apps/Get-OperaBrowser.ps1 +++ b/Evergreen/Apps/Get-OperaBrowser.ps1 @@ -8,36 +8,14 @@ function Get-OperaBrowser { Twitter: @stealthpuppy #> [OutputType([System.Management.Automation.PSObject])] - [CmdletBinding(SupportsShouldProcess = $False)] + [CmdletBinding(SupportsShouldProcess = $false)] param ( - [Parameter(Mandatory = $False, Position = 0)] - [ValidateNotNull()] + [Parameter(Mandatory = $false, Position = 0)] + [ValidateNotNullOrEmpty()] [System.Management.Automation.PSObject] $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) ) - foreach ($Channel in $res.Get.Update.Channels) { - $Update = Invoke-RestMethodWrapper -Uri $res.Get.Update.Uri[$Channel] - - if ($Null -ne $Update.($res.Get.Update.Property)) { - Write-Verbose -Message "$($MyInvocation.MyCommand): checking property: $($res.Get.Update.Property)." - Write-Verbose -Message "$($MyInvocation.MyCommand): found version: $($Update.($res.Get.Update.Property))" - - # Step through each installer type - foreach ($Architecture in $res.Get.Download.Architectures) { - - # Build the output object; Output object to the pipeline - $Url = $res.Get.Download.Uri[$Channel] -replace $res.Get.Download.ReplaceText, $Update.($res.Get.Update.Property) ` - -replace "#architecture", $res.Get.Download.Architecture[$Architecture] - $PSObject = [PSCustomObject] @{ - Version = $Update.($res.Get.Update.Property) - Channel = $Channel - Architecture = $Architecture - Type = Get-FileType -File $Url - URI = $Url - } - Write-Output -InputObject $PSObject - } - } - } + $Output = Get-OperaApp -res $res + Write-Output -InputObject $Output } diff --git a/Evergreen/Apps/Get-OperaCryptoBrowser.ps1 b/Evergreen/Apps/Get-OperaCryptoBrowser.ps1 index 2671882f..ec7ab90f 100644 --- a/Evergreen/Apps/Get-OperaCryptoBrowser.ps1 +++ b/Evergreen/Apps/Get-OperaCryptoBrowser.ps1 @@ -8,36 +8,14 @@ function Get-OperaCryptoBrowser { Twitter: @stealthpuppy #> [OutputType([System.Management.Automation.PSObject])] - [CmdletBinding(SupportsShouldProcess = $False)] + [CmdletBinding(SupportsShouldProcess = $false)] param ( - [Parameter(Mandatory = $False, Position = 0)] - [ValidateNotNull()] + [Parameter(Mandatory = $false, Position = 0)] + [ValidateNotNullOrEmpty()] [System.Management.Automation.PSObject] $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) ) - foreach ($Channel in $res.Get.Update.Channels) { - $Update = Invoke-RestMethodWrapper -Uri $res.Get.Update.Uri[$Channel] - - if ($Null -ne $Update.($res.Get.Update.Property)) { - Write-Verbose -Message "$($MyInvocation.MyCommand): checking property: $($res.Get.Update.Property)." - Write-Verbose -Message "$($MyInvocation.MyCommand): found version: $($Update.($res.Get.Update.Property))" - - # Step through each installer type - foreach ($Architecture in $res.Get.Download.Architectures) { - - # Build the output object; Output object to the pipeline - $Url = $res.Get.Download.Uri[$Channel] -replace $res.Get.Download.ReplaceText, $Update.($res.Get.Update.Property) ` - -replace "#architecture", $res.Get.Download.Architecture[$Architecture] - $PSObject = [PSCustomObject] @{ - Version = $Update.($res.Get.Update.Property) - Channel = $Channel - Architecture = $Architecture - Type = Get-FileType -File $Url - URI = $Url - } - Write-Output -InputObject $PSObject - } - } - } + $Output = Get-OperaApp -res $res + Write-Output -InputObject $Output } diff --git a/Evergreen/Apps/Get-OperaGXBrowser.ps1 b/Evergreen/Apps/Get-OperaGXBrowser.ps1 index cb6c46df..2cae95ec 100644 --- a/Evergreen/Apps/Get-OperaGXBrowser.ps1 +++ b/Evergreen/Apps/Get-OperaGXBrowser.ps1 @@ -8,36 +8,14 @@ function Get-OperaGXBrowser { Twitter: @stealthpuppy #> [OutputType([System.Management.Automation.PSObject])] - [CmdletBinding(SupportsShouldProcess = $False)] + [CmdletBinding(SupportsShouldProcess = $false)] param ( - [Parameter(Mandatory = $False, Position = 0)] - [ValidateNotNull()] + [Parameter(Mandatory = $false, Position = 0)] + [ValidateNotNullOrEmpty()] [System.Management.Automation.PSObject] $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) ) - foreach ($Channel in $res.Get.Update.Channels) { - $Update = Invoke-RestMethodWrapper -Uri $res.Get.Update.Uri[$Channel] - - if ($Null -ne $Update.($res.Get.Update.Property)) { - Write-Verbose -Message "$($MyInvocation.MyCommand): checking property: $($res.Get.Update.Property)." - Write-Verbose -Message "$($MyInvocation.MyCommand): found version: $($Update.($res.Get.Update.Property))" - - # Step through each installer type - foreach ($Architecture in $res.Get.Download.Architectures) { - - # Build the output object; Output object to the pipeline - $Url = $res.Get.Download.Uri[$Channel] -replace $res.Get.Download.ReplaceText, $Update.($res.Get.Update.Property) ` - -replace "#architecture", $res.Get.Download.Architecture[$Architecture] - $PSObject = [PSCustomObject] @{ - Version = $Update.($res.Get.Update.Property) - Channel = $Channel - Architecture = $Architecture - Type = Get-FileType -File $Url - URI = $Url - } - Write-Output -InputObject $PSObject - } - } - } + $Output = Get-OperaApp -res $res + Write-Output -InputObject $Output } diff --git a/Evergreen/Manifests/OperaBrowser.json b/Evergreen/Manifests/OperaBrowser.json index aa01cb88..8132bfe5 100644 --- a/Evergreen/Manifests/OperaBrowser.json +++ b/Evergreen/Manifests/OperaBrowser.json @@ -28,8 +28,7 @@ "Architectures": [ "x64", "x86" - ], - "ReplaceText": "#version" + ] } }, "Install": { diff --git a/Evergreen/Manifests/OperaCryptoBrowser.json b/Evergreen/Manifests/OperaCryptoBrowser.json index 982bdd99..1456c8be 100644 --- a/Evergreen/Manifests/OperaCryptoBrowser.json +++ b/Evergreen/Manifests/OperaCryptoBrowser.json @@ -25,8 +25,7 @@ }, "Architectures": [ "x64" - ], - "ReplaceText": "#version" + ] } }, "Install": { diff --git a/Evergreen/Manifests/OperaGXBrowser.json b/Evergreen/Manifests/OperaGXBrowser.json index de391d14..2a55d7f0 100644 --- a/Evergreen/Manifests/OperaGXBrowser.json +++ b/Evergreen/Manifests/OperaGXBrowser.json @@ -26,8 +26,7 @@ "Architectures": [ "x64", "x86" - ], - "ReplaceText": "#version" + ] } }, "Install": { diff --git a/Evergreen/Shared/Get-OperaApp.ps1 b/Evergreen/Shared/Get-OperaApp.ps1 new file mode 100644 index 00000000..ebc941ee --- /dev/null +++ b/Evergreen/Shared/Get-OperaApp.ps1 @@ -0,0 +1,45 @@ +function Get-OperaApp { + <# + .SYNOPSIS + Returns the available version and URIs for Opera apps + + .NOTES + Author: Aaron Parker + Twitter: @stealthpuppy + #> + [OutputType([System.Management.Automation.PSObject])] + [CmdletBinding(SupportsShouldProcess = $false)] + param ( + [Parameter(Mandatory = $false, Position = 0)] + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSObject] + $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) + ) + + foreach ($Channel in $res.Get.Update.Channels) { + $Update = Invoke-RestMethodWrapper -Uri $res.Get.Update.Uri[$Channel] + + if ($null -ne $Update.($res.Get.Update.Property)) { + Write-Verbose -Message "$($MyInvocation.MyCommand): checking property: $($res.Get.Update.Property)." + Write-Verbose -Message "$($MyInvocation.MyCommand): found version: $($Update.($res.Get.Update.Property))" + + # Step through each installer type + foreach ($Architecture in $res.Get.Download.Architectures) { + + # Create the URL + $Url = $res.Get.Download.Uri[$Channel] -replace "#version", $Update.($res.Get.Update.Property) ` + -replace "#architecture", $res.Get.Download.Architecture[$Architecture] + + # Build the output object; Output object to the pipeline + $PSObject = [PSCustomObject] @{ + Version = $Update.($res.Get.Update.Property) + Channel = $Channel + Architecture = $Architecture + Type = Get-FileType -File $Url + URI = $Url + } + Write-Output -InputObject $PSObject + } + } + } +} From 76d31bc3a312d5cd35c061491934c741486507e2 Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Thu, 21 Sep 2023 09:50:53 +1000 Subject: [PATCH 12/25] Optimise Hashicorp app functions --- Evergreen/Apps/Get-HashicorpBoundary.ps1 | 31 ++++-------------- Evergreen/Apps/Get-HashicorpConsul.ps1 | 31 ++++-------------- Evergreen/Apps/Get-HashicorpNomad.ps1 | 31 ++++-------------- Evergreen/Apps/Get-HashicorpPacker.ps1 | 31 ++++-------------- Evergreen/Apps/Get-HashicorpTerraform.ps1 | 31 ++++-------------- Evergreen/Apps/Get-HashicorpVault.ps1 | 31 ++++-------------- Evergreen/Apps/Get-HashicorpWaypoint.ps1 | 31 ++++-------------- Evergreen/Shared/Get-HashicorpApp.ps1 | 40 +++++++++++++++++++++++ 8 files changed, 82 insertions(+), 175 deletions(-) create mode 100644 Evergreen/Shared/Get-HashicorpApp.ps1 diff --git a/Evergreen/Apps/Get-HashicorpBoundary.ps1 b/Evergreen/Apps/Get-HashicorpBoundary.ps1 index 021c34e0..8226ce5a 100644 --- a/Evergreen/Apps/Get-HashicorpBoundary.ps1 +++ b/Evergreen/Apps/Get-HashicorpBoundary.ps1 @@ -1,4 +1,4 @@ -Function Get-HashicorpBoundary { +function Get-HashicorpBoundary { <# .SYNOPSIS Get the current versions and download URLs for Hashicorp Boundary. @@ -8,34 +8,15 @@ Function Get-HashicorpBoundary { Twitter: @stealthpuppy #> [OutputType([System.Management.Automation.PSObject])] - [CmdletBinding(SupportsShouldProcess = $False)] + [CmdletBinding(SupportsShouldProcess = $false)] param ( - [Parameter(Mandatory = $False, Position = 0)] - [ValidateNotNull()] + [Parameter(Mandatory = $false, Position = 0)] + [ValidateNotNullOrEmpty()] [System.Management.Automation.PSObject] $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) ) # Pass the repo releases API URL and return a formatted object - $params = @{ - Uri = $res.Get.Update.Uri - MatchVersion = $res.Get.Update.MatchVersion - Filter = $res.Get.Update.MatchFileTypes - ReturnVersionOnly = $True - } - $object = Get-GitHubRepoRelease @params - - # Build the output object - If ($Null -ne $object) { - ForEach ($Architecture in $res.Get.Download.Uri.GetEnumerator()) { - $Uri = $res.Get.Download.Uri[$Architecture.Key] -replace $res.Get.Download.ReplaceText, $object.Version - $PSObject = [PSCustomObject] @{ - Version = $object.Version - Type = Get-FileType -File $Uri - Architecture = $Architecture.Name - URI = $Uri - } - Write-Output -InputObject $PSObject - } - } + $Output = Get-HashicorpApp -res $res + Write-Output -InputObject $Output } diff --git a/Evergreen/Apps/Get-HashicorpConsul.ps1 b/Evergreen/Apps/Get-HashicorpConsul.ps1 index 78052e26..f044b77a 100644 --- a/Evergreen/Apps/Get-HashicorpConsul.ps1 +++ b/Evergreen/Apps/Get-HashicorpConsul.ps1 @@ -1,4 +1,4 @@ -Function Get-HashicorpConsul { +function Get-HashicorpConsul { <# .SYNOPSIS Get the current versions and download URLs for Hashicorp Consul. @@ -8,34 +8,15 @@ Function Get-HashicorpConsul { Twitter: @stealthpuppy #> [OutputType([System.Management.Automation.PSObject])] - [CmdletBinding(SupportsShouldProcess = $False)] + [CmdletBinding(SupportsShouldProcess = $false)] param ( - [Parameter(Mandatory = $False, Position = 0)] - [ValidateNotNull()] + [Parameter(Mandatory = $false, Position = 0)] + [ValidateNotNullOrEmpty()] [System.Management.Automation.PSObject] $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) ) # Pass the repo releases API URL and return a formatted object - $params = @{ - Uri = $res.Get.Update.Uri - MatchVersion = $res.Get.Update.MatchVersion - Filter = $res.Get.Update.MatchFileTypes - ReturnVersionOnly = $True - } - $object = Get-GitHubRepoRelease @params - - # Build the output object - If ($Null -ne $object) { - ForEach ($Architecture in $res.Get.Download.Uri.GetEnumerator()) { - $Uri = $res.Get.Download.Uri[$Architecture.Key] -replace $res.Get.Download.ReplaceText, $object.Version - $PSObject = [PSCustomObject] @{ - Version = $object.Version - Type = Get-FileType -File $Uri - Architecture = $Architecture.Name - URI = $Uri - } - Write-Output -InputObject $PSObject - } - } + $Output = Get-HashicorpApp -res $res + Write-Output -InputObject $Output } diff --git a/Evergreen/Apps/Get-HashicorpNomad.ps1 b/Evergreen/Apps/Get-HashicorpNomad.ps1 index 15ee0d93..ab0d7e5a 100644 --- a/Evergreen/Apps/Get-HashicorpNomad.ps1 +++ b/Evergreen/Apps/Get-HashicorpNomad.ps1 @@ -1,4 +1,4 @@ -Function Get-HashicorpNomad { +function Get-HashicorpNomad { <# .SYNOPSIS Get the current versions and download URLs for Hashicorp Nomad. @@ -8,34 +8,15 @@ Function Get-HashicorpNomad { Twitter: @stealthpuppy #> [OutputType([System.Management.Automation.PSObject])] - [CmdletBinding(SupportsShouldProcess = $False)] + [CmdletBinding(SupportsShouldProcess = $false)] param ( - [Parameter(Mandatory = $False, Position = 0)] - [ValidateNotNull()] + [Parameter(Mandatory = $false, Position = 0)] + [ValidateNotNullOrEmpty()] [System.Management.Automation.PSObject] $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) ) # Pass the repo releases API URL and return a formatted object - $params = @{ - Uri = $res.Get.Update.Uri - MatchVersion = $res.Get.Update.MatchVersion - Filter = $res.Get.Update.MatchFileTypes - ReturnVersionOnly = $True - } - $object = Get-GitHubRepoRelease @params - - # Build the output object - If ($Null -ne $object) { - ForEach ($Architecture in $res.Get.Download.Uri.GetEnumerator()) { - $Uri = $res.Get.Download.Uri[$Architecture.Key] -replace $res.Get.Download.ReplaceText, $object.Version - $PSObject = [PSCustomObject] @{ - Version = $object.Version - Type = Get-FileType -File $Uri - Architecture = $Architecture.Name - URI = $Uri - } - Write-Output -InputObject $PSObject - } - } + $Output = Get-HashicorpApp -res $res + Write-Output -InputObject $Output } diff --git a/Evergreen/Apps/Get-HashicorpPacker.ps1 b/Evergreen/Apps/Get-HashicorpPacker.ps1 index d3ccd624..490b83b0 100644 --- a/Evergreen/Apps/Get-HashicorpPacker.ps1 +++ b/Evergreen/Apps/Get-HashicorpPacker.ps1 @@ -1,4 +1,4 @@ -Function Get-HashicorpPacker { +function Get-HashicorpPacker { <# .SYNOPSIS Get the current versions and download URLs for Hashicorp Packer. @@ -8,34 +8,15 @@ Function Get-HashicorpPacker { Twitter: @stealthpuppy #> [OutputType([System.Management.Automation.PSObject])] - [CmdletBinding(SupportsShouldProcess = $False)] + [CmdletBinding(SupportsShouldProcess = $false)] param ( - [Parameter(Mandatory = $False, Position = 0)] - [ValidateNotNull()] + [Parameter(Mandatory = $false, Position = 0)] + [ValidateNotNullOrEmpty()] [System.Management.Automation.PSObject] $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) ) # Pass the repo releases API URL and return a formatted object - $params = @{ - Uri = $res.Get.Update.Uri - MatchVersion = $res.Get.Update.MatchVersion - Filter = $res.Get.Update.MatchFileTypes - ReturnVersionOnly = $True - } - $object = Get-GitHubRepoRelease @params - - # Build the output object - If ($Null -ne $object) { - ForEach ($Architecture in $res.Get.Download.Uri.GetEnumerator()) { - $Uri = $res.Get.Download.Uri[$Architecture.Key] -replace $res.Get.Download.ReplaceText, $object.Version - $PSObject = [PSCustomObject] @{ - Version = $object.Version - Type = Get-FileType -File $Uri - Architecture = $Architecture.Name - URI = $Uri - } - Write-Output -InputObject $PSObject - } - } + $Output = Get-HashicorpApp -res $res + Write-Output -InputObject $Output } diff --git a/Evergreen/Apps/Get-HashicorpTerraform.ps1 b/Evergreen/Apps/Get-HashicorpTerraform.ps1 index 9cdba158..a5b7ec49 100644 --- a/Evergreen/Apps/Get-HashicorpTerraform.ps1 +++ b/Evergreen/Apps/Get-HashicorpTerraform.ps1 @@ -1,4 +1,4 @@ -Function Get-HashicorpTerraform { +function Get-HashicorpTerraform { <# .SYNOPSIS Get the current versions and download URLs for Hashicorp Terraform. @@ -8,34 +8,15 @@ Function Get-HashicorpTerraform { Twitter: @stealthpuppy #> [OutputType([System.Management.Automation.PSObject])] - [CmdletBinding(SupportsShouldProcess = $False)] + [CmdletBinding(SupportsShouldProcess = $false)] param ( - [Parameter(Mandatory = $False, Position = 0)] - [ValidateNotNull()] + [Parameter(Mandatory = $false, Position = 0)] + [ValidateNotNullOrEmpty()] [System.Management.Automation.PSObject] $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) ) # Pass the repo releases API URL and return a formatted object - $params = @{ - Uri = $res.Get.Update.Uri - MatchVersion = $res.Get.Update.MatchVersion - Filter = $res.Get.Update.MatchFileTypes - ReturnVersionOnly = $True - } - $object = Get-GitHubRepoRelease @params - - # Build the output object - If ($Null -ne $object) { - ForEach ($Architecture in $res.Get.Download.Uri.GetEnumerator()) { - $Uri = $res.Get.Download.Uri[$Architecture.Key] -replace $res.Get.Download.ReplaceText, $object.Version - $PSObject = [PSCustomObject] @{ - Version = $object.Version - Type = Get-FileType -File $Uri - Architecture = $Architecture.Name - URI = $Uri - } - Write-Output -InputObject $PSObject - } - } + $Output = Get-HashicorpApp -res $res + Write-Output -InputObject $Output } diff --git a/Evergreen/Apps/Get-HashicorpVault.ps1 b/Evergreen/Apps/Get-HashicorpVault.ps1 index 357bd594..709e0b4c 100644 --- a/Evergreen/Apps/Get-HashicorpVault.ps1 +++ b/Evergreen/Apps/Get-HashicorpVault.ps1 @@ -1,4 +1,4 @@ -Function Get-HashicorpVault { +function Get-HashicorpVault { <# .SYNOPSIS Get the current versions and download URLs for Hashicorp Vault. @@ -8,34 +8,15 @@ Function Get-HashicorpVault { Twitter: @stealthpuppy #> [OutputType([System.Management.Automation.PSObject])] - [CmdletBinding(SupportsShouldProcess = $False)] + [CmdletBinding(SupportsShouldProcess = $false)] param ( - [Parameter(Mandatory = $False, Position = 0)] - [ValidateNotNull()] + [Parameter(Mandatory = $false, Position = 0)] + [ValidateNotNullOrEmpty()] [System.Management.Automation.PSObject] $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) ) # Pass the repo releases API URL and return a formatted object - $params = @{ - Uri = $res.Get.Update.Uri - MatchVersion = $res.Get.Update.MatchVersion - Filter = $res.Get.Update.MatchFileTypes - ReturnVersionOnly = $True - } - $object = Get-GitHubRepoRelease @params - - # Build the output object - If ($Null -ne $object) { - ForEach ($Architecture in $res.Get.Download.Uri.GetEnumerator()) { - $Uri = $res.Get.Download.Uri[$Architecture.Key] -replace $res.Get.Download.ReplaceText, $object.Version - $PSObject = [PSCustomObject] @{ - Version = $object.Version - Type = Get-FileType -File $Uri - Architecture = $Architecture.Name - URI = $Uri - } - Write-Output -InputObject $PSObject - } - } + $Output = Get-HashicorpApp -res $res + Write-Output -InputObject $Output } diff --git a/Evergreen/Apps/Get-HashicorpWaypoint.ps1 b/Evergreen/Apps/Get-HashicorpWaypoint.ps1 index b9e01fdc..2ed8c279 100644 --- a/Evergreen/Apps/Get-HashicorpWaypoint.ps1 +++ b/Evergreen/Apps/Get-HashicorpWaypoint.ps1 @@ -1,4 +1,4 @@ -Function Get-HashicorpWaypoint { +function Get-HashicorpWaypoint { <# .SYNOPSIS Get the current versions and download URLs for Hashicorp Waypoint. @@ -8,34 +8,15 @@ Function Get-HashicorpWaypoint { Twitter: @stealthpuppy #> [OutputType([System.Management.Automation.PSObject])] - [CmdletBinding(SupportsShouldProcess = $False)] + [CmdletBinding(SupportsShouldProcess = $false)] param ( - [Parameter(Mandatory = $False, Position = 0)] - [ValidateNotNull()] + [Parameter(Mandatory = $false, Position = 0)] + [ValidateNotNullOrEmpty()] [System.Management.Automation.PSObject] $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) ) # Pass the repo releases API URL and return a formatted object - $params = @{ - Uri = $res.Get.Update.Uri - MatchVersion = $res.Get.Update.MatchVersion - Filter = $res.Get.Update.MatchFileTypes - ReturnVersionOnly = $True - } - $object = Get-GitHubRepoRelease @params - - # Build the output object - If ($Null -ne $object) { - ForEach ($Architecture in $res.Get.Download.Uri.GetEnumerator()) { - $Uri = $res.Get.Download.Uri[$Architecture.Key] -replace $res.Get.Download.ReplaceText, $object.Version - $PSObject = [PSCustomObject] @{ - Version = $object.Version - Type = Get-FileType -File $Uri - Architecture = $Architecture.Name - URI = $Uri - } - Write-Output -InputObject $PSObject - } - } + $Output = Get-HashicorpApp -res $res + Write-Output -InputObject $Output } diff --git a/Evergreen/Shared/Get-HashicorpApp.ps1 b/Evergreen/Shared/Get-HashicorpApp.ps1 new file mode 100644 index 00000000..cb341680 --- /dev/null +++ b/Evergreen/Shared/Get-HashicorpApp.ps1 @@ -0,0 +1,40 @@ +Function Get-HashicorpApp { + <# + .SYNOPSIS + Get the current versions and download URLs for Hashicorp apps. + + .NOTES + Author: Aaron Parker + Twitter: @stealthpuppy + #> + [OutputType([System.Management.Automation.PSObject])] + [CmdletBinding(SupportsShouldProcess = $false)] + param ( + [Parameter(Mandatory = $false, Position = 0)] + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSObject] $res + ) + + # Pass the repo releases API URL and return a formatted object + $params = @{ + Uri = $res.Get.Update.Uri + MatchVersion = $res.Get.Update.MatchVersion + Filter = $res.Get.Update.MatchFileTypes + ReturnVersionOnly = $true + } + $object = Get-GitHubRepoRelease @params + + # Build the output object + if ($null -ne $object) { + foreach ($Architecture in $res.Get.Download.Uri.GetEnumerator()) { + $Uri = $res.Get.Download.Uri[$Architecture.Key] -replace $res.Get.Download.ReplaceText, $object.Version + $PSObject = [PSCustomObject] @{ + Version = $object.Version + Type = Get-FileType -File $Uri + Architecture = $Architecture.Name + URI = $Uri + } + Write-Output -InputObject $PSObject + } + } +} From 3ca01c518ce734eb839433db066cf13e502c204f Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Thu, 21 Sep 2023 09:51:05 +1000 Subject: [PATCH 13/25] Update Get-OperaApp.ps1 Fix $res parameter --- Evergreen/Shared/Get-OperaApp.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Evergreen/Shared/Get-OperaApp.ps1 b/Evergreen/Shared/Get-OperaApp.ps1 index ebc941ee..4874481e 100644 --- a/Evergreen/Shared/Get-OperaApp.ps1 +++ b/Evergreen/Shared/Get-OperaApp.ps1 @@ -12,8 +12,7 @@ function Get-OperaApp { param ( [Parameter(Mandatory = $false, Position = 0)] [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSObject] - $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) + [System.Management.Automation.PSObject] $res ) foreach ($Channel in $res.Get.Update.Channels) { From d18c307a44d4bca55722393292c9f2747a7a5f06 Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Fri, 22 Sep 2023 22:38:43 +1000 Subject: [PATCH 14/25] Update OperaBrowser.json Fix URL for Stable channel #487 --- Evergreen/Manifests/OperaBrowser.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Evergreen/Manifests/OperaBrowser.json b/Evergreen/Manifests/OperaBrowser.json index 8132bfe5..e254afe0 100644 --- a/Evergreen/Manifests/OperaBrowser.json +++ b/Evergreen/Manifests/OperaBrowser.json @@ -17,7 +17,7 @@ }, "Download": { "Uri": { - "Stable": "https://get.geo.opera.com/pub/opera/#version/win/Opera_#version_Setup#architecture.exe", + "Stable": "https://get.geo.opera.com/pub/opera/desktop/#version/win/Opera_#version_Setup#architecture.exe", "Beta": "https://get.geo.opera.com/pub/opera-beta/#version/win/Opera_beta_#version_Setup#architecture.exe", "Developer": "https://get.geo.opera.com/pub/opera-developer/#version/win/Opera_Developer_#version_Setup#architecture.exe" }, From 42a87d5d673b9670926e8a5ead4dd81ff5683ffe Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Sat, 23 Sep 2023 08:50:30 +1000 Subject: [PATCH 15/25] Update Get-JetBrainsApp.ps1 Write warning if windows download link property is null --- Evergreen/Shared/Get-JetBrainsApp.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Evergreen/Shared/Get-JetBrainsApp.ps1 b/Evergreen/Shared/Get-JetBrainsApp.ps1 index 3ef06c67..3e989de0 100644 --- a/Evergreen/Shared/Get-JetBrainsApp.ps1 +++ b/Evergreen/Shared/Get-JetBrainsApp.ps1 @@ -19,8 +19,10 @@ function Get-JetBrainsApp { # Query the JetBrains URI to get the JSON $UpdateFeed = Invoke-RestMethodWrapper -Uri $uri - if ($null -ne $UpdateFeed) { - + if ([System.String]::IsNullOrWhiteSpace($UpdateFeed.$($Edition.Value).downloads.windows.link)) { + Write-Warning -Message "$($MyInvocation.MyCommand): 'downloads.windows.link' property is null; from '$uri'." + } + else { # Construct the output; Return the custom object to the pipeline $PSObject = [PSCustomObject] @{ Version = $UpdateFeed.$($Edition.Value).version From 3251b9bc872395bd02f884e1db542f2702f228d8 Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Sat, 23 Sep 2023 09:23:55 +1000 Subject: [PATCH 16/25] Update Get-GhislerTotalCommander.ps1 Fix version number string when Minor value is less than 10 #552 --- Evergreen/Apps/Get-GhislerTotalCommander.ps1 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Evergreen/Apps/Get-GhislerTotalCommander.ps1 b/Evergreen/Apps/Get-GhislerTotalCommander.ps1 index 35654fd4..0003a55a 100644 --- a/Evergreen/Apps/Get-GhislerTotalCommander.ps1 +++ b/Evergreen/Apps/Get-GhislerTotalCommander.ps1 @@ -25,11 +25,17 @@ function Get-GhislerTotalCommander { if ($null -ne $Response) { try { - $Value = ([RegEx]$res.Get.Update.MatchVersion).Match($Response).Groups.Value - $Version = $Value.Split(".")[1,2] -join "." - $VersionString = $Value.Split(".")[1,2] -join "" + $Value = ([Regex]$res.Get.Update.MatchVersion).Match($Response).Groups.Value + $Major = $Value.Split(".")[1] + $Minor = $Value.Split(".")[2] + if ([System.Int16]$Minor -le 9) { + $Minor = "0$Minor" + } + $Version = "$Major.$Minor" + $VersionString = "$Major$Minor" } catch { + Write-Warning -Message "$($MyInvocation.MyCommand): Failed to find version number." $Version = "Unknown" $VersionString = "Unknown" } From 1110a707d2c920adaa086f95ea85d38cd03628ff Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Fri, 29 Sep 2023 08:11:07 +1000 Subject: [PATCH 17/25] Update MicrosoftVisualStudio Update function. Update manifest for v17 --- Evergreen/Apps/Get-MicrosoftVisualStudio.ps1 | 40 +++++++------------ .../Manifests/MicrosoftVisualStudio.json | 8 ++-- 2 files changed, 19 insertions(+), 29 deletions(-) diff --git a/Evergreen/Apps/Get-MicrosoftVisualStudio.ps1 b/Evergreen/Apps/Get-MicrosoftVisualStudio.ps1 index af2d68ee..d179be40 100644 --- a/Evergreen/Apps/Get-MicrosoftVisualStudio.ps1 +++ b/Evergreen/Apps/Get-MicrosoftVisualStudio.ps1 @@ -1,4 +1,4 @@ -Function Get-MicrosoftVisualStudio { +function Get-MicrosoftVisualStudio { <# .SYNOPSIS Returns the current version of Microsoft Visual Studio and the download URL for Microsoft Visual Studio boot strapper. @@ -9,36 +9,26 @@ Function Get-MicrosoftVisualStudio { Twitter: @stealthpuppy #> [OutputType([System.Management.Automation.PSObject])] - [CmdletBinding(SupportsShouldProcess = $False)] + [CmdletBinding(SupportsShouldProcess = $false)] param ( - [Parameter(Mandatory = $False, Position = 0)] + [Parameter(Mandatory = $false, Position = 0)] [ValidateNotNull()] [System.Management.Automation.PSObject] $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) ) - # Resolve the update feed from the initial URI - $ResolvedUrl = Resolve-SystemNetWebRequest -Uri $res.Get.Update.Uri - If ($ResolvedUrl) { - try { - # Get details from the update feed - $updateFeed = Invoke-RestMethodWrapper -Uri $ResolvedUrl.ResponseUri.AbsoluteUri - } - catch { - Throw "$($MyInvocation.MyCommand): Failed to resolve update feed: $($ResolvedUrl.ResponseUri.AbsoluteUri)." - } - finally { - # Build the output object/s - $items = $updateFeed.channelItems | Where-Object { $_.id -eq $res.Get.Update.MatchFilter } - ForEach ($item in $items) { - $PSObject = [PSCustomObject] @{ - Version = $updateFeed.info.buildVersion - Sha256 = $item.payloads[0].Sha256 - Size = $item.payloads[0].size - URI = $item.payloads[0].url - } - Write-Output -InputObject $PSObject - } + # Get details from the update feed + $updateFeed = Invoke-RestMethodWrapper -Uri $res.Get.Update.Uri + + # Build the output object/s + $items = $updateFeed.channelItems | Where-Object { $_.id -eq $res.Get.Update.MatchFilter } + foreach ($item in $items) { + $PSObject = [PSCustomObject] @{ + Version = $updateFeed.info.buildVersion + Sha256 = $item.payloads[0].Sha256 + Size = $item.payloads[0].size + URI = $item.payloads[0].url } + Write-Output -InputObject $PSObject } } diff --git a/Evergreen/Manifests/MicrosoftVisualStudio.json b/Evergreen/Manifests/MicrosoftVisualStudio.json index 4e6d77b2..8bd04397 100644 --- a/Evergreen/Manifests/MicrosoftVisualStudio.json +++ b/Evergreen/Manifests/MicrosoftVisualStudio.json @@ -3,8 +3,8 @@ "Source": "https://visualstudio.microsoft.com/", "Get": { "Update": { - "Uri": "https://aka.ms/vs/16/release/channel", - "MatchFilter": "VisualStudio.16.Release.Bootstrappers.Setup" + "Uri": "https://aka.ms/vs/17/release/channel", + "MatchFilter": "VisualStudio.17.Release.Bootstrappers.Setup" }, "Download": { "Uri": "https://download.app.com" @@ -13,13 +13,13 @@ "Install": { "Setup": "AppName.*.exe", "Physical": { - "Arguments": "--channelid \"VisualStudio.16.Release\" --productid \"Microsoft.VisualStudio.Product.Community\"", + "Arguments": "--channelid \"VisualStudio.17.Release\" --productid \"Microsoft.VisualStudio.Product.Community\"", "PostInstall": [ ] }, "Virtual": { - "Arguments": "--channelid \"VisualStudio.16.Release\" --productid \"Microsoft.VisualStudio.Product.Community\"", + "Arguments": "--channelid \"VisualStudio.17.Release\" --productid \"Microsoft.VisualStudio.Product.Community\"", "PostInstall": [ ] From 5c80df3ff8d8a836217bad196ddcc6df4a424956 Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Fri, 29 Sep 2023 09:34:48 +1000 Subject: [PATCH 18/25] Create Get-MicrosoftFwLink.ps1 Shared function --- Evergreen/Shared/Get-MicrosoftFwLink.ps1 | 48 ++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Evergreen/Shared/Get-MicrosoftFwLink.ps1 diff --git a/Evergreen/Shared/Get-MicrosoftFwLink.ps1 b/Evergreen/Shared/Get-MicrosoftFwLink.ps1 new file mode 100644 index 00000000..5b87d541 --- /dev/null +++ b/Evergreen/Shared/Get-MicrosoftFwLink.ps1 @@ -0,0 +1,48 @@ +function Get-MicrosoftFwLink { + <# + .SYNOPSIS + Resolves https://go.microsoft.com/fwlink URLs + + .NOTES + Author: Aaron Parker + Twitter: @stealthpuppy + #> + [OutputType([System.Management.Automation.PSObject])] + [CmdletBinding(SupportsShouldProcess = $false)] + param ( + [Parameter(Mandatory = $false, Position = 0)] + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSObject] $res + ) + + process { + foreach ($Uri in $res.Get.Download.Uri) { + + # Resolve the URL + $params = @{ + Uri = $Uri + MaximumRedirection = $res.Get.Download.MaximumRedirection + } + $ResolvedUrl = Resolve-SystemNetWebRequest @params + + try { + # Find the version number + $Version = [RegEx]::Match($ResolvedUrl.ResponseUri.AbsoluteUri, "(\d+(\.\d+){1,4}).*").Captures.Groups[1].Value + } + catch { + Write-Warning -Message "$($MyInvocation.MyCommand): Failed to match version number from: $($ResolvedUrl.ResponseUri.AbsoluteUri)." + } + + # Output a version object + $Output = [PSCustomObject]@{ + Version = $Version + Date = $ResolvedUrl.LastModified #ConvertTo-DateTime -Date $ResolvedUrl.LastModified -Pattern $res.Get.Download.DatePattern + Size = $ResolvedUrl.ContentLength + Architecture = Get-Architecture -String $ResolvedUrl.ResponseUri.AbsoluteUri + Type = Get-FileType -File $ResolvedUrl.ResponseUri.AbsoluteUri + URI = $ResolvedUrl.ResponseUri.AbsoluteUri + } + Write-Output -InputObject $Output + } + } +} From 2322f8380a395d749399feab549eb4c99f70213e Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Fri, 29 Sep 2023 09:35:33 +1000 Subject: [PATCH 19/25] Drivers for SQL Server MicrosoftOLEDBDriverForSQLServer, MicrosoftODBCDriverForSQLServer --- .../Get-MicrosoftODBCDriverForSQLServer.ps1 | 17 +++++++++++ .../Get-MicrosoftOLEDBDriverForSQLServer.ps1 | 17 +++++++++++ .../MicrosoftODBCDriverForSQLServer.json | 30 +++++++++++++++++++ .../MicrosoftOLEDBDriverForSQLServer.json | 30 +++++++++++++++++++ 4 files changed, 94 insertions(+) create mode 100644 Evergreen/Apps/Get-MicrosoftODBCDriverForSQLServer.ps1 create mode 100644 Evergreen/Apps/Get-MicrosoftOLEDBDriverForSQLServer.ps1 create mode 100644 Evergreen/Manifests/MicrosoftODBCDriverForSQLServer.json create mode 100644 Evergreen/Manifests/MicrosoftOLEDBDriverForSQLServer.json diff --git a/Evergreen/Apps/Get-MicrosoftODBCDriverForSQLServer.ps1 b/Evergreen/Apps/Get-MicrosoftODBCDriverForSQLServer.ps1 new file mode 100644 index 00000000..e3b0cb08 --- /dev/null +++ b/Evergreen/Apps/Get-MicrosoftODBCDriverForSQLServer.ps1 @@ -0,0 +1,17 @@ +function Get-MicrosoftODBCDriverForSQLServer { + <# + .SYNOPSIS + + #> + [OutputType([System.Management.Automation.PSObject])] + [CmdletBinding(SupportsShouldProcess = $False)] + param ( + [Parameter(Mandatory = $False, Position = 0)] + [ValidateNotNull()] + [System.Management.Automation.PSObject] + $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) + ) + + $Output = Get-MicrosoftFwLink -res $res + Write-Output -InputObject $Output +} diff --git a/Evergreen/Apps/Get-MicrosoftOLEDBDriverForSQLServer.ps1 b/Evergreen/Apps/Get-MicrosoftOLEDBDriverForSQLServer.ps1 new file mode 100644 index 00000000..1e7ff798 --- /dev/null +++ b/Evergreen/Apps/Get-MicrosoftOLEDBDriverForSQLServer.ps1 @@ -0,0 +1,17 @@ +function Get-MicrosoftOLEDBDriverForSQLServer { + <# + .SYNOPSIS + + #> + [OutputType([System.Management.Automation.PSObject])] + [CmdletBinding(SupportsShouldProcess = $False)] + param ( + [Parameter(Mandatory = $False, Position = 0)] + [ValidateNotNull()] + [System.Management.Automation.PSObject] + $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) + ) + + $Output = Get-MicrosoftFwLink -res $res + Write-Output -InputObject $Output +} diff --git a/Evergreen/Manifests/MicrosoftODBCDriverForSQLServer.json b/Evergreen/Manifests/MicrosoftODBCDriverForSQLServer.json new file mode 100644 index 00000000..7192b8b0 --- /dev/null +++ b/Evergreen/Manifests/MicrosoftODBCDriverForSQLServer.json @@ -0,0 +1,30 @@ +{ + "Name": "Microsoft ODBC Driver for SQL Server", + "Source": "https://learn.microsoft.com/en-us/sql/connect/odbc/download-odbc-driver-for-sql-server", + "Get": { + "Update": { + "Uri": "" + }, + "Download": { + "Uri": [ + "https://go.microsoft.com/fwlink/?linkid=2242886", + "https://go.microsoft.com/fwlink/?linkid=2242980", + "https://go.microsoft.com/fwlink/?linkid=2243268" + ], + "MaximumRedirection": 3, + "DatePattern": "d/M/yyyy" + } + }, + "Install": { + "Setup": "", + "Preinstall": "", + "Physical": { + "Arguments": "", + "PostInstall": [] + }, + "Virtual": { + "Arguments": "", + "PostInstall": [] + } + } +} \ No newline at end of file diff --git a/Evergreen/Manifests/MicrosoftOLEDBDriverForSQLServer.json b/Evergreen/Manifests/MicrosoftOLEDBDriverForSQLServer.json new file mode 100644 index 00000000..f0f258fb --- /dev/null +++ b/Evergreen/Manifests/MicrosoftOLEDBDriverForSQLServer.json @@ -0,0 +1,30 @@ +{ + "Name": "Microsoft OLE DB Driver for SQL Server", + "Source": "https://learn.microsoft.com/en-us/sql/connect/oledb/download-oledb-driver-for-sql-server", + "Get": { + "Update": { + "Uri": "" + }, + "Download": { + "Uri": [ + "https://go.microsoft.com/fwlink/?linkid=2238602", + "https://go.microsoft.com/fwlink/?linkid=2238512", + "https://go.microsoft.com/fwlink/?linkid=2238411" + ], + "MaximumRedirection": 3, + "DatePattern": "d/M/yyyy" + } + }, + "Install": { + "Setup": "", + "Preinstall": "", + "Physical": { + "Arguments": "", + "PostInstall": [] + }, + "Virtual": { + "Arguments": "", + "PostInstall": [] + } + } +} \ No newline at end of file From 4a80a134e707036bc6f9fdb09232248f09461d56 Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Fri, 29 Sep 2023 19:25:22 +1000 Subject: [PATCH 20/25] VMware shared functions #474 --- Evergreen/Shared/Get-VMwareAPIPath.ps1 | 12 ++++++ .../Shared/Get-VMwareDLGDetailsQuery.ps1 | 20 +++++++++ .../Shared/Get-VMwareProductDownload.ps1 | 41 ++++++++++++++++++ Evergreen/Shared/Get-VMwareProductList.ps1 | 32 ++++++++++++++ Evergreen/Shared/Get-VMwareRelatedDLGList.ps1 | 42 +++++++++++++++++++ 5 files changed, 147 insertions(+) create mode 100644 Evergreen/Shared/Get-VMwareAPIPath.ps1 create mode 100644 Evergreen/Shared/Get-VMwareDLGDetailsQuery.ps1 create mode 100644 Evergreen/Shared/Get-VMwareProductDownload.ps1 create mode 100644 Evergreen/Shared/Get-VMwareProductList.ps1 create mode 100644 Evergreen/Shared/Get-VMwareRelatedDLGList.ps1 diff --git a/Evergreen/Shared/Get-VMwareAPIPath.ps1 b/Evergreen/Shared/Get-VMwareAPIPath.ps1 new file mode 100644 index 00000000..1c09df3d --- /dev/null +++ b/Evergreen/Shared/Get-VMwareAPIPath.ps1 @@ -0,0 +1,12 @@ +function Get-VMwareAPIPath { + [CmdletBinding(SupportsShouldProcess = $false)] + [OutputType("System.String")] + param ( + [Parameter(Mandatory = $false)] + [ValidateSet('products', 'dlg')] + [System.String] $Endpoint = "products" + ) + $ApiPath = "https://customerconnect.vmware.com/channel/public/api/v1.0/${Endpoint}" + Write-Verbose -Message "$($MyInvocation.MyCommand): Return $ApiPath" + return $ApiPath +} \ No newline at end of file diff --git a/Evergreen/Shared/Get-VMwareDLGDetailsQuery.ps1 b/Evergreen/Shared/Get-VMwareDLGDetailsQuery.ps1 new file mode 100644 index 00000000..45f41b0e --- /dev/null +++ b/Evergreen/Shared/Get-VMwareDLGDetailsQuery.ps1 @@ -0,0 +1,20 @@ +function Get-VMwareDLGDetailsQuery { + [OutputType("System.String")] + param ( + [Parameter(Mandatory = $true)] + [System.String] $DownloadGroup, + + [Parameter(Mandatory = $false)] + [System.String] $Locale = 'en_US' + ) + + $APIResource = 'details' + $queryParameters = @{ + locale = $Locale + downloadGroup = $DownloadGroup + } + $queryString = ($queryParameters.GetEnumerator() | ForEach-Object { "&$($_.Key)=$($_.Value)" }) -join '' + $DlgQuery = "$(Get-VMwareAPIPath -Endpoint 'dlg')/$($APIResource)?$($queryString.TrimStart('&'))" + Write-Verbose -Message "$($MyInvocation.MyCommand): $DlgQuery" + return $DlgQuery +} diff --git a/Evergreen/Shared/Get-VMwareProductDownload.ps1 b/Evergreen/Shared/Get-VMwareProductDownload.ps1 new file mode 100644 index 00000000..cc8227d3 --- /dev/null +++ b/Evergreen/Shared/Get-VMwareProductDownload.ps1 @@ -0,0 +1,41 @@ +function Get-VMwareProductDownload { + <# + .EXTERNALHELP Evergreen.VMware-help.xml + #> + param ( + [Parameter(Mandatory = $true, + Position = 0, + ValueFromPipelineByPropertyName)] + [ValidateNotNullOrEmpty()] + [System.String[]] $Name + ) + + process { + foreach ($Product in $Name) { + $VMwareProduct = Get-VMwareProductList -Name $Product + $VMwareDLG = $VMwareProduct | Get-VMwareRelatedDLGList + + foreach ($Dlg in $VMwareDLG) { + $params = @{ + Uri = $(Get-VMwareDLGDetailsQuery -DownloadGroup $Dlg.code) + } + $DownloadFiles = $(Invoke-RestMethodWrapper @params).downloadFiles + + foreach ($File in $DownloadFiles) { + if ([System.String]::IsNullOrEmpty($File.title)) { + } + else { + $Result = [PSCustomObject]@{ + Version = $File.version + ReleaseDate = $([System.DateTime]::ParseExact($File.releaseDate, "yyyy-MM-dd", [System.Globalization.CultureInfo]::CurrentUICulture.DateTimeFormat)) + Md5 = $File.md5checksum + Type = Get-FileType -File $File.fileName + URI = "https://download3.vmware.com/software/$($Dlg.code)/$($File.fileName)" + } + Write-Output -InputObject $Result + } + } + } + } + } +} diff --git a/Evergreen/Shared/Get-VMwareProductList.ps1 b/Evergreen/Shared/Get-VMwareProductList.ps1 new file mode 100644 index 00000000..9a3c297e --- /dev/null +++ b/Evergreen/Shared/Get-VMwareProductList.ps1 @@ -0,0 +1,32 @@ +function Get-VMwareProductList { + <# + .EXTERNALHELP Evergreen.VMware-help.xml + #> + [CmdletBinding(SupportsShouldProcess = $false)] + param ( + [Parameter(Mandatory = $false)] + [System.String] $Name + ) + + $APIResource = 'getProductsAtoZ' + $params = @{ + Uri = "$(Get-VMwareAPIPath)/${APIResource}" + } + $WebResult = Invoke-RestMethodWrapper @params + + $FilteredProductList = $WebResult.productCategoryList.ProductList + if ($PSBoundParameters.ContainsKey('Name')) { + $FilteredProductList = $FilteredProductList | Where-Object -FilterScript { $_.Name -eq $Name } + } + + $Result = $FilteredProductList | ForEach-Object -Process { + $Action = $_.actions | Where-Object -FilterScript { $_.linkname -eq "Download Product" } + [PSCustomObject]@{ + Name = $_.Name + CategoryMap = $($Action.target -split '/')[-3] + ProductMap = $($Action.target -split '/')[-2] + VersionMap = $($Action.target -split '/')[-1] + } + } + Write-Output -InputObject $Result +} diff --git a/Evergreen/Shared/Get-VMwareRelatedDLGList.ps1 b/Evergreen/Shared/Get-VMwareRelatedDLGList.ps1 new file mode 100644 index 00000000..683a1718 --- /dev/null +++ b/Evergreen/Shared/Get-VMwareRelatedDLGList.ps1 @@ -0,0 +1,42 @@ +function Get-VMwareRelatedDLGList { + [CmdletBinding(SupportsShouldProcess = $false)] + param ( + [Parameter(Mandatory = $true, + Position = 0, + ValueFromPipelineByPropertyName)] + [ValidateNotNullOrEmpty()] + [System.String] $CategoryMap, + + [Parameter(Mandatory = $true, + Position = 1, + ValueFromPipelineByPropertyName)] + [ValidateNotNullOrEmpty()] + [System.String] $ProductMap, + + [Parameter(Mandatory = $true, + Position = 2, + ValueFromPipelineByPropertyName)] + [ValidateNotNullOrEmpty()] + [System.String] $VersionMap, + + [Parameter(Mandatory = $false)] + [ValidateSet('PRODUCT_BINARY', 'DRIVERS_TOOLS', 'OPEN_SOURCE', 'CUSTOM_ISO', 'ADDONS')] + [System.String] $DLGType = 'PRODUCT_BINARY' + ) + + process { + $APIResource = 'getRelatedDLGList' + $queryParameters = @{ + category = $CategoryMap + product = $ProductMap + version = $VersionMap + dlgType = $DLGType + } + $queryString = ( $queryParameters.GetEnumerator() | ForEach-Object { "&$($_.Key)=$($_.Value)" }) -join '' + $params = @{ + Uri = "$(Get-VMwareAPIPath)/$($APIResource)?$($queryString.TrimStart('&'))" + } + $WebResult = Invoke-RestMethodWrapper @params + Write-Output -InputObject $WebResult.dlgEditionsLists.dlgList + } +} From 42a97bc85f2a1f2bac859ba3b813a2e19dc90905 Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Fri, 29 Sep 2023 19:25:32 +1000 Subject: [PATCH 21/25] Add VMwareSDWANClient --- Evergreen/Apps/Get-VMwareSDWANClient.ps1 | 23 +++++++++++++++++ Evergreen/Manifests/VMwareSDWANClient.json | 30 ++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 Evergreen/Apps/Get-VMwareSDWANClient.ps1 create mode 100644 Evergreen/Manifests/VMwareSDWANClient.json diff --git a/Evergreen/Apps/Get-VMwareSDWANClient.ps1 b/Evergreen/Apps/Get-VMwareSDWANClient.ps1 new file mode 100644 index 00000000..033a043f --- /dev/null +++ b/Evergreen/Apps/Get-VMwareSDWANClient.ps1 @@ -0,0 +1,23 @@ +function Get-VMwareSDWANClient { + <# + .NOTES + Author: Aaron Parker + Twitter: @stealthpuppy + #> + [OutputType([System.Management.Automation.PSObject])] + [CmdletBinding(SupportsShouldProcess = $False)] + param ( + [Parameter(Mandatory = $false, Position = 0)] + [ValidateNotNull()] + [System.Management.Automation.PSObject] + $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) + ) + + $Output = Get-VMwareProductList -Name $res.Get.Download.ProductName | ` + Get-VMwareProductDownload | ` + Where-Object { $_.URI -match $res.Get.Download.MatchFileTypes } | ` + Sort-Object -Property "ReleaseDate" | ` + Select-Object -Last 1 | ` + ForEach-Object { $_.Version = $_.Version -replace $res.Get.Download.ReplaceText, ""; $_ } + Write-Output -InputObject $Output +} diff --git a/Evergreen/Manifests/VMwareSDWANClient.json b/Evergreen/Manifests/VMwareSDWANClient.json new file mode 100644 index 00000000..34bd2e85 --- /dev/null +++ b/Evergreen/Manifests/VMwareSDWANClient.json @@ -0,0 +1,30 @@ +{ + "Name": "VMware SD-WAN Client", + "Source": "https://docs.vmware.com/en/VMware-SD-WAN-Client/index.html", + "Get": { + "Update": { + "Uri": "" + }, + "Download": { + "Uri": "download3.vmware.com", + "ProductName": "VMware SD-WAN Client", + "MatchFileTypes": "\\.exe$|\\.msi$", + "ReplaceText": "SD-WAN Client " + } + }, + "Install": { + "Setup": "", + "Physical": { + "Arguments": "", + "PostInstall": [ + + ] + }, + "Virtual": { + "Arguments": "", + "PostInstall": [ + + ] + } + } +} From f7824742d297f1593cc4029c9b450df5dc139178 Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Fri, 29 Sep 2023 19:44:07 +1000 Subject: [PATCH 22/25] Update Get-VMwareProductDownload.ps1 Add properties --- Evergreen/Shared/Get-VMwareProductDownload.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Evergreen/Shared/Get-VMwareProductDownload.ps1 b/Evergreen/Shared/Get-VMwareProductDownload.ps1 index cc8227d3..d8f5564b 100644 --- a/Evergreen/Shared/Get-VMwareProductDownload.ps1 +++ b/Evergreen/Shared/Get-VMwareProductDownload.ps1 @@ -29,6 +29,8 @@ function Get-VMwareProductDownload { Version = $File.version ReleaseDate = $([System.DateTime]::ParseExact($File.releaseDate, "yyyy-MM-dd", [System.Globalization.CultureInfo]::CurrentUICulture.DateTimeFormat)) Md5 = $File.md5checksum + Sha256 = $File.sha256checksum + Size = $File.fileSize Type = Get-FileType -File $File.fileName URI = "https://download3.vmware.com/software/$($Dlg.code)/$($File.fileName)" } From 7c301d7ab1f8f70db5ff99edb65358c5ddfe1e75 Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Fri, 29 Sep 2023 19:44:19 +1000 Subject: [PATCH 23/25] Update VMware apps #474 --- Evergreen/Apps/Get-VMwareHorizonClient.ps1 | 85 ++--------------- Evergreen/Apps/Get-VMwareHorizonClientAlt.ps1 | 91 +++++++++++++------ .../Apps/Get-VMwareWorkstationPlayer.ps1 | 42 ++------- Evergreen/Apps/Get-VMwareWorkstationPro.ps1 | 42 ++------- Evergreen/Manifests/VMwareHorizonClient.json | 34 ------- Evergreen/Manifests/VMwareHorizonClient2.json | 30 ++++++ .../Manifests/VMwareHorizonClientAlt.json | 12 ++- .../Manifests/VMwareWorkstationPlayer.json | 10 +- Evergreen/Manifests/VMwareWorkstationPro.json | 8 +- 9 files changed, 142 insertions(+), 212 deletions(-) delete mode 100644 Evergreen/Manifests/VMwareHorizonClient.json create mode 100644 Evergreen/Manifests/VMwareHorizonClient2.json diff --git a/Evergreen/Apps/Get-VMwareHorizonClient.ps1 b/Evergreen/Apps/Get-VMwareHorizonClient.ps1 index c4e2b0ca..2b055b08 100644 --- a/Evergreen/Apps/Get-VMwareHorizonClient.ps1 +++ b/Evergreen/Apps/Get-VMwareHorizonClient.ps1 @@ -1,4 +1,4 @@ -Function Get-VMwareHorizonClient { +function Get-VMwareHorizonClient { <# .NOTES Author: Aaron Parker @@ -7,84 +7,17 @@ [OutputType([System.Management.Automation.PSObject])] [CmdletBinding(SupportsShouldProcess = $False)] param ( - [Parameter(Mandatory = $False, Position = 0)] + [Parameter(Mandatory = $false, Position = 0)] [ValidateNotNull()] [System.Management.Automation.PSObject] $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) ) - # Query the Horizon Client update feed - $params = @{ - Uri = $res.Get.Update.Uri - ContentType = $res.Get.Update.ContentType - } - $Updates = Invoke-RestMethodWrapper @params - if ($null -ne $Updates) { - - # Select the latest version - #$LatestVersion = $Updates.($res.Get.Update.Property) - Write-Verbose -Message "$($MyInvocation.MyCommand): Selecting latest version from the update data." - $LatestVersion = $Updates.metaList.metadata | ` - Sort-Object -Property @{ Expression = { [System.Version]$_.version }; Descending = $true } | ` - Select-Object -First 1 - $UpdateList = $Updates.metaList.metadata | Where-Object { $_.version -match $LatestVersion.version } - - # $_.version number property needs to also be match to latest version in $_.url property - if ($UpdateList.Count -eq 1) { - Write-Verbose -Message "$($MyInvocation.MyCommand): Found one available update for version: $($LatestVersion.version)." - } - else { - Write-Verbose -Message "$($MyInvocation.MyCommand): Found $($UpdateList.Count) available updates for version: $($LatestVersion.version)." - Write-Verbose -Message "$($MyInvocation.MyCommand): Match latest update." - $VersionList = New-Object -TypeName "System.Collections.ArrayList" - foreach ($Update in $UpdateList) { - $Version = [RegEx]::Match($Update.url, $res.Get.Update.MatchVersion).Captures.Groups[1].Value - $VersionList.Add($Version) | Out-Null - } - - # Find the latest version and re-filter the update data to find the latest release - $Version = $VersionList | ` - Sort-Object -Property @{ Expression = { [System.Version]$_ }; Descending = $true } | ` - Select-Object -First 1 - Write-Verbose -Message "$($MyInvocation.MyCommand): Found version: $Version." - Write-Verbose -Message "$($MyInvocation.MyCommand): Filter update list for version: $Version." - $LatestVersion = $Updates.metaList.metadata | ` - Sort-Object -Property @{ Expression = { [System.Version]$_.version }; Descending = $true } | ` - Where-Object { $_.url -match $Version } | Select-Object -First 1 - } - - # Download the version specific update XML in Gzip format - if ($null -ne $LatestVersion) { - $GZipFile = Save-File -Uri "$($res.Get.Download.Uri)$($LatestVersion.Url.TrimStart("../"))" - - # Expand the downloaded Gzip file to get the XMl file - $ExpandFile = Expand-GzipArchive -Path $GZipFile.FullName - - # Get the version specific details from the XML file - try { - Write-Verbose -Message "$($MyInvocation.MyCommand): Read XML content from: $ExpandFile." - [System.XML.XMLDocument] $xmlDocument = Get-Content -Path $ExpandFile - $Version = (Select-Xml -Xml $xmlDocument -XPath $res.Get.Download.VersionXPath | Select-Object –ExpandProperty "node").($res.Get.Download.VersionProperty) - $FileName = (Select-Xml -Xml $xmlDocument -XPath $res.Get.Download.FileXPath | Select-Object –ExpandProperty "node").($res.Get.Download.FileProperty) - } - catch { - throw "$($MyInvocation.MyCommand): Failed to convert metadata XML." - } - finally { - Write-Verbose -Message "$($MyInvocation.MyCommand): Delete: $($GZipFile.FullName)." - Remove-Item -Path $GZipFile.FullName -ErrorAction "SilentlyContinue" - Write-Verbose -Message "$($MyInvocation.MyCommand): Delete: $ExpandFile." - Remove-Item -Path $ExpandFile -ErrorAction "SilentlyContinue" - } - - # Build the object and write to the pipeline - if (($null -ne $Version) -and ($null -ne $FileName)) { - $PSObject = [PSCustomObject] @{ - Version = "$($Version.version).$($Version.buildNumber)" - URI = "$($res.Get.Download.Uri)$($Version.productId)/$($Version.version)/$($Version.buildNumber)/$($FileName)" - } - Write-Output -InputObject $PSObject - } - } - } + $Output = Get-VMwareProductList -Name $res.Get.Download.ProductName | ` + Get-VMwareProductDownload | ` + Where-Object { $_.URI -match $res.Get.Download.MatchFileTypes } | ` + Sort-Object -Property "ReleaseDate" | ` + Select-Object -Last 1 | ` + ForEach-Object { $_.Version = $_.Version -replace $res.Get.Download.ReplaceText, ""; $_ } + Write-Output -InputObject $Output } diff --git a/Evergreen/Apps/Get-VMwareHorizonClientAlt.ps1 b/Evergreen/Apps/Get-VMwareHorizonClientAlt.ps1 index ecca4ef4..49aba95a 100644 --- a/Evergreen/Apps/Get-VMwareHorizonClientAlt.ps1 +++ b/Evergreen/Apps/Get-VMwareHorizonClientAlt.ps1 @@ -1,48 +1,87 @@ -Function Get-VMwareHorizonClientAlt { +function Get-VMwareHorizonClientAlt { <# - .SYNOPSIS - Get the current version and download URL for the VMware Horizon Client - .NOTES Author: Aaron Parker Twitter: @stealthpuppy #> [OutputType([System.Management.Automation.PSObject])] - [CmdletBinding(SupportsShouldProcess = $False)] + [CmdletBinding(SupportsShouldProcess = $false)] param ( - [Parameter(Mandatory = $False, Position = 0)] + [Parameter(Mandatory = $false, Position = 0)] [ValidateNotNull()] [System.Management.Automation.PSObject] $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) ) - $Update = Invoke-RestMethodWrapper -Uri $res.Get.Update.Uri - if ($Null -eq $Update) { - Write-Error -Message "$($MyInvocation.MyCommand): Failed to return usable content from $($res.Get.Update.Uri)." + # Query the Horizon Client update feed + $params = @{ + Uri = $res.Get.Update.Uri + ContentType = $res.Get.Update.ContentType } - else { + $Updates = Invoke-RestMethodWrapper @params + if ($null -ne $Updates) { + + # Select the latest version + #$LatestVersion = $Updates.($res.Get.Update.Property) + Write-Verbose -Message "$($MyInvocation.MyCommand): Selecting latest version from the update data." + $LatestVersion = $Updates.metaList.metadata | ` + Sort-Object -Property @{ Expression = { [System.Version]$_.version }; Descending = $true } | ` + Select-Object -First 1 + $UpdateList = $Updates.metaList.metadata | Where-Object { $_.version -match $LatestVersion.version } - $FileUrl = $res.Get.Update.File -replace "#releasePackageId", $Update.product.releasePackageId - $File = Invoke-RestMethodWrapper -Uri $FileUrl - if ($Null -eq $File) { - Write-Error -Message "$($MyInvocation.MyCommand): Failed to return usable content from $FileUrl." + # $_.version number property needs to also be match to latest version in $_.url property + if ($UpdateList.Count -eq 1) { + Write-Verbose -Message "$($MyInvocation.MyCommand): Found one available update for version: $($LatestVersion.version)." } else { + Write-Verbose -Message "$($MyInvocation.MyCommand): Found $($UpdateList.Count) available updates for version: $($LatestVersion.version)." + Write-Verbose -Message "$($MyInvocation.MyCommand): Match latest update." + $VersionList = New-Object -TypeName "System.Collections.ArrayList" + foreach ($Update in $UpdateList) { + $Version = [RegEx]::Match($Update.url, $res.Get.Update.MatchVersion).Captures.Groups[1].Value + $VersionList.Add($Version) | Out-Null + } + + # Find the latest version and re-filter the update data to find the latest release + $Version = $VersionList | ` + Sort-Object -Property @{ Expression = { [System.Version]$_ }; Descending = $true } | ` + Select-Object -First 1 + Write-Verbose -Message "$($MyInvocation.MyCommand): Found version: $Version." + Write-Verbose -Message "$($MyInvocation.MyCommand): Filter update list for version: $Version." + $LatestVersion = $Updates.metaList.metadata | ` + Sort-Object -Property @{ Expression = { [System.Version]$_.version }; Descending = $true } | ` + Where-Object { $_.url -match $Version } | Select-Object -First 1 + } - Write-Verbose -Message "$($MyInvocation.MyCommand): filter for files." - $DownloadFile = $File.downloadFiles | Where-Object { $_.fileType -match "exe|zip" } - Write-Verbose -Message "$($MyInvocation.MyCommand): found $($DownloadFile.Count) object/s." + # Download the version specific update XML in Gzip format + if ($null -ne $LatestVersion) { + $GZipFile = Save-File -Uri "$($res.Get.Download.Uri)$($LatestVersion.Url.TrimStart("../"))" + + # Expand the downloaded Gzip file to get the XMl file + $ExpandFile = Expand-GzipArchive -Path $GZipFile.FullName + + # Get the version specific details from the XML file + try { + Write-Verbose -Message "$($MyInvocation.MyCommand): Read XML content from: $ExpandFile." + [System.XML.XMLDocument] $xmlDocument = Get-Content -Path $ExpandFile + $Version = (Select-Xml -Xml $xmlDocument -XPath $res.Get.Download.VersionXPath | Select-Object –ExpandProperty "node").($res.Get.Download.VersionProperty) + $FileName = (Select-Xml -Xml $xmlDocument -XPath $res.Get.Download.FileXPath | Select-Object –ExpandProperty "node").($res.Get.Download.FileProperty) + } + catch { + throw "$($MyInvocation.MyCommand): Failed to convert metadata XML." + } + finally { + Write-Verbose -Message "$($MyInvocation.MyCommand): Delete: $($GZipFile.FullName)." + Remove-Item -Path $GZipFile.FullName -ErrorAction "SilentlyContinue" + Write-Verbose -Message "$($MyInvocation.MyCommand): Delete: $ExpandFile." + Remove-Item -Path $ExpandFile -ErrorAction "SilentlyContinue" + } - # Build the output object - foreach ($Item in $DownloadFile) { + # Build the object and write to the pipeline + if (($null -ne $Version) -and ($null -ne $FileName)) { $PSObject = [PSCustomObject] @{ - Version = $($Update.versions.name | Select-Object -First 1) - Date = ConvertTo-DateTime -DateTime $Item.releaseDate -Pattern "yyyy-MM-dd" - Sha256 = $Item.sha256checksum - Size = $Item.fileSize - Type = Get-FileType -File $Item.fileName - Title = $Item.title - URI = $res.Get.Download.Uri -replace "#container", $($Update.versions.id | Select-Object -First 1) -replace "#filename", $Item.fileName + Version = "$($Version.version).$($Version.buildNumber)" + URI = "$($res.Get.Download.Uri)$($Version.productId)/$($Version.version)/$($Version.buildNumber)/$($FileName)" } Write-Output -InputObject $PSObject } diff --git a/Evergreen/Apps/Get-VMwareWorkstationPlayer.ps1 b/Evergreen/Apps/Get-VMwareWorkstationPlayer.ps1 index 85f8631a..283b17d0 100644 --- a/Evergreen/Apps/Get-VMwareWorkstationPlayer.ps1 +++ b/Evergreen/Apps/Get-VMwareWorkstationPlayer.ps1 @@ -1,8 +1,5 @@ -Function Get-VMwareWorkstationPlayer { +function Get-VMwareWorkstationPlayer { <# - .SYNOPSIS - Get the current version and download URL for the VMware Workstation Player. - .NOTES Author: Aaron Parker Twitter: @stealthpuppy @@ -10,38 +7,17 @@ [OutputType([System.Management.Automation.PSObject])] [CmdletBinding(SupportsShouldProcess = $False)] param ( - [Parameter(Mandatory = $False, Position = 0)] + [Parameter(Mandatory = $false, Position = 0)] [ValidateNotNull()] [System.Management.Automation.PSObject] $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) ) - $Update = Invoke-RestMethodWrapper -Uri $res.Get.Update.Uri - if ($Null -eq $Update) { - Write-Error -Message "$($MyInvocation.MyCommand): Failed to return usable content from $($res.Get.Update.Uri)." - } - else { - - $File = Invoke-RestMethodWrapper -Uri $res.Get.Update.File - if ($Null -eq $File) { - Write-Error -Message "$($MyInvocation.MyCommand): Failed to return usable content from $($res.Get.Update.File)." - } - else { - - Write-Verbose -Message "$($MyInvocation.MyCommand): filter for exe files." - $DownloadFile = $File.downloadFiles | Where-Object { $_.fileType -eq "exe" } - Write-Verbose -Message "$($MyInvocation.MyCommand): found $($DownloadFile.Count) object/s." - - # Build the output object - $PSObject = [PSCustomObject] @{ - Version = $($Update.versions.name | Sort-Object -Property @{ Expression = { [System.Version]$_ }; Descending = $true } | Select-Object -First 1) - Date = ConvertTo-DateTime -DateTime $DownloadFile.releaseDate -Pattern "yyyy-MM-dd" - Sha256 = $DownloadFile.sha256checksum - Size = $DownloadFile.fileSize - Type = Get-FileType -File $DownloadFile.fileName - URI = $res.Get.Download.Uri -replace "#filename", $DownloadFile.fileName - } - Write-Output -InputObject $PSObject - } - } + $Output = Get-VMwareProductList -Name $res.Get.Download.ProductName | ` + Get-VMwareProductDownload | ` + Where-Object { $_.URI -match $res.Get.Download.MatchFileTypes } | ` + Sort-Object -Property "ReleaseDate" | ` + Select-Object -Last 1 | ` + ForEach-Object { $_.Version = $_.Version -replace $res.Get.Download.ReplaceText, ""; $_ } + Write-Output -InputObject $Output } diff --git a/Evergreen/Apps/Get-VMwareWorkstationPro.ps1 b/Evergreen/Apps/Get-VMwareWorkstationPro.ps1 index 598fe340..7cc422da 100644 --- a/Evergreen/Apps/Get-VMwareWorkstationPro.ps1 +++ b/Evergreen/Apps/Get-VMwareWorkstationPro.ps1 @@ -1,8 +1,5 @@ -Function Get-VMwareWorkstationPro { +function Get-VMwareWorkstationPro { <# - .SYNOPSIS - Get the current version and download URL for the VMware Workstation Pro. - .NOTES Author: Aaron Parker Twitter: @stealthpuppy @@ -10,38 +7,17 @@ [OutputType([System.Management.Automation.PSObject])] [CmdletBinding(SupportsShouldProcess = $False)] param ( - [Parameter(Mandatory = $False, Position = 0)] + [Parameter(Mandatory = $false, Position = 0)] [ValidateNotNull()] [System.Management.Automation.PSObject] $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) ) - $Update = Invoke-RestMethodWrapper -Uri $res.Get.Update.Uri - if ($Null -eq $Update) { - Write-Error -Message "$($MyInvocation.MyCommand): Failed to return usable content from $($res.Get.Update.Uri)." - } - else { - - $File = Invoke-RestMethodWrapper -Uri $res.Get.Update.File - if ($Null -eq $File) { - Write-Error -Message "$($MyInvocation.MyCommand): Failed to return usable content from $($res.Get.Update.File)." - } - else { - - Write-Verbose -Message "$($MyInvocation.MyCommand): filter for exe files." - $DownloadFile = $File.downloadFiles | Where-Object { $_.fileType -eq "exe" } - Write-Verbose -Message "$($MyInvocation.MyCommand): found $($DownloadFile.Count) object/s." - - # Build the output object - $PSObject = [PSCustomObject] @{ - Version = $($Update.versions.name | Sort-Object -Property @{ Expression = { [System.Version]$_ }; Descending = $true } | Select-Object -First 1) - Date = ConvertTo-DateTime -DateTime $DownloadFile.releaseDate -Pattern "yyyy-MM-dd" - Sha256 = $DownloadFile.sha256checksum - Size = $DownloadFile.fileSize - Type = Get-FileType -File $DownloadFile.fileName - URI = $res.Get.Download.Uri -replace "#filename", $DownloadFile.fileName - } - Write-Output -InputObject $PSObject - } - } + $Output = Get-VMwareProductList -Name $res.Get.Download.ProductName | ` + Get-VMwareProductDownload | ` + Where-Object { $_.URI -match $res.Get.Download.MatchFileTypes } | ` + Sort-Object -Property "ReleaseDate" | ` + Select-Object -Last 1 | ` + ForEach-Object { $_.Version = $_.Version -replace $res.Get.Download.ReplaceText, ""; $_ } + Write-Output -InputObject $Output } diff --git a/Evergreen/Manifests/VMwareHorizonClient.json b/Evergreen/Manifests/VMwareHorizonClient.json deleted file mode 100644 index 8cc8f5fe..00000000 --- a/Evergreen/Manifests/VMwareHorizonClient.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "Name": "VMware Horizon Client", - "Source": "https://docs.vmware.com/en/VMware-Horizon-Client/index.html", - "Get": { - "Update": { - "Uri": "https://softwareupdate.vmware.com/horizon-clients/zon-clients/viewcrt-windows.xml", - "ContentType": "application/xml", - "Property": "metaList.metadata", - "MatchVersion": "(\\d+(\\.\\d+){1,4}).*" - }, - "Download": { - "Uri": "https://softwareupdate.vmware.com/horizon-clients/", - "VersionXPath": "//productList", - "VersionProperty": "product", - "FileXPath": "//relativePath", - "FileProperty": "#text" - } - }, - "Install": { - "Setup": "VMware-Horizon-Client*.exe", - "Physical": { - "Arguments": "", - "PostInstall": [ - - ] - }, - "Virtual": { - "Arguments": "", - "PostInstall": [ - - ] - } - } -} diff --git a/Evergreen/Manifests/VMwareHorizonClient2.json b/Evergreen/Manifests/VMwareHorizonClient2.json new file mode 100644 index 00000000..dde1842c --- /dev/null +++ b/Evergreen/Manifests/VMwareHorizonClient2.json @@ -0,0 +1,30 @@ +{ + "Name": "VMware Horizon Client", + "Source": "https://docs.vmware.com/en/VMware-Horizon-Client/index.html", + "Get": { + "Update": { + "Uri": "" + }, + "Download": { + "Uri": "download3.vmware.com", + "ProductName": "VMware Horizon Clients", + "MatchFileTypes": "\\.exe$|\\.msi$", + "ReplaceText": "" + } + }, + "Install": { + "Setup": "", + "Physical": { + "Arguments": "", + "PostInstall": [ + + ] + }, + "Virtual": { + "Arguments": "", + "PostInstall": [ + + ] + } + } +} diff --git a/Evergreen/Manifests/VMwareHorizonClientAlt.json b/Evergreen/Manifests/VMwareHorizonClientAlt.json index a6db5449..91b3bb68 100644 --- a/Evergreen/Manifests/VMwareHorizonClientAlt.json +++ b/Evergreen/Manifests/VMwareHorizonClientAlt.json @@ -3,11 +3,17 @@ "Source": "https://docs.vmware.com/en/VMware-Horizon-Client/index.html", "Get": { "Update": { - "Uri": "https://customerconnect.vmware.com/channel/public/api/v1.0/products/getDLGHeader?locale=en_US&downloadGroup=CART23FQ1_WIN_2203&productId=1027", - "File": "https://customerconnect.vmware.com/channel/public/api/v1.0/dlg/details?locale=en_US&downloadGroup=CART23FQ1_WIN_2203&productId=1027&rPId=#releasePackageId" + "Uri": "https://softwareupdate.vmware.com/horizon-clients/zon-clients/viewcrt-windows.xml", + "ContentType": "application/xml", + "Property": "metaList.metadata", + "MatchVersion": "(\\d+(\\.\\d+){1,4}).*" }, "Download": { - "Uri": "https://download3.vmware.com/software/#container/#filename" + "Uri": "https://softwareupdate.vmware.com/horizon-clients/", + "VersionXPath": "//productList", + "VersionProperty": "product", + "FileXPath": "//relativePath", + "FileProperty": "#text" } }, "Install": { diff --git a/Evergreen/Manifests/VMwareWorkstationPlayer.json b/Evergreen/Manifests/VMwareWorkstationPlayer.json index 38fdaf02..e3252f0c 100644 --- a/Evergreen/Manifests/VMwareWorkstationPlayer.json +++ b/Evergreen/Manifests/VMwareWorkstationPlayer.json @@ -3,15 +3,17 @@ "Source": "https://www.vmware.com/products/workstation-player.html", "Get": { "Update": { - "Uri": "https://customerconnect.vmware.com/channel/public/api/v1.0/products/getDLGHeader?locale=en_US&downloadGroup=WKST-PLAYER-1701&productId=1377", - "File": "https://customerconnect.vmware.com/channel/public/api/v1.0/dlg/details?locale=en_US&downloadGroup=WKST-PLAYER-1701" + "Uri": "" }, "Download": { - "Uri": "https://download3.vmware.com/software/WKST-PLAYER-1701/#filename" + "Uri": "download3.vmware.com", + "ProductName": "VMware Workstation Player", + "MatchFileTypes": "\\.exe$|\\.msi$", + "ReplaceText": "" } }, "Install": { - "Setup": "VMware-player*.exe", + "Setup": "", "Physical": { "Arguments": "", "PostInstall": [ diff --git a/Evergreen/Manifests/VMwareWorkstationPro.json b/Evergreen/Manifests/VMwareWorkstationPro.json index a109e9d7..986fd3f4 100644 --- a/Evergreen/Manifests/VMwareWorkstationPro.json +++ b/Evergreen/Manifests/VMwareWorkstationPro.json @@ -3,11 +3,13 @@ "Source": "https://www.vmware.com/products/workstation-pro.html", "Get": { "Update": { - "Uri": "https://customerconnect.vmware.com/channel/public/api/v1.0/products/getDLGHeader?locale=en_US&downloadGroup=WKST-1701-WIN&productId=1376", - "File": "https://customerconnect.vmware.com/channel/public/api/v1.0/dlg/details?downloadGroup=WKST-1701-WIN" + "Uri": "" }, "Download": { - "Uri": "https://download3.vmware.com/software/WKST-1701-WIN/#filename" + "Uri": "download3.vmware.com", + "ProductName": "VMware Workstation Pro", + "MatchFileTypes": "\\.exe$|\\.msi$", + "ReplaceText": "" } }, "Install": { From 88eca83614586217af1da7ec12f8fe8a7c199c40 Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Fri, 29 Sep 2023 20:05:32 +1000 Subject: [PATCH 24/25] Update Get-EvergreenApp.Tests.ps1 --- tests/Public/Get-EvergreenApp.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Public/Get-EvergreenApp.Tests.ps1 b/tests/Public/Get-EvergreenApp.Tests.ps1 index 98734486..7c435f60 100644 --- a/tests/Public/Get-EvergreenApp.Tests.ps1 +++ b/tests/Public/Get-EvergreenApp.Tests.ps1 @@ -10,7 +10,7 @@ param () BeforeDiscovery { # Get the supported applications and sort randomly # Exclude applications that have issues when run from GitHub or fail randomly due to the source server - $AppsToSkip = "MicrosoftWvdRtcService|MicrosoftWvdRemoteDesktop|MicrosoftWvdMultimediaRedirection|MicrosoftWvdInfraAgent|MicrosoftWvdBootloader|MestrelabMnova|MozillaFirefox|AWSCLI|OBSStudio|ProgressChefInfraClient|MirantisLens" + $AppsToSkip = "MicrosoftWvdRtcService|MicrosoftWvdRemoteDesktop|MicrosoftWvdMultimediaRedirection|MicrosoftWvdInfraAgent|MicrosoftWvdBootloader|MestrelabMnova|MozillaFirefox|AWSCLI|OBSStudio|ProgressChefInfraClient|MirantisLens|JetBrainsHub" $Applications = Find-EvergreenApp | ` Where-Object { $_.Name -notmatch $AppsToSkip } | ` Sort-Object { Get-Random } | Select-Object -ExpandProperty "Name" From 152173345a05ad6fc8098225cc45615b3c7601da Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Fri, 29 Sep 2023 20:14:36 +1000 Subject: [PATCH 25/25] Update changelog.md --- docs/changelog.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/changelog.md b/docs/changelog.md index 447c7092..52de7be0 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -3,7 +3,15 @@ ## VERSION * Adds `OracleJava20`, `OracleJava17` [#381](https://github.com/aaronparker/evergreen/issues/381) +* Adds `Get-VMwareSDWANClient`, `MicrosoftODBCDriverForSQLServer`, `MicrosoftOLEDBDriverForSQLServer` * Updates `GoogleChrome` to address missing `x86` installers [#550](https://github.com/aaronparker/evergreen/issues/550) +* Updates `GhislerTotalCommander` to address version and URL issue [#552](https://github.com/aaronparker/evergreen/issues/552) +* Updates `GitForWindows` to address version string issue [#511](https://github.com/aaronparker/evergreen/issues/511) +* Optimises shared code for Hashicorp apps +* Optimises shared code for Opera apps +* Optimises shared code for Oracle Java apps +* Optimises shared code for VMware apps [#474](https://github.com/aaronparker/evergreen/issues/474) +* Updates `MicrosoftVisualStudio` to return release `17` ## 2309.850