Skip to content

Commit 6eaea92

Browse files
committed
.azure-pipelines: introduce esrp/sign.yml template
Refactor the three EsrpCodeSigning@6 invocations in release.yml (Payload binaries, FastFetch, installer) to use a shared .azure-pipelines/esrp/sign.yml step template, modeled on the same template in microsoft/git. The template: * Forwards the per-call inputs (displayName, folderPath, pattern, inlineOperation) to EsrpCodeSigning@6. * Provides defaults for the ESRP connection parameters that point at the standard pipeline variables ($(esrpAppConnectionName), $(esrpClientId), etc.), so callers don't repeat them. * Runs an inline PowerShell@2 step right after each signing operation that removes the CodeSignSummary-<guid>.md report ESRP CLI drops into the signing folder. Without this, those .md files would otherwise end up packaged into SetupGVFS.exe (Payload), or uploaded as part of the FastFetch and Installer pipeline artifacts. Net effect on release.yml is a small reduction in line count and, more importantly, cleanup is no longer something a future caller can forget to wire up. Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
1 parent c21ed31 commit 6eaea92

2 files changed

Lines changed: 68 additions & 36 deletions

File tree

.azure-pipelines/esrp/sign.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Reusable step template for ESRP code signing via EsrpCodeSigning@6.
2+
#
3+
# Wraps a single signing operation with automatic cleanup of the
4+
# CodeSignSummary-<guid>.md report ESRP CLI drops into the signing
5+
# folder -- otherwise that file is packaged into the installer or
6+
# uploaded as part of the pipeline artifact.
7+
#
8+
parameters:
9+
- name: displayName
10+
type: string
11+
- name: folderPath
12+
type: string
13+
- name: pattern
14+
type: string
15+
- name: inlineOperation
16+
type: string
17+
# ESRP connection parameters (defaults use pipeline variables)
18+
- name: connectedServiceName
19+
type: string
20+
default: $(esrpAppConnectionName)
21+
- name: appRegistrationClientId
22+
type: string
23+
default: $(esrpClientId)
24+
- name: appRegistrationTenantId
25+
type: string
26+
default: $(esrpTenantId)
27+
- name: authAkvName
28+
type: string
29+
default: $(esrpKeyVaultName)
30+
- name: authSignCertName
31+
type: string
32+
default: $(esrpSignReqCertName)
33+
- name: serviceEndpointUrl
34+
type: string
35+
default: $(esrpEndpointUrl)
36+
37+
steps:
38+
- task: EsrpCodeSigning@6
39+
displayName: '${{ parameters.displayName }}'
40+
inputs:
41+
connectedServiceName: '${{ parameters.connectedServiceName }}'
42+
useMSIAuthentication: true
43+
appRegistrationClientId: '${{ parameters.appRegistrationClientId }}'
44+
appRegistrationTenantId: '${{ parameters.appRegistrationTenantId }}'
45+
authAkvName: '${{ parameters.authAkvName }}'
46+
authSignCertName: '${{ parameters.authSignCertName }}'
47+
serviceEndpointUrl: '${{ parameters.serviceEndpointUrl }}'
48+
folderPath: '${{ parameters.folderPath }}'
49+
pattern: '${{ parameters.pattern }}'
50+
useMinimatch: true
51+
signConfigType: inlineSignParams
52+
inlineOperation: ${{ parameters.inlineOperation }}
53+
54+
- task: PowerShell@2
55+
displayName: 'Clean up code signing artifacts (${{ parameters.displayName }})'
56+
inputs:
57+
targetType: inline
58+
script: |
59+
Remove-Item -Force "${{ parameters.folderPath }}\CodeSignSummary-*.md" -ErrorAction SilentlyContinue

.azure-pipelines/release.yml

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,9 @@ extends:
143143
# The installer hasn't been built yet, so it can be packaged from
144144
# signed binaries in a single Inno Setup pass.
145145
- ${{ if eq(parameters.esrp, true) }}:
146-
- task: EsrpCodeSigning@6
147-
displayName: 'Sign VFS for Git binaries'
148-
inputs:
149-
connectedServiceName: $(esrpAppConnectionName)
150-
useMSIAuthentication: true
151-
appRegistrationClientId: $(esrpClientId)
152-
appRegistrationTenantId: $(esrpTenantId)
153-
authAkvName: $(esrpKeyVaultName)
154-
authSignCertName: $(esrpSignReqCertName)
155-
serviceEndpointUrl: $(esrpEndpointUrl)
146+
- template: .azure-pipelines/esrp/sign.yml@self
147+
parameters:
148+
displayName: 'Sign VFS for Git binaries'
156149
folderPath: $(OutDir)\GVFS.Payload\bin\$(BuildConfiguration)\win-x64
157150
pattern: |
158151
GitHooksLoader.exe
@@ -163,8 +156,6 @@ extends:
163156
GVFS.ReadObjectHook.exe
164157
GVFS.Service.exe
165158
GVFS.VirtualFileSystemHook.exe
166-
useMinimatch: true
167-
signConfigType: inlineSignParams
168159
inlineOperation: |
169160
[
170161
{
@@ -189,20 +180,11 @@ extends:
189180
}
190181
]
191182
192-
- task: EsrpCodeSigning@6
193-
displayName: 'Sign FastFetch'
194-
inputs:
195-
connectedServiceName: $(esrpAppConnectionName)
196-
useMSIAuthentication: true
197-
appRegistrationClientId: $(esrpClientId)
198-
appRegistrationTenantId: $(esrpTenantId)
199-
authAkvName: $(esrpKeyVaultName)
200-
authSignCertName: $(esrpSignReqCertName)
201-
serviceEndpointUrl: $(esrpEndpointUrl)
183+
- template: .azure-pipelines/esrp/sign.yml@self
184+
parameters:
185+
displayName: 'Sign FastFetch'
202186
folderPath: $(OutDir)\FastFetch\bin\$(BuildConfiguration)\net10.0-windows10.0.17763.0\win-x64\publish
203187
pattern: 'FastFetch.exe'
204-
useMinimatch: true
205-
signConfigType: inlineSignParams
206188
inlineOperation: |
207189
[
208190
{
@@ -240,20 +222,11 @@ extends:
240222
displayName: 'Build VFS for Git installer'
241223
242224
- ${{ if eq(parameters.esrp, true) }}:
243-
- task: EsrpCodeSigning@6
244-
displayName: 'Sign VFS for Git installer'
245-
inputs:
246-
connectedServiceName: $(esrpAppConnectionName)
247-
useMSIAuthentication: true
248-
appRegistrationClientId: $(esrpClientId)
249-
appRegistrationTenantId: $(esrpTenantId)
250-
authAkvName: $(esrpKeyVaultName)
251-
authSignCertName: $(esrpSignReqCertName)
252-
serviceEndpointUrl: $(esrpEndpointUrl)
225+
- template: .azure-pipelines/esrp/sign.yml@self
226+
parameters:
227+
displayName: 'Sign VFS for Git installer'
253228
folderPath: $(OutDir)\GVFS.Installers\bin\$(BuildConfiguration)\win-x64
254229
pattern: 'SetupGVFS.*.exe'
255-
useMinimatch: true
256-
signConfigType: inlineSignParams
257230
inlineOperation: |
258231
[
259232
{

0 commit comments

Comments
 (0)