12
12
# - master
13
13
- development
14
14
15
- variables :
16
- - group : ESRP
15
+ resources :
16
+ repositories :
17
+ - repository : ComplianceRepo
18
+ type : github
19
+ endpoint : ComplianceGHRepo
20
+ name : PowerShell/compliance
17
21
18
22
stages :
19
23
- stage : Build
@@ -22,7 +26,7 @@ stages:
22
26
- job : BuildPkg
23
27
displayName : Build Package
24
28
pool :
25
- vmImage : windows-2019
29
+ vmImage : windows-latest
26
30
27
31
steps :
28
32
- powershell : |
@@ -96,196 +100,14 @@ stages:
96
100
$modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
97
101
Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
98
102
Import-Module -Name $modPath -Force
99
-
100
- $config = Get-PSPackageProjectConfiguration
101
-
102
- # Created files signing directory
103
- $srcPath = "$($config.BuildOutputPath)\$($config.ModuleName)"
104
- $createdSignSrcPath = "$($config.BuildOutputPath)\CreatedFiles"
105
- if (! (Test-Path -Path $createdSignSrcPath)) {
106
- $null = New-Item -Path $createdSignSrcPath -ItemType Directory -Verbose
107
- }
108
- Copy-Item -Path (Join-Path -Path $srcPath -ChildPath "PowerShellGet.psd1") -Dest $createdSignSrcPath -Force -Verbose
109
- Copy-Item -Path (Join-Path -Path $srcPath -ChildPath "PSModule.psm1") -Dest $createdSignSrcPath -Force -Verbose
110
- Copy-Item -Path (Join-Path -Path $srcPath -ChildPath "DscResources") -Dest $createdSignSrcPath -Recurse -Force -Verbose
111
- Copy-Item -Path (Join-Path -Path $srcPath -ChildPath "Modules") -Dest $createdSignSrcPath -Recurse -Force -Verbose
112
-
113
- $net472Path = Join-Path -Path $createdSignSrcPath -ChildPath "net472"
114
- if (! (Test-Path -Path $net472Path)) {
115
- $null = New-Item -Path $net472Path -ItemType Directory -Verbose
116
- }
117
- Copy-Item -Path (Join-Path -Path $srcPath -ChildPath "net472\PowerShellGet.*") -Dest $net472Path -Force -Verbose
118
-
119
- $netStandardPath = Join-Path -Path $createdSignSrcPath -ChildPath "netstandard2.0"
120
- if (! (Test-Path -Path $netStandardPath)) {
121
- $null = New-Item -Path $netStandardPath -ItemType Directory -Verbose
122
- }
123
- Copy-Item -Path (Join-Path -Path $srcPath -ChildPath "netstandard2.0\PowerShellGet.*") -Dest $netStandardPath -Force -Verbose
124
-
125
- $signOutPath = "$($config.SignedOutputPath)\$($config.ModuleName)"
126
- if (! (Test-Path -Path $signOutPath)) {
127
- $null = New-Item -Path $signOutPath -ItemType Directory
128
- }
129
-
130
- # Set signing src path variable
131
- $vstsCommandString = "vso[task.setvariable variable=signSrcPath]${createdSignSrcPath}"
132
- Write-Host "sending " + $vstsCommandString
133
- Write-Host "##$vstsCommandString"
134
-
135
- $outSignPath = "$($config.SignedOutputPath)\$($config.ModuleName)"
136
- if (! (Test-Path -Path $outSignPath)) {
137
- $null = New-Item -Path $outSignPath -ItemType Directory -Verbose
138
- }
139
-
140
- # Set signing out path variable
141
- $vstsCommandString = "vso[task.setvariable variable=signOutPath]${outSignPath}"
142
- Write-Host "sending " + $vstsCommandString
143
- Write-Host "##$vstsCommandString"
144
- displayName: Set up for module created files code signing
145
- condition: and(and(succeeded(), eq(variables['Build.Reason'], 'Manual')), ne(variables['SkipSigning'], 'True'))
146
-
147
- - template : ./templates/sign.yml
148
- parameters :
149
- buildOutputPath : $(signSrcPath)
150
- signOutputPath : $(signOutPath)
151
- certificateId : " CP-230012"
152
- pattern : ' *.dll,*.psd1,*.psm1,*.ps1xml,*.mof'
153
-
154
- - pwsh : |
155
- $modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
156
- $env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
157
- $modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
158
- Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
159
- Import-Module -Name $modPath -Force
160
-
161
103
$config = Get-PSPackageProjectConfiguration
162
-
163
- $signOutPath = "$($config.SignedOutputPath)\$($config.ModuleName)"
164
- if (! (Test-Path -Path $signOutPath)) {
165
- $null = New-Item -Path $signOutPath -ItemType Directory
166
- }
167
-
168
- # Third party files signing directory
169
- $srcPath = "$($config.BuildOutputPath)\$($config.ModuleName)"
170
- $thirdPartySignSrcPath = "$($config.BuildOutputPath)\ThirdParty"
171
- if (! (Test-Path -Path $thirdPartySignSrcPath)) {
172
- $null = New-Item -Path $thirdPartySignSrcPath -ItemType Directory -Verbose
173
- }
174
-
175
- # Net472 directory
176
- $net472Path = Join-Path -Path $thirdPartySignSrcPath -ChildPath "net472"
177
- if (! (Test-Path -Path $net472Path)) {
178
- $null = New-Item -Path $net472Path -ItemType Directory -Verbose
179
- }
180
- Get-ChildItem -Path (Join-Path -Path $srcPath -ChildPath "net472") -Filter '*.dll' | Foreach-Object {
181
- if ($_.Name -ne 'PowerShellGet.dll') {
182
- $sig = Get-AuthenticodeSignature -FilePath $_.FullName
183
- if ($sig.Status -ne 'Valid' -or $sig.SignerCertificate.Subject -notlike '*Microsoft*' -or $sig.SignerCertificate.Issuer -notlike '*Microsoft Code Signing PCA*') {
184
- # Copy for third party signing
185
- Copy-Item -Path $_.FullName -Dest $net472Path -Force -Verbose
186
- }
187
- }
188
- }
189
-
190
- # NetStandard directory
191
- $netStandardPath = Join-Path -Path $thirdPartySignSrcPath -ChildPath "netstandard2.0"
192
- if (! (Test-Path -Path $netStandardPath)) {
193
- $null = New-Item -Path $netStandardPath -ItemType Directory -Verbose
194
- }
195
- Get-ChildItem -Path (Join-Path -Path $srcPath -ChildPath "netstandard2.0") -Filter '*.dll' | Foreach-Object {
196
- if ($_.Name -ne 'PowerShellGet.dll') {
197
- $sig = Get-AuthenticodeSignature -FilePath $_.FullName
198
- if ($sig.Status -ne 'Valid' -or $sig.SignerCertificate.Subject -notlike '*Microsoft*' -or $sig.SignerCertificate.Issuer -notlike '*Microsoft Code Signing PCA*') {
199
- # Copy for third party signing
200
- Copy-Item -Path $_.FullName -Dest $netStandardPath -Force -Verbose
201
- }
202
- }
203
- }
204
-
205
- # Set signing src path variable
206
- $vstsCommandString = "vso[task.setvariable variable=signSrcPath]${thirdPartySignSrcPath}"
207
- Write-Host "sending " + $vstsCommandString
208
- Write-Host "##$vstsCommandString"
209
-
210
- # Set signing out path variable
211
- $vstsCommandString = "vso[task.setvariable variable=signOutPath]${signOutPath}"
212
- Write-Host "sending " + $vstsCommandString
213
- Write-Host "##$vstsCommandString"
214
- displayName: Set up for module third party files code signing
215
- condition: and(and(succeeded(), eq(variables['Build.Reason'], 'Manual')), ne(variables['SkipSigning'], 'True'))
216
-
217
- - template : ./templates/sign.yml
218
- parameters :
219
- buildOutputPath : $(signSrcPath)
220
- signOutputPath : $(signOutPath)
221
- certificateId : " CP-231522"
222
- pattern : ' *.dll'
223
-
224
- - pwsh : |
225
- $modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
226
- $env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
227
- $modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
228
- Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
229
- Import-Module -Name $modPath -Force
230
-
231
- $config = Get-PSPackageProjectConfiguration
232
-
233
- $srcPath = "$($config.BuildOutputPath)\$($config.ModuleName)"
234
- $signOutPath = "$($config.SignedOutputPath)\$($config.ModuleName)"
235
- if (! (Test-Path -Path $signOutPath)) {
236
- $null = New-Item -Path $signOutPath -ItemType Directory
237
- }
238
-
239
- # en-US
240
- Copy-Item -Path (Join-Path -Path $srcPath -ChildPath "en-US") -Dest $signOutPath -Recurse
241
-
242
- # Net472 directory
243
- $net472SignedOutPath = Join-Path -Path $signOutPath -ChildPath "net472"
244
- if (! (Test-Path -Path $net472SignedOutPath)) {
245
- $null = New-Item -Path $net472SignedOutPath -ItemType Directory -Verbose
246
- }
247
- Get-ChildItem -Path (Join-Path -Path $srcPath -ChildPath "net472") -Filter '*.dll' | Foreach-Object {
248
- if ($_.Name -ne 'PowerShellGet.dll') {
249
- $sig = Get-AuthenticodeSignature -FilePath $_.FullName
250
- if ($sig.Status -eq 'Valid' -and ($sig.SignerCertificate.Subject -like '*Microsoft*' -and $sig.SignerCertificate.Issuer -like '*Microsoft Code Signing PCA*')) {
251
- # Copy already signed files directly to output
252
- Copy-Item -Path $_.FullName -Dest $net472SignedOutPath -Force -Verbose
253
- }
254
- }
255
- }
256
-
257
- # NetStandard directory
258
- $netStandardSignedOutPath = Join-Path -Path $signOutPath -ChildPath "netstandard2.0"
259
- if (! (Test-Path -Path $netStandardSignedOutPath)) {
260
- $null = New-Item -Path $netStandardSignedOutPath -ItemType Directory -Verbose
261
- }
262
- Get-ChildItem -Path (Join-Path -Path $srcPath -ChildPath "netstandard2.0") -Filter '*.dll' | Foreach-Object {
263
- if ($_.Name -ne 'PowerShellGet.dll') {
264
- $sig = Get-AuthenticodeSignature -FilePath $_.FullName
265
- if ($sig.Status -eq 'Valid' -and ($sig.SignerCertificate.Subject -like '*Microsoft*' -and $sig.SignerCertificate.Issuer -like '*Microsoft Code Signing PCA*')) {
266
- # Copy already signed files directly to output
267
- Copy-Item -Path $_.FullName -Dest $netStandardSignedOutPath -Force -Verbose
268
- }
269
- }
270
- }
271
- displayName: Copy already properly signed third party files
272
- condition: and(and(succeeded(), eq(variables['Build.Reason'], 'Manual')), ne(variables['SkipSigning'], 'True'))
273
-
274
- - pwsh : |
275
- $modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
276
- $env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
277
- $modPath = Join-Path -Path $modulePath -ChildPath PSPackageProject
278
- Write-Verbose -Verbose "Importing PSPackageProject from: $modPath"
279
- Import-Module -Name $modPath -Force
280
104
#
281
- if ($env:SkipSigning -eq 'True')
282
- {
283
- $(Build.SourcesDirectory)/build.ps1 -Publish
284
- }
285
- else
286
- {
287
- $(Build.SourcesDirectory)/build.ps1 -Publish -Signed
288
- }
105
+ $srcModulePath = Resolve-Path -Path "$($config.BuildOutputPath)/$($config.ModuleName)"
106
+ Get-ChildItem $srcModulePath
107
+ $artifactName = "$($config.ModuleName)"
108
+ Write-Host "##vso[artifact.upload containerfolder=$artifactName;artifactname=$artifactName;]$srcModulePath"
109
+ #
110
+ $(Build.SourcesDirectory)/build.ps1 -Publish
289
111
displayName: Create module artifact
290
112
291
113
- stage : Compliance
@@ -294,9 +116,18 @@ stages:
294
116
jobs :
295
117
- job : ComplianceJob
296
118
pool :
297
- vmImage : windows-2019
119
+ vmImage : windows-latest
298
120
steps :
299
- - template : compliance.yml
121
+ - checkout : self
122
+ clean : true
123
+ - checkout : ComplianceRepo
124
+ clean : true
125
+ - download : current
126
+ artifact : ' PowerShellGet'
127
+ - template : ci-compliance.yml@ComplianceRepo
128
+ parameters :
129
+ # credscan
130
+ suppressionsFile : ' '
300
131
301
132
- stage : Test
302
133
displayName : Test Package
@@ -306,13 +137,13 @@ stages:
306
137
parameters :
307
138
jobName : TestPkgWin
308
139
displayName : PowerShell Core on Windows
309
- imageName : windows-2019
140
+ imageName : windows-latest
310
141
311
142
- template : test.yml
312
143
parameters :
313
144
jobName : TestPkgWinPS
314
145
displayName : Windows PowerShell on Windows
315
- imageName : windows-2019
146
+ imageName : windows-latest
316
147
powershellExecutable : powershell
317
148
318
149
# - template: test.yml
@@ -326,9 +157,3 @@ stages:
326
157
# jobName: TestPkgWinMacOS
327
158
# displayName: PowerShell Core on macOS
328
159
# imageName: macOS-10.14
329
-
330
- - stage : Release
331
- displayName : Release Package
332
- condition : and(and(succeeded(), eq(variables['Build.Reason'], 'Manual')), eq(variables['Publish'], 'True'))
333
- jobs :
334
- - template : release.yml
0 commit comments