Skip to content

Commit 0bc0986

Browse files
Merge pull request #3461 from PowerShell/andschwa/automated-pipeline
Pipeline-ify entire release process
2 parents 58cac8b + 35704b8 commit 0bc0986

11 files changed

+410
-332
lines changed

.vsts-ci/azure-pipelines-ci.yml

+16-6
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,36 @@ variables:
99
value: 'true'
1010

1111
trigger:
12-
batch: true
1312
branches:
1413
include:
1514
- master
1615

16+
resources:
17+
repositories:
18+
- repository: PowerShellEditorServices
19+
type: github
20+
endpoint: GitHub
21+
name: PowerShell/PowerShellEditorServices
22+
ref: master
23+
1724
jobs:
18-
- job: Windows
25+
- job: Win2019
26+
displayName: Windows Server 2019
1927
pool:
20-
vmImage: 'windows-2019'
28+
vmImage: windows-2019
2129
steps:
2230
- template: templates/ci-general.yml
2331

2432
- job: macOS
33+
displayName: macOS 10.15
2534
pool:
26-
vmImage: 'macOS-10.15'
35+
vmImage: macOS-10.15
2736
steps:
2837
- template: templates/ci-general.yml
2938

30-
- job: Linux
39+
- job: Ubuntu
40+
displayName: Ubuntu 20.04
3141
pool:
32-
vmImage: 'Ubuntu-20.04'
42+
vmImage: Ubuntu-20.04
3343
steps:
3444
- template: templates/ci-general.yml

.vsts-ci/azure-pipelines-release.yml

+65-20
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: Release-$(Build.SourceBranchName)-$(Date:yyyyMMdd)$(Rev:.rr)
2+
13
variables:
24
# Don't download unneeded packages
35
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
@@ -6,34 +8,77 @@ variables:
68
- name: DOTNET_CLI_TELEMETRY_OPTOUT
79
value: 'true'
810

9-
trigger:
10-
branches:
11-
include:
12-
- release/*
11+
trigger: none
1312

1413
resources:
1514
repositories:
1615
- repository: ComplianceRepo
1716
type: github
18-
endpoint: ComplianceGHRepo
17+
endpoint: GitHub
1918
name: PowerShell/Compliance
19+
20+
- repository: PowerShellEditorServices
21+
type: git
22+
name: PowerShellEditorServices
23+
ref: release
24+
2025
pipelines:
2126
- pipeline: PowerShellEditorServices
2227
source: PowerShellEditorServices
2328
trigger:
2429
branches:
25-
include:
26-
- release/*
27-
tags:
28-
- v*
29-
30-
jobs:
31-
- job: 'ReleaseBuild'
32-
displayName: 'Build release'
33-
pool:
34-
name: '1ES'
35-
demands: ImageOverride -equals MMS2019
36-
variables:
37-
- group: ESRP
38-
steps:
39-
- template: templates/release-general.yml
30+
- release
31+
32+
stages:
33+
- stage: Build
34+
displayName: Build the release
35+
jobs:
36+
- job: Build
37+
pool:
38+
vmImage: windows-2019
39+
steps:
40+
- template: templates/ci-general.yml
41+
parameters:
42+
usePipelineArtifact: true
43+
44+
- stage: Sign
45+
displayName: Sign the release
46+
jobs:
47+
- job: Sign
48+
pool:
49+
name: 1ES
50+
demands: ImageOverride -equals MMS2019
51+
variables:
52+
- group: ESRP
53+
steps:
54+
- template: templates/release-general.yml
55+
56+
- stage: PublishGitHub
57+
displayName: Publish the draft release
58+
jobs:
59+
- deployment: Publish
60+
environment: vscode-powershell-github
61+
pool:
62+
vmImage: ubuntu-latest
63+
variables:
64+
- group: Publish
65+
strategy:
66+
runOnce:
67+
deploy:
68+
steps:
69+
- template: templates/publish-github.yml
70+
71+
- stage: PublishMarkets
72+
displayName: Publish to marketplace and gallery
73+
jobs:
74+
- deployment: Publish
75+
environment: vscode-powershell-markets
76+
pool:
77+
vmImage: ubuntu-latest
78+
variables:
79+
- group: Publish
80+
strategy:
81+
runOnce:
82+
deploy:
83+
steps:
84+
- template: templates/publish-markets.yml

.vsts-ci/misc-analysis.yml

+29-10
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,40 @@
11
name: PR-$(System.PullRequest.PullRequestNumber)-$(Date:yyyyMMdd)$(Rev:.rr)
2+
23
trigger:
3-
# Batch merge builds together while a merge build is running
4-
batch: true
54
branches:
65
include:
76
- master
8-
- legacy/1.x
97

108
pr:
11-
branches:
12-
include:
13-
- master
14-
- legacy/1.x
9+
- master
1510

1611
resources:
17-
- repo: self
18-
clean: true
12+
repositories:
13+
- repository: ComplianceRepo
14+
type: github
15+
endpoint: GitHub
16+
name: PowerShell/compliance
1917

2018
jobs:
21-
- template: templates/credscan.yml
19+
- job: Compliance
20+
pool:
21+
vmImage: windows-latest
22+
steps:
23+
- checkout: self
24+
- checkout: ComplianceRepo
25+
- template: ci-compliance.yml@ComplianceRepo
26+
# NOTE: This enables our project to work with Visual Studio's Rich Navigation:
27+
# https://visualstudio.microsoft.com/services/rich-code-navigation/
28+
- job: RichCodeNav
29+
pool:
30+
vmImage: windows-latest
31+
steps:
32+
# TODO: Move to GitHub Action
33+
- task: RichCodeNavIndexer@0
34+
continueOnError: true
35+
inputs:
36+
serviceConnection: rich-nav
37+
nugetServiceConnection: rich-nav-nuget
38+
githubServiceConnection: PowerShell
39+
languages: typescript,csharp
40+
serviceEndpoint: https://prod.richnav.vsengsaas.visualstudio.com

.vsts-ci/templates/ci-general.yml

+56-54
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,57 @@
1+
parameters:
2+
- name: usePipelineArtifact
3+
type: boolean
4+
default: false
5+
16
steps:
2-
# Setup
3-
- powershell: |
4-
Write-Host "Installing PowerShell Daily..."
5-
6-
# Use `AGENT_TEMPDIRECTORY` to make sure the downloaded PowerShell is cleaned up.
7-
$powerShellPath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'powershell'
8-
Invoke-WebRequest -Uri https://aka.ms/install-powershell.ps1 -OutFile ./install-powershell.ps1
9-
10-
./install-powershell.ps1 -Destination $powerShellPath -Daily
11-
12-
# Using `prependpath` to update the PATH just for this build.
13-
Write-Host "##vso[task.prependpath]$powerShellPath"
14-
continueOnError: true
15-
displayName: Install PowerShell Daily
16-
17-
- pwsh: '$PSVersionTable'
18-
displayName: Display PowerShell version information
19-
20-
- pwsh: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhmmss"))"
21-
displayName: Set Build Name for Non-PR
22-
condition: ne(variables['Build.Reason'], 'PullRequest')
23-
24-
# TODO: Use a submodule or some such so we can actually track a version here.
25-
- pwsh: |
26-
git clone https://github.com/PowerShell/PowerShellEditorServices.git ../PowerShellEditorServices
27-
Install-Module InvokeBuild -Scope CurrentUser -Force
28-
Install-Module PlatyPS -Scope CurrentUser -Force
29-
New-Item -ItemType Directory $(Build.ArtifactStagingDirectory)/vscode-powershell
30-
31-
# Build
32-
- pwsh: Invoke-Build
33-
34-
- task: PublishTestResults@2
35-
inputs:
36-
testRunner: JUnit
37-
testResultsFiles: '**/test-results.xml'
38-
condition: succeededOrFailed()
39-
40-
- task: PublishBuildArtifacts@1
41-
inputs:
42-
ArtifactName: vscode-powershell
43-
PathtoPublish: '$(Build.ArtifactStagingDirectory)/vscode-powershell'
44-
45-
# Rich Navigation
46-
- task: RichCodeNavIndexer@0
47-
# Note, for now, this is Windows only.
48-
condition: and(succeededOrFailed(), eq(variables['Agent.OS'], 'Windows_NT'))
49-
continueOnError: true
50-
inputs:
51-
serviceConnection: 'rich-nav'
52-
nugetServiceConnection: 'rich-nav-nuget'
53-
githubServiceConnection: 'PowerShell'
54-
languages: 'typescript,csharp'
55-
serviceEndpoint: 'https://prod.richnav.vsengsaas.visualstudio.com'
7+
- pwsh: $PSVersionTable
8+
displayName: PowerShell version
9+
10+
- checkout: self
11+
12+
# NOTE: We either checkout the Git repo for PowerShellEditorServices, or we
13+
# download a pre-built artifact from the triggering pipeline and extract it to
14+
# the modules folder. In this way we do not accidentally build a release of the
15+
# server from this pipeline.
16+
- checkout: PowerShellEditorServices
17+
condition: not(${{ parameters.usePipelineArtifact }})
18+
19+
- task: DownloadPipelineArtifact@2
20+
condition: ${{ parameters.usePipelineArtifact }}
21+
displayName: Download PowerShellEditorServices
22+
inputs:
23+
source: specific
24+
project: PowerShellEditorServices
25+
pipeline: 36
26+
preferTriggeringPipeline: true
27+
allowPartiallySucceededBuilds: true
28+
artifact: PowerShellEditorServices
29+
30+
- task: ExtractFiles@1
31+
condition: ${{ parameters.usePipelineArtifact }}
32+
displayName: Extract PowerShellEditorServices module
33+
inputs:
34+
archiveFilePatterns: $(Pipeline.Workspace)/PowerShellEditorServices.zip
35+
destinationFolder: $(Build.SourcesDirectory)/vscode-powershell/modules
36+
37+
- pwsh: |
38+
Install-Module InvokeBuild -Scope CurrentUser -Force
39+
Invoke-Build
40+
Write-Host "##vso[task.setvariable variable=vsixPath]$(Resolve-Path powershell-*.vsix)"
41+
displayName: Build and test
42+
workingDirectory: $(Build.SourcesDirectory)/vscode-powershell
43+
44+
- publish: $(vsixPath)
45+
artifact: vscode-powershell-vsix-$(System.JobId)
46+
displayName: Publish extension artifact
47+
48+
- publish: $(Build.SourcesDirectory)/vscode-powershell/scripts/Install-VSCode.ps1
49+
artifact: vscode-powershell-unsigned-script-$(System.JobId)
50+
displayName: Publish unsigned script artifact
51+
52+
- task: PublishTestResults@2
53+
displayName: Publish test results
54+
inputs:
55+
testRunner: JUnit
56+
testResultsFiles: '**/test-results.xml'
57+
condition: succeededOrFailed()

.vsts-ci/templates/publish-github.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
steps:
2+
- checkout: self
3+
4+
- download: current
5+
artifact: vscode-powershell
6+
displayName: Download signed artifacts
7+
8+
- pwsh: |
9+
$(Build.SourcesDirectory)/tools/setupReleaseTools.ps1 -Token $(GitHubToken)
10+
New-DraftRelease -RepositoryName vscode-powershell -Assets $(Pipeline.Workspace)/vscode-powershell/powershell-*.vsix,$(Pipeline.Workspace)/vscode-powershell/Install-VSCode.ps1
11+
displayName: Drafting a GitHub Release
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
steps:
2+
- checkout: self
3+
4+
- download: current
5+
artifact: vscode-powershell
6+
displayName: Download signed artifacts
7+
8+
- pwsh: |
9+
npm install -g vsce
10+
vsce publish --packagePath $(Pipeline.Workspace)/powershell-*.vsix --pat $(VsceToken)
11+
displayName: Publishing VSIX to VS Code Marketplace
12+
13+
# NOTE: We rarely update this script, so we can ignore errors from the gallery
14+
# caused by us trying to re-publish an updated script.
15+
- pwsh: |
16+
Publish-Script -Path $(Pipeline.Workspace)/Install-VSCode.ps1 -ErrorAction Continue -NuGetApiKey $(GalleryToken)
17+
displayName: Publishing Install-VSCode.ps1 to PowerShell Gallery

0 commit comments

Comments
 (0)