@@ -15,6 +15,31 @@ parameters:
1515 default : false
1616 displayName : ' Enable ESRP code signing'
1717
18+ #
19+ # 1ES Pipeline Templates do not allow using a matrix strategy so we create
20+ # a YAML object parameter with and foreach to create jobs for each entry.
21+ # Each OS has its own matrix object since their build steps differ.
22+ #
23+ - name : windows_matrix
24+ type : object
25+ default :
26+ - id : windows_x64
27+ jobName : ' Windows (x86)'
28+ runtime : win-x86
29+ pool : GitClientPME-1ESHostedPool-intel-pc
30+ image : win-x86_64-ado1es
31+ os : windows
32+
33+ variables :
34+ - name : ' esrpAppConnectionName'
35+ value : ' 1ESGitClient-ESRP-App'
36+ # ESRP signing variables set in the pipeline settings:
37+ # - esrpEndpointUrl
38+ # - esrpClientId
39+ # - esrpTenantId
40+ # - esrpKeyVaultName
41+ # - esrpSignReqCertName
42+
1843extends :
1944 template : v1/1ES.Official.PipelineTemplate.yml@1ESPipelines
2045 parameters :
@@ -25,14 +50,157 @@ extends:
2550 image : win-x86_64-ado1es
2651 os : windows
2752 stages :
28- - stage : windows
29- displayName : ' Windows '
53+ - stage : build
54+ displayName : ' Build and Sign '
3055 jobs :
31- - job : win_x86_build
32- displayName : ' Windows Build and Sign (x86)'
33- pool :
34- name : GitClient-1ESHostedPool-intel-pc
35- image : win-x86_64-ado1es
36- os : windows
37- steps :
38- - checkout : self
56+ #
57+ # Windows build jobs
58+ #
59+ - ${{ each dim in parameters.windows_matrix }} :
60+ - job : ${{ dim.id }}
61+ displayName : ${{ dim.jobName }}
62+ pool :
63+ name : ${{ dim.pool }}
64+ image : ${{ dim.image }}
65+ os : ${{ dim.os }}
66+ templateContext :
67+ outputs :
68+ - output : pipelineArtifact
69+ targetPath : ' $(Build.ArtifactStagingDirectory)\_final'
70+ artifactName : ' ${{ dim.runtime }}'
71+ steps :
72+ - checkout : self
73+ - task : PowerShell@2
74+ displayName : ' Read version file'
75+ inputs :
76+ targetType : inline
77+ script : |
78+ $version = (Get-Content .\VERSION) -replace '\.\d+$', ''
79+ Write-Host "##vso[task.setvariable variable=version;isReadOnly=true]$version"
80+ - task : UseDotNet@2
81+ displayName : ' Use .NET 8 SDK'
82+ inputs :
83+ packageType : sdk
84+ version : ' 8.x'
85+ - task : PowerShell@2
86+ displayName : ' Build payload'
87+ inputs :
88+ targetType : filePath
89+ filePath : ' .\src\windows\Installer.Windows\layout.ps1'
90+ arguments : |
91+ -Configuration Release `
92+ -Output $(Build.ArtifactStagingDirectory)\payload `
93+ -SymbolOutput $(Build.ArtifactStagingDirectory)\symbols_raw
94+ - task : ArchiveFiles@2
95+ displayName : ' Archive symbols'
96+ inputs :
97+ rootFolderOrFile : ' $(Build.ArtifactStagingDirectory)\symbols_raw'
98+ includeRootFolder : false
99+ archiveType : zip
100+ archiveFile : ' $(Build.ArtifactStagingDirectory)\symbols\gcm-win-x86-$(version)-symbols.zip'
101+ - task : EsrpCodeSigning@5
102+ condition : and(succeeded(), eq('${{ parameters.esrp }}', true))
103+ displayName : ' Sign payload'
104+ inputs :
105+ connectedServiceName : ' $(esrpAppConnectionName)'
106+ useMSIAuthentication : true
107+ appRegistrationClientId : ' $(esrpClientId)'
108+ appRegistrationTenantId : ' $(esrpTenantId)'
109+ authAkvName : ' $(esrpKeyVaultName)'
110+ authSignCertName : ' $(esrpSignReqCertName)'
111+ serviceEndpointUrl : ' $(esrpEndpointUrl)'
112+ folderPath : ' $(Build.ArtifactStagingDirectory)\payload'
113+ pattern : |
114+ **/*.exe
115+ **/*.dll
116+ useMinimatch : true
117+ signConfigType : inlineSignParams
118+ inlineOperation : |
119+ [
120+ {
121+ "KeyCode": "CP-230012",
122+ "OperationCode": "SigntoolSign",
123+ "ToolName": "sign",
124+ "ToolVersion": "1.0",
125+ "Parameters": {
126+ "OpusName": "Microsoft",
127+ "OpusInfo": "https://www.microsoft.com",
128+ "FileDigest": "/fd SHA256",
129+ "PageHash": "/NPH",
130+ "TimeStamp": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
131+ }
132+ },
133+ {
134+ "KeyCode": "CP-230012",
135+ "OperationCode": "SigntoolVerify",
136+ "ToolName": "sign",
137+ "ToolVersion": "1.0",
138+ "Parameters": {}
139+ }
140+ ]
141+ - task : PowerShell@2
142+ displayName : ' Build installers'
143+ inputs :
144+ targetType : inline
145+ script : |
146+ dotnet build '.\src\windows\Installer.Windows\Installer.Windows.csproj' `
147+ --configuration Release `
148+ --no-dependencies `
149+ -p:NoLayout=true `
150+ -p:PayloadPath="$(Build.ArtifactStagingDirectory)\payload" `
151+ -p:OutputPath="$(Build.ArtifactStagingDirectory)\installers"
152+ - task : EsrpCodeSigning@5
153+ condition : and(succeeded(), eq('${{ parameters.esrp }}', true))
154+ displayName : ' Sign installers'
155+ inputs :
156+ connectedServiceName : ' $(esrpAppConnectionName)'
157+ useMSIAuthentication : true
158+ appRegistrationClientId : ' $(esrpClientId)'
159+ appRegistrationTenantId : ' $(esrpTenantId)'
160+ authAkvName : ' $(esrpKeyVaultName)'
161+ authSignCertName : ' $(esrpSignReqCertName)'
162+ serviceEndpointUrl : ' $(esrpEndpointUrl)'
163+ folderPath : ' $(Build.ArtifactStagingDirectory)\installers'
164+ pattern : ' **/*.exe'
165+ useMinimatch : true
166+ signConfigType : inlineSignParams
167+ inlineOperation : |
168+ [
169+ {
170+ "KeyCode": "CP-230012",
171+ "OperationCode": "SigntoolSign",
172+ "ToolName": "sign",
173+ "ToolVersion": "1.0",
174+ "Parameters": {
175+ "OpusName": "Microsoft",
176+ "OpusInfo": "https://www.microsoft.com",
177+ "FileDigest": "/fd SHA256",
178+ "PageHash": "/NPH",
179+ "TimeStamp": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
180+ }
181+ },
182+ {
183+ "KeyCode": "CP-230012",
184+ "OperationCode": "SigntoolVerify",
185+ "ToolName": "sign",
186+ "ToolVersion": "1.0",
187+ "Parameters": {}
188+ }
189+ ]
190+ - task : ArchiveFiles@2
191+ displayName : ' Archive signed payload'
192+ inputs :
193+ rootFolderOrFile : ' $(Build.ArtifactStagingDirectory)\payload'
194+ includeRootFolder : false
195+ archiveType : zip
196+ archiveFile : ' $(Build.ArtifactStagingDirectory)\installers\gcm-win-x86-$(version).zip'
197+ - task : PowerShell@2
198+ displayName : ' Collect artifacts for publishing'
199+ inputs :
200+ targetType : inline
201+ script : |
202+ New-Item -Path "$(Build.ArtifactStagingDirectory)\_final" -ItemType Directory -Force
203+ Copy-Item "$(Build.ArtifactStagingDirectory)\installers\*.exe" -Destination "$(Build.ArtifactStagingDirectory)\_final"
204+ Copy-Item "$(Build.ArtifactStagingDirectory)\installers\*.zip" -Destination "$(Build.ArtifactStagingDirectory)\_final"
205+ Copy-Item "$(Build.ArtifactStagingDirectory)\symbols\*.zip" -Destination "$(Build.ArtifactStagingDirectory)\_final"
206+ Copy-Item "$(Build.ArtifactStagingDirectory)\payload" -Destination "$(Build.ArtifactStagingDirectory)\_final" -Recurse
0 commit comments