Skip to content

Commit d7d3221

Browse files
committed
Update installPSResources.ps1 for CFS
1 parent efd6fd5 commit d7d3221

File tree

3 files changed

+21
-17
lines changed

3 files changed

+21
-17
lines changed

.pipelines/vscode-powershell-Official.yml

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

tools/installPSResources.ps1

Lines changed: 8 additions & 6 deletions
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

Lines changed: 3 additions & 3 deletions
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)