Skip to content

Commit 222a006

Browse files
committed
Replace PackageES with ESRP template
This isn't done, but I need to start a pipeline run to see where it's at.
1 parent a89ddb0 commit 222a006

File tree

6 files changed

+85
-111
lines changed

6 files changed

+85
-111
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,21 @@ trigger:
3232
- /LICENSE
3333
- /CODE_OF_CONDUCT.md
3434

35+
resources:
36+
repositories:
37+
- repository: ComplianceRepo
38+
type: github
39+
endpoint: ComplianceGHRepo
40+
name: PowerShell/Compliance
41+
3542
jobs:
3643

3744
- job: 'ReleaseBuild'
3845
displayName: 'Build release'
3946
pool:
40-
name: 'Package ES CodeHub Lab E'
47+
name: 'Package ES Standard Build'
4148
demands: DotNetFramework
49+
variables:
50+
- group: ESRP
4251
steps:
4352
- template: templates/release-general.yml
Lines changed: 47 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
11
steps:
2-
- powershell: |
3-
Write-Host "Installing pwsh..."
4-
if (Get-Command pwsh -ErrorAction Ignore)
5-
{
6-
Write-Host "pwsh already installed, skipping"
7-
return
8-
}
9-
$powerShellPath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'powershell'
10-
Invoke-WebRequest -Uri https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.ps1 -outfile ./install-powershell.ps1
11-
./install-powershell.ps1 -Destination $powerShellPath
12-
$vstsCommandString = "vso[task.setvariable variable=PATH]$powerShellPath;$env:PATH"
13-
Write-Host "sending " + $vstsCommandString
14-
Write-Host "##$vstsCommandString"
15-
displayName: Install PowerShell Core
2+
- checkout: self
163

174
- pwsh: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhmmss"))"
185
displayName: Set Build Name for Non-PR
@@ -23,25 +10,20 @@ steps:
2310
displayName: Capture environment
2411
condition: succeededOrFailed()
2512

26-
- task: PkgESSetupBuild@10
27-
displayName: 'Package ES - Setup Build'
28-
inputs:
29-
productName: vscode-powershell
30-
useDFS: false
31-
13+
# TODO: Use modern resources for these variables.
3214
- task: PowerShell@2
3315
displayName: 'Set environment variables for VSTS (Phase 1)'
3416
inputs:
3517
targetType: filePath
36-
filePath: ./tools/releaseBuild/setVstsVariables.ps1
18+
filePath: ./vscode-powershell/tools/releaseBuild/setVstsVariables.ps1
3719

3820
- task: PowerShell@2
3921
displayName: 'Find PowerShellEditorServices build'
4022
env:
4123
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
4224
inputs:
4325
targetType: filePath
44-
filePath: ./tools/releaseBuild/findPsesBuild.ps1
26+
filePath: ./vscode-powershell/tools/releaseBuild/findPsesBuild.ps1
4527

4628
- task: DownloadBuildArtifacts@0
4729
displayName: 'Download Build Artifacts from PowerShell Editor Services'
@@ -56,89 +38,55 @@ steps:
5638
downloadPath: '$(Build.SourcesDirectory)'
5739

5840
- pwsh: |
41+
New-Item -ItemType Directory $(Build.ArtifactStagingDirectory)/vscode-powershell
5942
Install-Module InvokeBuild -Force
6043
Invoke-Build Release
44+
workingDirectory: '$(Build.SourcesDirectory)/vscode-powershell'
6145

6246
- task: PublishTestResults@2
6347
inputs:
6448
testRunner: JUnit
6549
testResultsFiles: '**/test-results.xml'
6650
condition: succeededOrFailed()
6751

68-
- task: PkgESCodeSign@10
69-
displayName: 'CodeSign tools/releaseBuild/signing.xml'
70-
env:
71-
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
72-
inputs:
73-
signConfigXml: tools/releaseBuild/signing.xml
74-
inPathRoot: '$(Build.ArtifactStagingDirectory)'
75-
outPathRoot: '$(Build.ArtifactStagingDirectory)\Signed'
76-
77-
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
78-
displayName: 'Component Detection'
79-
80-
- task: AntiMalware@3
81-
inputs:
82-
InputType: 'Basic'
83-
ScanType: 'CustomScan'
84-
FileDirPath: '$(Build.ArtifactStagingDirectory)'
85-
EnableServices: false
86-
SupportLogOnError: false
87-
TreatSignatureUpdateFailureAs: 'Warning'
88-
SignatureFreshness: 'UpToDate'
89-
TreatStaleSignatureAs: 'Error'
90-
91-
- task: PoliCheck@1
92-
condition: succeededOrFailed()
93-
inputs:
94-
targetType: F
95-
optionsFC: 0
96-
optionsXS: 0
97-
optionsPE: '1|2|3|4'
98-
optionsHMENABLE: 0
99-
optionsFTPATH: '$(Build.SourcesDirectory)\tools\terms\FileTypeSet.xml'
100-
# toolVersion: 5.8.2.1
101-
102-
- pwsh: |
103-
Get-ChildItem -Exclude node_modules | Get-ChildItem -Recurse | ForEach-Object FullName > "$env:BUILD_SOURCESDIRECTORY/credscan.tsv"
104-
displayName: Create credscan.tsv as the list of files to scan
105-
106-
- task: CredScan@2
107-
condition: succeededOrFailed()
108-
inputs:
109-
debugMode: false
110-
scanFolder: '$(Build.SourcesDirectory)/credscan.tsv'
111-
112-
# Publish results as artifacts
113-
- task: PublishSecurityAnalysisLogs@3
114-
condition: succeededOrFailed()
115-
inputs:
116-
ArtifactName: 'CodeAnalysisLogs'
117-
ArtifactType: 'Container'
118-
119-
# Publish to TSA server
120-
- task: TSAUpload@1
121-
condition: succeededOrFailed()
122-
continueOnError: true
123-
inputs:
124-
tsaVersion: 'TsaV2'
125-
codebase: 'Existing'
126-
tsaEnvironment: 'PROD'
127-
codeBaseName: 'PowerShell_PowerShellEditorServices_20190917'
128-
uploadAPIScan: false
129-
uploadBinSkim: false
130-
uploadCredScan: true
131-
uploadFortifySCA: false
132-
uploadFxCop: false
133-
uploadModernCop: false
134-
uploadPoliCheck: true
135-
uploadPREfast: false
136-
uploadRoslyn: false
137-
uploadTSLint: false
138-
uploadAsync: true
139-
140-
- task: PowerShell@1
141-
displayName: 'Upload artifacts'
142-
inputs:
143-
scriptType: inlineScript
144-
inlineScript: 'Write-Host "##vso[artifact.upload containerfolder=vscode-powershell;artifactname=vscode-powershell]$(System.ArtifactsDirectory)\Signed"'
52+
- checkout: ComplianceRepo
53+
54+
- template: EsrpSign.yml@ComplianceRepo
55+
parameters:
56+
buildOutputPath: '$(Build.ArtifactStagingDirectory)/vscode-powershell'
57+
signOutputPath: '$(Build.ArtifactStagingDirectory)/ScriptSigned'
58+
alwaysCopy: true # So publishing works
59+
certificateId: 'CP-230012' # Authenticode certificate
60+
useMinimatch: true # This enables the use of globbing
61+
pattern: |
62+
Install-VSCode.ps1
63+
64+
- template: EsrpSign.yml@ComplianceRepo
65+
parameters:
66+
buildOutputPath: '$(Build.ArtifactStagingDirectory)/ScriptSigned'
67+
signOutputPath: '$(Build.ArtifactStagingDirectory)/ExtensionSigned'
68+
alwaysCopy: true # So publishing works
69+
certificateId: 'CP-233016' # Microsoft OPC Publisher (VSIX) certificate
70+
useMinimatch: true # This enables the use of globbing
71+
pattern: |
72+
PowerShell-insiders.vsix
73+
74+
- publish: $(Build.ArtifactsDirectory)/ExtensionSigned
75+
artifact: vscode-powershell
76+
displayName: 'Publish signed (and unsigned) artifacts'
77+
78+
- template: script-module-compliance.yml@ComplianceRepo
79+
parameters:
80+
# component-governance
81+
sourceScanPath: '$(Build.SourcesDirectory)/vscode-powershell'
82+
# credscan
83+
suppressionsFile: '$(Build.SourcesDirectory)/vscode-powershell/tools/credScan/suppress.json'
84+
# TermCheck AKA PoliCheck
85+
targetArgument: '$(Build.SourcesDirectory)/vscode-powershell'
86+
optionsUEPATH: '$(Build.SourcesDirectory)/vscode-powershell/tools/terms/UserExclusions.xml'
87+
optionsRulesDBPath: ''
88+
optionsFTPath: '$(Build.SourcesDirectory)/vscode-powershell/tools/terms/FileTypeSet.xml'
89+
# tsa-upload
90+
codeBaseName: 'PowerShell_PowerShellEditorServices_20210201'
91+
# We don't use any Windows APIs directly, so we don't need API scan
92+
APIScan: false

tools/credScan/suppress.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"tool": "Credential Scanner",
3+
"suppressions": [
4+
{
5+
"folder": "node_modules",
6+
"_justification": "Third-party code must not be scanned"
7+
}
8+
{
9+
"folder": "PSScriptAnalyzer",
10+
"_justification": "Bundled upstream project with false-positives"
11+
}
12+
]
13+
}

tools/releaseBuild/signing.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.

tools/terms/UserExclusions.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<PoliCheckExclusions>
2+
<!-- All strings must be UPPER CASE -->
3+
<!--Each of these exclusions is a folder name -if \[name]\exists in the file path, it will be skipped -->
4+
<!--<Exclusion Type="FolderPathFull">ABC|XYZ</Exclusion>-->
5+
<Exclusion Type="FolderPathFull">.GIT</Exclusion>
6+
<Exclusion Type="FolderPathFull">NODE_MODULES</Exclusion>
7+
<!--Each of these exclusions is a folder name -if any folder or file starts with "\[name]", it will be skipped -->
8+
<!--<Exclusion Type="FolderPathStart">ABC|XYZ</Exclusion>-->
9+
<!--Each of these file types will be completely skipped for the entire scan -->
10+
<!--<Exclusion Type="FileType">.ABC|.XYZ</Exclusion>-->
11+
<!--The specified file names will be skipped during the scan regardless which folder they are in -->
12+
<!--<Exclusion Type="FileName">ABC.TXT|XYZ.CS</Exclusion>-->
13+
</PoliCheckExclusions>

vscode-powershell.build.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ task Package UpdateReadme, {
191191
Move-Item -Force .\$($script:PackageJson.name)-$($script:PackageJson.version).vsix .\PowerShell-insiders.vsix
192192

193193
if ($env:TF_BUILD) {
194-
Copy-Item -Verbose -Recurse "./PowerShell-insiders.vsix" "$env:BUILD_ARTIFACTSTAGINGDIRECTORY/PowerShell-insiders.vsix"
195-
Copy-Item -Verbose -Recurse "./scripts/Install-VSCode.ps1" "$env:BUILD_ARTIFACTSTAGINGDIRECTORY/Install-VSCode.ps1"
194+
Copy-Item -Verbose -Recurse "./PowerShell-insiders.vsix" "$env:BUILD_ARTIFACTSTAGINGDIRECTORY/vscode-powershell/PowerShell-insiders.vsix"
195+
Copy-Item -Verbose -Recurse "./scripts/Install-VSCode.ps1" "$env:BUILD_ARTIFACTSTAGINGDIRECTORY/vscode-powershell/Install-VSCode.ps1"
196196
}
197197
}
198198

0 commit comments

Comments
 (0)