From 2078bf396871d28c3671ba7aed3d4239d1b58f1f Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andyleejordan@users.noreply.github.com> Date: Thu, 5 Sep 2024 09:29:42 -0700 Subject: [PATCH] Update OneBranch pipeline and dependencies (#253) --- .pipelines/ConsoleGuiTools-Official.yml | 15 ++++++++++----- global.json | 2 +- .../Microsoft.PowerShell.ConsoleGuiTools.csproj | 4 ++-- tools/installPSResources.ps1 | 17 ++++++++--------- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/.pipelines/ConsoleGuiTools-Official.yml b/.pipelines/ConsoleGuiTools-Official.yml index da1d38a..4f9edcf 100644 --- a/.pipelines/ConsoleGuiTools-Official.yml +++ b/.pipelines/ConsoleGuiTools-Official.yml @@ -27,7 +27,7 @@ parameters: variables: system.debug: ${{ parameters.debug }} BuildConfiguration: Release - WindowsContainerImage: onebranch.azurecr.io/windows/ltsc2019/vse2022:latest + WindowsContainerImage: onebranch.azurecr.io/windows/ltsc2022/vse2022:latest DOTNET_NOLOGO: true DOTNET_GENERATE_ASPNET_CERTIFICATE: false @@ -46,6 +46,11 @@ extends: asyncSdl: enabled: true forStages: [build] + featureFlags: + EnableCDPxPAT: false + WindowsHostVersion: + Version: 2022 + Network: Netlock stages: - stage: build jobs: @@ -71,11 +76,11 @@ extends: inputs: packageType: sdk useGlobalJson: true - - task: PowerShell@2 + - 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 displayName: Install PSResources - inputs: - pwsh: true - filePath: tools/installPSResources.ps1 - pwsh: Invoke-Build -Configuration $(BuildConfiguration) displayName: Build - task: onebranch.pipeline.signing@1 diff --git a/global.json b/global.json index ff40deb..b6023e0 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.420", + "version": "6.0.425", "rollForward": "latestFeature", "allowPrerelease": false } diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj index 293b2d0..da77cf2 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj @@ -16,8 +16,8 @@ - - + + diff --git a/tools/installPSResources.ps1 b/tools/installPSResources.ps1 index cfceed1..e98910d 100644 --- a/tools/installPSResources.ps1 +++ b/tools/installPSResources.ps1 @@ -1,14 +1,13 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. +param( + [ValidateSet("PSGallery", "CFS")] + [string]$PSRepository = "PSGallery" +) -$ErrorActionPreference = 'Stop' - -Set-PSRepository -Name PSGallery -InstallationPolicy Trusted | Out-Null -if ($PSVersionTable.PSVersion.Major -lt 6) { - throw "The build script requires PowerShell 7!" +if ($PSRepository -eq "CFS" -and -not (Get-PSResourceRepository -Name CFS -ErrorAction SilentlyContinue)) { + Register-PSResourceRepository -Name CFS -Uri "https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v3/index.json" } -# TODO: Switch to Install-PSResource when CI uses PowerShell 7.4 -Install-Module -Name InvokeBuild -Scope CurrentUser -Install-Module -Name platyPS -Scope CurrentUser -Install-Module -Name Microsoft.PowerShell.PSResourceGet -Scope CurrentUser +Install-PSResource -Repository $PSRepository -TrustRepository -Name InvokeBuild +Install-PSResource -Repository $PSRepository -TrustRepository -Name platyPS