Skip to content

Commit 94debb4

Browse files
committed
Update installPSResources.ps1 for CFS
1 parent 56809a1 commit 94debb4

File tree

3 files changed

+21
-17
lines changed

3 files changed

+21
-17
lines changed

.pipelines/vscode-powershell-Official.yml

+10-8
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ extends:
5454
enabled: true
5555
forStages: [build]
5656
featureFlags:
57+
EnableCDPxPAT: false
5758
WindowsHostVersion:
5859
Version: 2022
5960
Network: Netlock
@@ -94,9 +95,10 @@ extends:
9495
targetPath: $(Build.SourcesDirectory)/modules
9596
- pwsh: |
9697
Register-PSRepository -Name CFS -SourceLocation "https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v2" -InstallationPolicy Trusted
97-
Install-Module -Name InvokeBuild -Repository CFS -RequiredVersion 5.11.3 -Verbose
98-
Invoke-Build Build -Configuration $(BuildConfiguration)
99-
# TODO: When the OneBuild container updates to 7.4, update to PSResourceGet
98+
Install-Module -Repository CFS -Name Microsoft.PowerShell.PSResourceGet
99+
./tools/installPSResources.ps1 -PSRepository CFS
100+
displayName: Install PSResources
101+
- pwsh: Invoke-Build Build -Configuration $(BuildConfiguration)
100102
displayName: Build
101103
- task: onebranch.pipeline.signing@1
102104
displayName: Sign 1st-party example PowerShell files
@@ -127,11 +129,6 @@ extends:
127129
inputs:
128130
packageType: sdk
129131
version: 8.x
130-
- task: PowerShell@2
131-
displayName: Install PSResources
132-
inputs:
133-
pwsh: true
134-
filePath: tools/installPSResources.ps1
135132
- task: DownloadPipelineArtifact@2
136133
displayName: Download PowerShellEditorServices
137134
inputs:
@@ -142,6 +139,11 @@ extends:
142139
branchName: refs/heads/main
143140
artifact: drop_build_main
144141
targetPath: $(Build.SourcesDirectory)/modules
142+
- pwsh: |
143+
Register-PSRepository -Name CFS -SourceLocation "https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v2" -InstallationPolicy Trusted
144+
Install-Module -Repository CFS -Name Microsoft.PowerShell.PSResourceGet
145+
./tools/installPSResources.ps1 -PSRepository CFS
146+
displayName: Install PSResources
145147
- pwsh: Invoke-Build Test -Configuration $(BuildConfiguration)
146148
displayName: Run tests
147149
- stage: release

tools/installPSResources.ps1

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# Copyright (c) Microsoft Corporation.
22
# Licensed under the MIT License.
3+
param(
4+
[ValidateSet("PSGallery", "CFS")]
5+
[string]$PSRepository = "PSGallery"
6+
)
37

4-
if ($PSVersionTable.PSVersion -lt [Version]"7.4") {
5-
throw "The build script requires PowerShell 7.4 or higher!"
8+
if ($PSRepository -eq "CFS" -and -not (Get-PSResourceRepository -Name CFS -ErrorAction SilentlyContinue)) {
9+
Register-PSResourceRepository -Name CFS -Uri "https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v3/index.json"
610
}
711

8-
Register-PSResourceRepository -PSGallery -Trusted -Force
9-
10-
Install-PSResource -Name InvokeBuild -Scope CurrentUser
11-
Install-PSResource -Name platyPS -Scope CurrentUser
12+
Install-PSResource -Repository $PSRepository -TrustRepository -Name InvokeBuild
13+
Install-PSResource -Repository $PSRepository -TrustRepository -Name platyPS

vscode-powershell.build.ps1

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ param(
77
[string]$EditorServicesRepoPath = $null
88
)
99

10-
#Requires -Modules @{ ModuleName = "InvokeBuild"; ModuleVersion = "3.0.0" }
10+
#Requires -Modules @{ ModuleName = "InvokeBuild"; ModuleVersion = "5.0.0" }
1111

1212
function Get-EditorServicesPath {
1313
$psesRepoPath = if ($EditorServicesRepoPath) {
@@ -77,7 +77,7 @@ task Clean {
7777
}
7878

7979
task CleanEditorServices -If (Get-EditorServicesPath) {
80-
Write-Build DarkMagenta "Cleaning PowerShellEditorServices"
80+
Write-Build DarkMagenta "Cleaning PSES"
8181
Invoke-Build Clean (Get-EditorServicesPath)
8282
}
8383

@@ -115,7 +115,7 @@ task Test Lint, Build, {
115115
}
116116

117117
task TestEditorServices -If (Get-EditorServicesPath) {
118-
Write-Build DarkMagenta "Testing PowerShellEditorServices"
118+
Write-Build DarkMagenta "Testing PSES"
119119
Invoke-Build Test (Get-EditorServicesPath)
120120
}
121121

0 commit comments

Comments
 (0)