Skip to content

Commit 2f1cf42

Browse files
committed
Add a lot of comments to the yaml
1 parent a66cb27 commit 2f1cf42

File tree

1 file changed

+43
-10
lines changed

1 file changed

+43
-10
lines changed

Diff for: .ci/releaseBuild.yml

+43-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
# The name of the build that will be seen in mscodehub
12
name: PSSA-Release-$(Build.BuildId)
3+
# how is the build triggered
4+
# since this is a release build, no trigger as it's a manual release
25
trigger: none
36

47
pr:
@@ -7,18 +10,26 @@ pr:
710
- master
811
- release*
912

13+
# variables to set in the build environment
1014
variables:
1115
DOTNET_CLI_TELEMETRY_OPTOUT: 1
1216
POWERSHELL_TELEMETRY_OPTOUT: 1
1317

18+
# since this build relies on templates, we need access to those
19+
# This needs a service connection in the build to work
20+
# the *name* of the service connection must be the same as the endpoint
1421
resources:
1522
repositories:
1623
- repository: ComplianceRepo
1724
type: github
1825
endpoint: ComplianceGHRepo
1926
name: PowerShell/compliance
27+
# this can be any branch of your choosing
2028
ref: master
2129

30+
# the stages in this build. There are 2
31+
# the assumption for script analyzer is that test is done as part of
32+
# CI so we needn't do it here
2233
stages:
2334
- stage: Build
2435
displayName: Build
@@ -27,16 +38,21 @@ stages:
2738
jobs:
2839
- job: Build_Job
2940
displayName: Build Microsoft.PowerShell.ScriptAnalyzer
41+
# note the variable reference to ESRP.
42+
# this must be created in Project -> Pipelines -> Library -> VariableGroups
43+
# where it describes the link to the SigningServer
3044
variables:
3145
- group: ESRP
3246
steps:
3347
- checkout: self
3448

49+
# the steps for building the module go here
3550
- pwsh: |
3651
Set-Location "$(Build.SourcesDirectory)/OSS_Microsoft_PSSA"
3752
try { ./build.ps1 -Configuration Release -All } catch { throw $_ }
3853
displayName: Execute build
3954
55+
# these are setting vso variables which will be persisted between stages
4056
- pwsh: |
4157
$signSrcPath = "$(Build.SourcesDirectory)/OSS_Microsoft_PSSA/out"
4258
# Set signing src path variable
@@ -73,8 +89,15 @@ stages:
7389
7490
displayName: Setup variables for signing
7591
92+
# checkout the Compliance repository so it can be used to do the actual signing
7693
- checkout: ComplianceRepo
7794

95+
# in script analyzer, we must sign with 2 different certs
96+
# the normal cert for MS created items and the 3rd party cert
97+
# this the MS authored step
98+
# Because this needs 2 certs, we do it in 2 steps.
99+
# the first step signs the binaries and puts them in a staging directory which
100+
# will then be used for the second step.
78101
- template: EsrpSign.yml@ComplianceRepo
79102
parameters:
80103
# the folder which contains the binaries to sign
@@ -92,6 +115,11 @@ stages:
92115
**\*.ps1xml
93116
**\Microsoft*.dll
94117
118+
# this is the second step of the signing.
119+
# note that the buildOutputPath (where we get the files to sign)
120+
# is the same as the signOutputPath in the previous step
121+
# at the end of this step we will have all the files signed that should be
122+
# signOutPath is the location which contains the files we will use to make the module
95123
- template: EsrpSign.yml@ComplianceRepo
96124
parameters:
97125
# the folder which contains the binaries to sign
@@ -104,20 +132,26 @@ stages:
104132
# the file pattern to use - only sign newtonsoft
105133
pattern: 'Newtonsoft*.dll'
106134

135+
# now create the nupkg which we will use to publish the module
136+
# to the powershell gallery (not part of this yaml)
107137
- pwsh: |
108138
Set-Location "$(Build.SourcesDirectory)/OSS_Microsoft_PSSA"
109139
./build -BuildNupkg -signed
110140
displayName: Create nupkg for publishing
111141
142+
# finally publish the parts of the build which will be used in the next stages
143+
# if it's not published, the subsequent stages will not be able to access it.
144+
# This is the build directory (it contains all of the dll/pdb files)
112145
- publish: "$(Build.SourcesDirectory)/OSS_Microsoft_PSSA"
113146
artifact: build
114147
displayName: publish build directory
115148

116-
# export the nupkg only
149+
# export the nupkg only which will be used in the release pipeline
117150
- publish: "$(signOutPath)/PSScriptAnalyzer.$(moduleVersion).nupkg"
118151
artifact: nupkg
119152
displayName: Publish module nupkg
120153

154+
# Now on to the compliance stage
121155
- stage: compliance
122156
displayName: Compliance
123157
dependsOn: Build
@@ -131,24 +165,23 @@ stages:
131165
- download: current
132166
artifact: build
133167

134-
- pwsh: |
135-
Get-ChildItem -Path "$(Pipeline.Workspace)\build" -Recurse
136-
Get-Location
137-
Get-ChildItem -Recurse -File -Name
138-
displayName: Capture downloaded artifacts
139-
168+
# use the templates in the compliance repo
169+
# since script analyzer has modules, we're using the assembly-module-compliance template
170+
# if you don't have assemblies, you should use script-module-compliance template
140171
- template: assembly-module-compliance.yml@ComplianceRepo
141172
parameters:
142-
# component-governance
173+
# component-governance - the path to sources
143174
sourceScanPath: '$(Build.SourcesDirectory)/OSS_Microsoft_PSSA'
144-
# binskim
175+
# binskim - this isn't recursive, so you need the path to the assemblies
145176
AnalyzeTarget: '$(Pipeline.Workspace)\build\bin\PSV7Release\netcoreapp3.1\*.dll'
146-
# credscan
177+
# credscan - scan the repo for credentials
178+
# you can suppress some files with this.
147179
suppressionsFile: '$(Build.SourcesDirectory)/OSS_Microsoft_PSSA/tools/ReleaseBuild/CredScan.Suppressions.json'
148180
# TermCheck
149181
optionsRulesDBPath: ''
150182
optionsFTPath: ''
151183
# tsa-upload
184+
# the compliance scanning must be uploaded, which you need to request
152185
codeBaseName: 'PSSA_202004'
153186
# selections
154187
APIScan: false # set to false when not using Windows APIs.

0 commit comments

Comments
 (0)