Skip to content

Commit 5fd45ea

Browse files
TravisEz13rjmholt
andauthored
Migrate 3rd party signing to ESRP (#14010)
Co-authored-by: Robert Holt <[email protected]>
1 parent 52e2b58 commit 5fd45ea

File tree

1 file changed

+33
-29
lines changed

1 file changed

+33
-29
lines changed

tools/releaseBuild/azureDevOps/templates/windows-packaging.yml

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
condition: succeeded()
1515
dependsOn: ${{ parameters.parentJob }}
1616
pool:
17-
name: Package ES Standard Build
17+
vmImage: windows-latest
1818
variables:
1919
- name: BuildConfiguration
2020
value: ${{ parameters.BuildConfiguration }}
@@ -39,19 +39,6 @@ jobs:
3939
parameters:
4040
ReleaseTagVar: $(ReleaseTagVar)
4141

42-
- task: PkgESSetupBuild@10
43-
displayName: 'Initialize build'
44-
env:
45-
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
46-
inputs:
47-
useDfs: false
48-
productName: PowerShellCore
49-
branchVersion: true
50-
disableWorkspace: true
51-
disableBuildTools: true
52-
disableNugetPack: true
53-
condition: and(succeeded(), eq(variables['SHOULD_SIGN'], 'true'))
54-
5542
- powershell: |
5643
$pkgFilter = if ( '$(Architecture)' -eq 'arm' ) {
5744
"arm32"
@@ -113,8 +100,8 @@ jobs:
113100
$null = New-Item -ItemType Directory -Path $signedFilesDirectory -Force
114101
115102
$itemsToCopyWithRecurse = @(
116-
"$($fullSymbolsFolder)\*.ps1"
117-
"$($fullSymbolsFolder)\Microsoft.PowerShell*.dll"
103+
"$($fullSymbolsFolder)\*.ps1"
104+
"$($fullSymbolsFolder)\Microsoft.PowerShell*.dll"
118105
)
119106
120107
$itemsToCopy = @{
@@ -125,6 +112,11 @@ jobs:
125112
"$($fullSymbolsFolder)\Modules\Microsoft.PowerShell.Diagnostics\Diagnostics.format.ps1xml" = "Modules\Microsoft.PowerShell.Diagnostics"
126113
"$($fullSymbolsFolder)\Modules\Microsoft.PowerShell.Diagnostics\Event.format.ps1xml" = "Modules\Microsoft.PowerShell.Diagnostics"
127114
"$($fullSymbolsFolder)\Modules\Microsoft.PowerShell.Diagnostics\GetEvent.types.ps1xml" = "Modules\Microsoft.PowerShell.Diagnostics"
115+
"$($fullSymbolsFolder)\Modules\Microsoft.PowerShell.Diagnostics\Microsoft.PowerShell.Diagnostics.psd1" = "Modules\Microsoft.PowerShell.Diagnostics"
116+
"$($fullSymbolsFolder)\Modules\Microsoft.PowerShell.Host\Microsoft.PowerShell.Host.psd1" = "Modules\Microsoft.PowerShell.Host"
117+
"$($fullSymbolsFolder)\Modules\Microsoft.PowerShell.Management\Microsoft.PowerShell.Management.psd1" = "Modules\Microsoft.PowerShell.Management"
118+
"$($fullSymbolsFolder)\Modules\Microsoft.PowerShell.Security\Microsoft.PowerShell.Security.psd1" = "Modules\Microsoft.PowerShell.Security"
119+
"$($fullSymbolsFolder)\Modules\Microsoft.PowerShell.Utility\Microsoft.PowerShell.Utility.psd1" = "Modules\Microsoft.PowerShell.Utility"
128120
"$($fullSymbolsFolder)\Modules\Microsoft.WSMan.Management\Microsoft.WSMan.Management.psd1" = "Modules\Microsoft.WSMan.Management"
129121
"$($fullSymbolsFolder)\Modules\Microsoft.WSMan.Management\WSMan.format.ps1xml" = "Modules\Microsoft.WSMan.Management"
130122
"$($fullSymbolsFolder)\Modules\PSDiagnostics\PSDiagnostics.ps?1" = "Modules\PSDiagnostics"
@@ -159,6 +151,7 @@ jobs:
159151
**\*.psm1
160152
**\*.ps1xml
161153
**\*.ps1
154+
**\*.exe
162155
useMinimatch: true
163156

164157
- pwsh: |
@@ -171,29 +164,40 @@ jobs:
171164
$dlls = Get-ChildItem $BuildPath\*.dll -Recurse
172165
$signatures = $dlls | Get-AuthenticodeSignature
173166
$missingSignatures = $signatures | Where-Object { $_.status -eq 'notsigned'}| select-object -ExpandProperty Path
174-
& "${env:REPOROOT}/tools/releaseBuild/generatePackgeSigning.ps1" -ThirdPartyFiles $missingSignatures -path "$(System.ArtifactsDirectory)\thirtdparty.xml"
175-
displayName: Create ThirdParty Signing Xml
176-
condition: and(succeeded(), eq(variables['SHOULD_SIGN'], 'true'))
177167
178-
- task: PkgESCodeSign@10
179-
displayName: 'CodeSign ThirdParty $(Architecture)'
180-
env:
181-
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
182-
inputs:
183-
signConfigXml: '$(System.ArtifactsDirectory)\thirtdparty.xml'
184-
inPathRoot: '$(System.ArtifactsDirectory)\$(SymbolsFolder)'
185-
outPathRoot: '$(System.ArtifactsDirectory)\signedThirdParty'
168+
Write-Verbose -verbose "to be signed:`r`n $($missingSignatures | Out-String)"
169+
170+
$filesToSignDirectory = "$(System.ArtifactsDirectory)\thirdPartyToBeSigned"
171+
$null = New-Item -ItemType Directory -Path $filesToSignDirectory -Force
172+
173+
$signedFilesDirectory = "$(System.ArtifactsDirectory)\thirdPartySigned"
174+
$null = New-Item -ItemType Directory -Path $signedFilesDirectory -Force
175+
176+
$missingSignatures | ForEach-Object {
177+
Copy-Item -Path $_ -Destination $filesToSignDirectory
178+
}
179+
180+
displayName: Create ThirdParty Signing Folder
186181
condition: and(succeeded(), eq(variables['SHOULD_SIGN'], 'true'))
187182
183+
- template: EsrpSign.yml@ComplianceRepo
184+
parameters:
185+
buildOutputPath: $(System.ArtifactsDirectory)\thirdPartyToBeSigned
186+
signOutputPath: $(System.ArtifactsDirectory)\thirdPartySigned
187+
certificateId: "CP-231522"
188+
pattern: |
189+
**\*.dll
190+
useMinimatch: true
191+
188192
- powershell: |
189-
Get-ChildItem '$(System.ArtifactsDirectory)\signedThirdParty\*'
193+
Get-ChildItem '$(System.ArtifactsDirectory)\thirdPartySigned\*'
190194
displayName: Captrue ThirdParty Signed files
191195
condition: and(succeeded(), eq(variables['SHOULD_SIGN'], 'true'))
192196
193197
- powershell: |
194198
Import-Module $(PowerShellRoot)/build.psm1 -Force
195199
Import-Module $(PowerShellRoot)/tools/packaging -Force
196-
$signedFilesPath = '$(System.ArtifactsDirectory)\signedThirdParty\'
200+
$signedFilesPath = '$(System.ArtifactsDirectory)\thirdPartySigned'
197201
$BuildPath = '$(System.ArtifactsDirectory)\$(SymbolsFolder)'
198202
199203
Update-PSSignedBuildFolder -BuildPath $BuildPath -SignedFilesPath $SignedFilesPath

0 commit comments

Comments
 (0)