diff --git a/Evergreen/Apps/Get-MicrosoftOneDrive.ps1 b/Evergreen/Apps/Get-MicrosoftOneDrive.ps1 index a6d2178c..511e534b 100644 --- a/Evergreen/Apps/Get-MicrosoftOneDrive.ps1 +++ b/Evergreen/Apps/Get-MicrosoftOneDrive.ps1 @@ -12,73 +12,75 @@ [CmdletBinding(SupportsShouldProcess = $False)] param ( [Parameter(Mandatory = $False, Position = 0)] - [ValidateNotNull()] + [ValidateNotNullOrEmpty()] [System.Management.Automation.PSObject] $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) ) # Step through each release URI - foreach ($ring in $res.Get.Uri.GetEnumerator()) { - try { - [System.XML.XMLDocument] $xmlDocument = Invoke-WebRequestWrapper -Uri $res.Get.Uri[$ring.Key] -Raw - } - catch [System.Exception] { - throw "$($MyInvocation.MyCommand): failed to convert feed into an XML object with: $($_.Exception.Message)" + foreach ($ring in $res.Get.Update.Uri.GetEnumerator()) { + $params = @{ + Uri = $res.Get.Update.Uri[$ring.Key] + ContentType = $res.Get.Update.ContentType + Raw = $true + ErrorAction = "Stop" } + [System.XML.XMLDocument] $xmlDocument = Invoke-WebRequestWrapper @params # Build an output object by selecting installer entries from the feed if ($xmlDocument -is [System.XML.XMLDocument]) { # Select the required node/s from the XML feed - $nodes = Select-Xml -Xml $xmlDocument -XPath $res.Get.XmlNode | Select-Object –ExpandProperty "node" + $nodes = Select-Xml -Xml $xmlDocument -XPath $res.Get.Update.XmlNode | Select-Object -ExpandProperty "node" # Find the latest version foreach ($node in $nodes) { if ([System.Boolean]($node.PSobject.Properties.name -match "amd64binary")) { - $PSObject = [PSCustomObject] @{ + [PSCustomObject] @{ Version = $node.currentversion + Throttle = $node.throttle Architecture = Get-Architecture -String $node.amd64binary.url Ring = $ring.Name - Sha256 = $node.amd64binary.sha256hash Type = [System.IO.Path]::GetExtension($node.amd64binary.url).Split(".")[-1] + Sha256 = $node.amd64binary.sha256hash URI = $node.amd64binary.url - } - Write-Output -InputObject $PSObject + } | Write-Output } if ([System.Boolean]($node.PSobject.Properties.name -match "arm64binary")) { - $PSObject = [PSCustomObject] @{ + [PSCustomObject] @{ Version = $node.currentversion + Throttle = $node.throttle Architecture = Get-Architecture -String $node.arm64binary.url Ring = $ring.Name + Type = Get-FileType -File $node.arm64binary.url Sha256 = $node.arm64binary.sha256hash - Type = [System.IO.Path]::GetExtension($node.arm64binary.url).Split(".")[-1] URI = $node.arm64binary.url - } - Write-Output -InputObject $PSObject + } | Write-Output } if ([System.Boolean]($node.PSobject.Properties.name -match "msixbinary")) { # Construct the output for MSIX; Return the custom object to the pipeline - $PSObject = [PSCustomObject] @{ + [PSCustomObject] @{ Version = $node.currentversion + Throttle = $node.throttle Architecture = Get-Architecture -String $node.msixbinary.url Ring = $ring.Name + Type = Get-FileType -File $node.msixbinary.url Sha256 = if ($node.msixbinary.sha256hash) { $node.msixbinary.sha256hash } else { "N/A" } - Type = [System.IO.Path]::GetExtension($node.msixbinary.url).Split(".")[-1] URI = $node.msixbinary.url - } - Write-Output -InputObject $PSObject + } | Write-Output } # Construct the output for EXE; Return the custom object to the pipeline if ([System.Boolean]($node.PSobject.Properties.name -match "binary")) { $PSObject = [PSCustomObject] @{ Version = $node.currentversion + Throttle = $node.throttle Architecture = Get-Architecture -String $node.binary.url Ring = $ring.Name Sha256 = $node.binary.sha256hash - Type = [System.IO.Path]::GetExtension($node.binary.url).Split(".")[-1] + Type = Get-FileType -File $node.binary.url URI = $node.binary.url } Write-Output -InputObject $PSObject diff --git a/Evergreen/Manifests/MicrosoftOneDrive.json b/Evergreen/Manifests/MicrosoftOneDrive.json index af3375a6..c7b9122a 100644 --- a/Evergreen/Manifests/MicrosoftOneDrive.json +++ b/Evergreen/Manifests/MicrosoftOneDrive.json @@ -1,29 +1,29 @@ { - "Name": "Microsoft OneDrive", - "Source": "https://onedrive.live.com/", - "Get": { - "Uri": { - "Production": "https://g.live.com/1rewlive5skydrive/OneDriveProductionV2", - "Enterprise": "https://g.live.com/1rewlive5skydrive/OneDriveEnterpriseV2", - "Insider": "https://g.live.com/1rewlive5skydrive/OneDriveInsiderV2", - "InternalSlow": "https://g.live.com/1rewlive5skydrive/MsitSlowV2", - "InternalFast": "https://g.live.com/1rewlive5skydrive/MsitFastV2" + "Name": "Microsoft OneDrive", + "Source": "https://onedrive.live.com/", + "Get": { + "Update": { + "Uri": { + "Production": "https://g.live.com/1rewlive5skydrive/OneDriveProductionV2", + "Enterprise": "https://g.live.com/1rewlive5skydrive/OneDriveEnterpriseV2", + "Insider": "https://g.live.com/1rewlive5skydrive/OneDriveInsiderV2", + "InternalSlow": "https://g.live.com/1rewlive5skydrive/MsitSlowV2", + "InternalFast": "https://g.live.com/1rewlive5skydrive/MsitFastV2" + }, + "ContentType": "application/xml; charset=utf-8", + "XmlNode": "//update" + } + }, + "Install": { + "Setup": "OneDriveSetup*.exe", + "Preinstall": "", + "Physical": { + "Arguments": "/silent", + "PostInstall": [] }, - "ContentType": "application/xml; charset=utf-8", - "XmlNode": "//update" - }, - "Install": { - "Setup": "OneDriveSetup*.exe", - "Preinstall": "", - "Physical": { - "Arguments": "/silent", - "PostInstall": [ - ] - }, - "Virtual": { - "Arguments": "/silent /ALLUSERS=1 /ALLUSER=1", - "PostInstall": [ - ] - } - } + "Virtual": { + "Arguments": "/silent /ALLUSERS=1 /ALLUSER=1", + "PostInstall": [] + } + } } diff --git a/docs/changelog.md b/docs/changelog.md index e565d9e6..436ab0d9 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -4,6 +4,7 @@ * Adds `UnitySetup` [#245](https://github.com/aaronparker/evergreen/issues/245) * Updates `GoogleChrome` to address retirement of update source [#546](https://github.com/aaronparker/evergreen/issues/546) +* Updates `MicrosoftOneDrive` to add the `Throttle` property to assist filtering the current rollout version * Removes `MicrosoftOpenJDK16`, `MicrosoftOpenJDK8` as binaries are not available ## 2309.840 diff --git a/tests/Public/Invoke-EvergreenApp.Tests.ps1 b/tests/Public/Invoke-EvergreenApp.Tests.ps1 index 44f20c4b..4dde3a52 100644 --- a/tests/Public/Invoke-EvergreenApp.Tests.ps1 +++ b/tests/Public/Invoke-EvergreenApp.Tests.ps1 @@ -9,7 +9,7 @@ param () BeforeDiscovery { $Uri = "https://evergreen-api.stealthpuppy.com/apps" - $AppsToSkip = "JetBrainsYouTrack" + $AppsToSkip = "JetBrainsYouTrack|MicrosoftOpenJDK8|MicrosoftOpenJDK16" $Applications = (Invoke-RestMethod -Uri $Uri -UseBasicParsing) | Select-Object -ExpandProperty "Name" | Where-Object { $_ -notmatch $AppsToSkip } }