From 57180c62c314328c528a3b4c1638691f8d9681d1 Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Wed, 26 Feb 2025 11:02:15 -0800 Subject: [PATCH] OneBranch now uses PowerShell 7.4 so remove workarounds We can rely on the pre-installed PSResourceGet and we can re-enable tests! --- .pipelines/PowerShellEditorServices-Official.yml | 7 ++----- tools/installPSResources.ps1 | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.pipelines/PowerShellEditorServices-Official.yml b/.pipelines/PowerShellEditorServices-Official.yml index c07eab61a..02711b556 100644 --- a/.pipelines/PowerShellEditorServices-Official.yml +++ b/.pipelines/PowerShellEditorServices-Official.yml @@ -88,12 +88,9 @@ extends: inputs: packageType: runtime version: 6.x - - pwsh: | - Register-PSRepository -Name CFS -SourceLocation "https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v2" -InstallationPolicy Trusted - Install-Module -Repository CFS -Name Microsoft.PowerShell.PSResourceGet - ./tools/installPSResources.ps1 -PSRepository CFS + - pwsh: ./tools/installPSResources.ps1 -PSRepository CFS displayName: Install PSResources - - pwsh: Invoke-Build Build -Configuration $(BuildConfiguration) -PSRepository CFS + - pwsh: Invoke-Build TestFull -Configuration $(BuildConfiguration) -PSRepository CFS displayName: Build and test - task: PublishTestResults@2 displayName: Publish test results diff --git a/tools/installPSResources.ps1 b/tools/installPSResources.ps1 index e98910d70..97fed8bc3 100644 --- a/tools/installPSResources.ps1 +++ b/tools/installPSResources.ps1 @@ -9,5 +9,16 @@ if ($PSRepository -eq "CFS" -and -not (Get-PSResourceRepository -Name CFS -Error Register-PSResourceRepository -Name CFS -Uri "https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v3/index.json" } -Install-PSResource -Repository $PSRepository -TrustRepository -Name InvokeBuild -Install-PSResource -Repository $PSRepository -TrustRepository -Name platyPS +# NOTE: Due to a bug in Install-PSResource with upstream feeds, we have to +# request an exact version. Otherwise, if a newer version is available in the +# upstream feed, it will fail to install any version at all. +Install-PSResource -Verbose -TrustRepository -RequiredResource @{ + InvokeBuild = @{ + version = "5.12.1" + repository = $PSRepository + } + platyPS = @{ + version = "0.14.2" + repository = $PSRepository + } +}