Skip to content

Commit 4a2bf98

Browse files
authored
Use CFS for installing module and deploy box for module publish (#4700)
1. Add pipeline parameter to control whether to release 2. Handle bootstrapping explicitly 3. Use 'server' instead of 'agentless' for manual job
1 parent e06e5bc commit 4a2bf98

File tree

1 file changed

+36
-18
lines changed

1 file changed

+36
-18
lines changed

.pipelines/PSReadLine-Official.yml

+36-18
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ name: PSReadLine-ModuleBuild-$(Build.BuildId)
1212
trigger: none
1313
pr: none
1414

15+
parameters:
16+
- name: Release
17+
type: boolean
18+
default: true # Set false to skip release stage
19+
1520
variables:
1621
DOTNET_CLI_TELEMETRY_OPTOUT: 1
1722
POWERSHELL_TELEMETRY_OPTOUT: 1
@@ -28,9 +33,12 @@ resources:
2833
extends:
2934
template: v2/OneBranch.Official.CrossPlat.yml@templates
3035
parameters:
36+
release:
37+
category: NonAzure
3138
featureFlags:
3239
WindowsHostVersion:
3340
Version: 2022
41+
Network: Netlock
3442
globalSdl:
3543
disableLegacyManifest: true
3644
cg: # Component Governance parameters. Ignore test components.
@@ -93,11 +101,19 @@ extends:
93101
# Set ob_restore_phase to run this step before '🔒 Setup Signing' step.
94102
ob_restore_phase: true
95103
104+
- task: UseDotNet@2
105+
displayName: Bootstrap - install .NET
106+
env:
107+
# Set ob_restore_phase to run this step before '🔒 Setup Signing' step.
108+
ob_restore_phase: true
109+
inputs:
110+
packageType: sdk
111+
96112
- pwsh: |
97113
Write-Host "PS Version: $($PSVersionTable.PSVersion)"
98-
Set-Location -Path '$(repoRoot)'
99-
.\build.ps1 -Bootstrap
100-
displayName: Bootstrap
114+
Register-PSResourceRepository -Name CFS -Uri "https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/PowerShellGalleryMirror/nuget/v3/index.json" -Trusted
115+
Install-PSResource -Repository CFS -Name InvokeBuild -Version 5.12.1 -Verbose
116+
displayName: Bootstrap - install InvokeBuild
101117
env:
102118
# Set ob_restore_phase to run this step before '🔒 Setup Signing' step.
103119
ob_restore_phase: true
@@ -184,9 +200,8 @@ extends:
184200
value: $(Build.SourcesDirectory)\PSReadLine
185201
- name: ob_sdl_tsa_configFile
186202
value: $(repoRoot)\.config\tsaoptions.json
187-
# Disable because SBOM was already built in the previous job
188203
- name: ob_sdl_sbom_enabled
189-
value: false
204+
value: true
190205
- name: signOutPath
191206
value: $(repoRoot)\signed\PSReadLine
192207
- name: nugetPath
@@ -254,12 +269,14 @@ extends:
254269
- stage: release
255270
dependsOn: buildstage
256271
displayName: Release PSReadLine
272+
variables:
273+
ob_release_environment: Production
257274

258275
jobs:
259276
- job: validation
260277
displayName: Manual validation
261278
pool:
262-
type: agentless
279+
type: server
263280
timeoutInMinutes: 1440
264281

265282
steps:
@@ -272,36 +289,37 @@ extends:
272289
- job: publish
273290
dependsOn: validation
274291
displayName: Publish to PSGallery
292+
pool:
293+
type: release
294+
os: windows
295+
templateContext:
296+
inputs:
297+
- input: pipelineArtifact
298+
artifactName: drop_buildstage_nupkg
275299
variables:
276300
- name: ob_outputDirectory
277301
value: '$(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT'
278-
- name: nugetPath
279-
value: $(Pipeline.Workspace)\NuGetPackage
280302
# Disable SBOM, signing, and codeQL for this job
281303
- name: ob_sdl_sbom_enabled
282304
value: false
283305
- name: ob_signing_setup_enabled
284306
value: false
285307
- name: ob_sdl_codeql_compiled_enabled
286308
value: false
287-
pool:
288-
type: windows
289309

290310
steps:
291-
- task: DownloadPipelineArtifact@2
292-
displayName: 'Download nupkg artifact'
311+
- task: PowerShell@2
293312
inputs:
294-
targetPath: $(nugetPath)
295-
artifact: drop_buildstage_nupkg
296-
297-
- pwsh: |
298-
Get-ChildItem $(nugetPath) -Recurse | Out-String -Width 120 -Stream
313+
targetType: 'inline'
314+
script: |
315+
Get-ChildItem $(Pipeline.Workspace) -Recurse | Out-String -Width 120 -Stream
299316
displayName: Find signed Nupkg
300317

301318
- task: NuGetCommand@2
319+
condition: ${{ parameters.Release }}
302320
displayName: Push PSReadLine module to PSGallery feed
303321
inputs:
304322
command: push
305-
packagesToPush: $(nugetPath)\PSReadLine.*.nupkg
323+
packagesToPush: $(Pipeline.Workspace)\PSReadLine.*.nupkg
306324
nuGetFeedType: external
307325
publishFeedCredentials: PowerShellGalleryFeed

0 commit comments

Comments
 (0)