Skip to content

Commit 7410837

Browse files
committed
WIP
1 parent c95902d commit 7410837

7 files changed

+199
-138
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ trigger:
1313
include:
1414
- master
1515

16+
resources:
17+
repositories:
18+
- repository: PowerShellEditorServices
19+
type: github
20+
endpoint: GitHub
21+
name: PowerShell/PowerShellEditorServices
22+
ref: master
23+
1624
jobs:
1725
- job: Win2019
1826
displayName: Windows Server 2019

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

Lines changed: 65 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,72 @@ resources:
1414
repositories:
1515
- repository: ComplianceRepo
1616
type: github
17-
endpoint: ComplianceGHRepo
17+
endpoint: GitHub
1818
name: PowerShell/Compliance
19+
20+
- repository: PowerShellEditorServices
21+
type: git
22+
name: PowerShellEditorServices
23+
ref: release
24+
1925
pipelines:
2026
- pipeline: PowerShellEditorServices
2127
source: PowerShellEditorServices
22-
trigger: true
23-
24-
25-
jobs:
26-
- job: 'ReleaseBuild'
27-
displayName: 'Build release'
28-
pool:
29-
name: '1ES'
30-
demands: ImageOverride -equals MMS2019
31-
variables:
32-
- group: ESRP
33-
steps:
34-
- template: templates/release-general.yml
28+
trigger:
29+
stages:
30+
- Build
31+
- Sign
32+
33+
stages:
34+
- stage: Build
35+
displayName: Build the release
36+
jobs:
37+
- job: Build
38+
pool:
39+
vmImage: windows-2019
40+
steps:
41+
- template: templates/ci-general.yml
42+
parameters:
43+
usePipelineArtifact: true
44+
45+
- stage: Sign
46+
displayName: Sign the release
47+
jobs:
48+
- job: Sign
49+
pool:
50+
name: 1ES
51+
demands: ImageOverride -equals MMS2019
52+
variables:
53+
- group: ESRP
54+
steps:
55+
- template: templates/release-general.yml
56+
57+
- stage: PublishGitHub
58+
displayName: Publish the draft release
59+
jobs:
60+
- deployment: Publish
61+
environment: vscode-powershell-github
62+
pool:
63+
vmImage: ubuntu-latest
64+
variables:
65+
- group: Publish
66+
strategy:
67+
runOnce:
68+
deploy:
69+
steps:
70+
- template: templates/publish-github.yml
71+
72+
- stage: PublishMarkets
73+
displayName: Publish to marketplace and gallery
74+
jobs:
75+
- deployment: Publish
76+
environment: vscode-powershell-markets
77+
pool:
78+
vmImage: ubuntu-latest
79+
variables:
80+
- group: Publish
81+
strategy:
82+
runOnce:
83+
deploy:
84+
steps:
85+
- template: templates/publish-markets.yml

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

Lines changed: 50 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,57 @@
1+
parameters:
2+
- name: usePipelineArtifact
3+
type: boolean
4+
default: false
5+
16
steps:
2-
- pwsh: '$PSVersionTable'
7+
- pwsh: '$PSVersionTable'
38
displayName: PowerShell version
49

5-
- pwsh: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhmmss"))"
6-
displayName: Set Build Name for Non-PR
7-
condition: ne(variables['Build.Reason'], 'PullRequest')
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
843

9-
# TODO: Use a submodule or some such so we can actually track a version here.
10-
- pwsh: |
11-
git clone https://github.com/PowerShell/PowerShellEditorServices.git ../PowerShellEditorServices
12-
Install-Module InvokeBuild -Scope CurrentUser -Force
13-
Install-Module PlatyPS -Scope CurrentUser -Force
14-
New-Item -ItemType Directory $(Build.ArtifactStagingDirectory)/vscode-powershell
44+
- publish: $(vsixPath)
45+
artifact: vscode-powershell-vsix
46+
displayName: Publish extension artifact
1547

16-
# Build
17-
- pwsh: Invoke-Build
48+
- publish: $(Build.SourcesDirectory)/vscode-powershell/scripts/Install-VSCode.ps1
49+
artifact: vscode-powershell-unsigned-script
50+
displayName: Publish unsigned script artifact
1851

19-
- task: PublishTestResults@2
52+
- task: PublishTestResults@2
2053
displayName: Publish test results
21-
inputs:
22-
testRunner: JUnit
23-
testResultsFiles: '**/test-results.xml'
24-
condition: succeededOrFailed()
25-
26-
- task: PublishBuildArtifacts@1
27-
inputs:
28-
ArtifactName: vscode-powershell
29-
PathtoPublish: '$(Build.ArtifactStagingDirectory)/vscode-powershell'
30-
31-
# Rich Navigation
32-
- task: RichCodeNavIndexer@0
33-
# Note, for now, this is Windows only.
34-
condition: and(succeededOrFailed(), eq(variables['Agent.OS'], 'Windows_NT'))
35-
continueOnError: true
36-
inputs:
37-
serviceConnection: 'rich-nav'
38-
nugetServiceConnection: 'rich-nav-nuget'
39-
githubServiceConnection: 'PowerShell'
40-
languages: 'typescript,csharp'
41-
serviceEndpoint: 'https://prod.richnav.vsengsaas.visualstudio.com'
54+
inputs:
55+
testRunner: JUnit
56+
testResultsFiles: '**/test-results.xml'
57+
condition: succeededOrFailed()

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

Lines changed: 11 additions & 0 deletions
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
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
steps:
2+
- checkout: self
3+
4+
- download: current
5+
artifact: vscode-powershell
6+
displayName: Download signed artifacts
7+
8+
- pwsh: |
9+
vsce publish --packagePath '$(Pipeline.Workspace)/powershell-*.vsix' --pat '$(VsceToken)'
10+
displayName: Publishing VSIX to VS Code Marketplace
11+
12+
- pwsh: |
13+
Publish-Script -Path '$(Pipeline.Workspace)/Install-VSCode.ps1' -NuGetApiKey '$(GalleryToken)'
14+
displayName: Publishing Install-VSCode.ps1 to PowerShell Gallery
Lines changed: 29 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,51 @@
11
steps:
2-
- checkout: self
3-
4-
- pwsh: |
5-
Get-ChildItem -Path env:
6-
displayName: Capture environment
7-
condition: succeededOrFailed()
8-
9-
- task: DownloadPipelineArtifact@2
10-
displayName: 'Download Artifacts from PowerShellEditorServices'
11-
inputs:
12-
source: specific
13-
project: 'PowerShellEditorServices'
14-
pipeline: 36
15-
preferTriggeringPipeline: true
16-
allowPartiallySucceededBuilds: true
17-
artifact: 'PowerShellEditorServices'
18-
path: '$(Build.SourcesDirectory)/PowerShellEditorServices/module/'
19-
20-
- pwsh: |
21-
New-Item -ItemType Directory $(Build.ArtifactStagingDirectory)/vscode-powershell
22-
Install-Module InvokeBuild -Force
23-
Invoke-Build Release
24-
workingDirectory: '$(Build.SourcesDirectory)/vscode-powershell'
25-
26-
- task: PublishTestResults@2
27-
inputs:
28-
testRunner: JUnit
29-
testResultsFiles: '**/test-results.xml'
30-
condition: succeededOrFailed()
2+
- download: current
3+
displayName: Download pipeline artifacts
314

325
- checkout: ComplianceRepo
336

7+
# NOTE: The signing templates explicitly copy everything along as they run, so
8+
# the last output path has every signed (and intentionally unsigned) file.
349
- template: EsrpSign.yml@ComplianceRepo
3510
parameters:
36-
buildOutputPath: '$(Build.ArtifactStagingDirectory)/vscode-powershell'
37-
signOutputPath: '$(Build.ArtifactStagingDirectory)/Signed'
38-
alwaysCopy: true # So publishing works
39-
certificateId: 'CP-230012' # Authenticode certificate
40-
useMinimatch: true # This enables the use of globbing
11+
buildOutputPath: $(Pipeline.Workspace)/vscode-powershell-unsigned-script
12+
signOutputPath: $(Pipeline.Workspace)/signed
13+
alwaysCopy: true
14+
certificateId: CP-230012 # Authenticode certificate
4115
shouldSign: true # We always want to sign
4216
# NOTE: Code AKA *.vsix files are not signed
43-
pattern: |
44-
Install-VSCode.ps1
17+
pattern: Install-VSCode.ps1
18+
19+
# NOTE: Because the scan template doesn't copy (unlike the sign template), we do
20+
# it ourselves so that we can publish one finished artifact.
21+
- task: CopyFiles@2
22+
inputs:
23+
sourceFolder: $(Pipeline.Workspace)/vscode-powershell-vsix
24+
targetFolder: $(Pipeline.Workspace)/signed
4525

4626
- template: EsrpScan.yml@ComplianceRepo
4727
parameters:
48-
scanPath: $(Build.ArtifactStagingDirectory)/Signed
49-
pattern: |
50-
*.vsix
28+
scanPath: $(Pipeline.Workspace)/signed
29+
pattern: powershell-*.vsix
5130

52-
- publish: $(Build.ArtifactStagingDirectory)/Signed
53-
artifact: vscode-powershell
54-
displayName: 'Publish signed (and unsigned) artifacts'
31+
- checkout: self
5532

5633
- template: script-module-compliance.yml@ComplianceRepo
5734
parameters:
5835
# component-governance
59-
sourceScanPath: '$(Build.SourcesDirectory)/vscode-powershell'
36+
sourceScanPath: $(Build.SourcesDirectory)/vscode-powershell
6037
# credscan
61-
suppressionsFile: '$(Build.SourcesDirectory)/vscode-powershell/tools/credScan/suppress.json'
38+
suppressionsFile: $(Build.SourcesDirectory)/vscode-powershell/tools/credScan/suppress.json
6239
# TermCheck AKA PoliCheck
63-
targetArgument: '$(Build.SourcesDirectory)/vscode-powershell'
64-
optionsUEPATH: '$(Build.SourcesDirectory)/vscode-powershell/tools/terms/UserExclusions.xml'
40+
targetArgument: $(Build.SourcesDirectory)/vscode-powershell
41+
optionsUEPATH: $(Build.SourcesDirectory)/vscode-powershell/tools/terms/UserExclusions.xml
6542
optionsRulesDBPath: ''
66-
optionsFTPath: '$(Build.SourcesDirectory)/vscode-powershell/tools/terms/FileTypeSet.xml'
43+
optionsFTPath: $(Build.SourcesDirectory)/vscode-powershell/tools/terms/FileTypeSet.xml
6744
# tsa-upload
68-
codeBaseName: 'PowerShell_PowerShellEditorServices_20210201'
45+
codeBaseName: PowerShell_PowerShellEditorServices_20210201
6946
# We don't use any Windows APIs directly, so we don't need API scan
7047
APIScan: false
48+
49+
- publish: $(Pipeline.Workspace)/signed
50+
artifact: vscode-powershell
51+
displayName: Publish signed artifacts

0 commit comments

Comments
 (0)