Skip to content

Commit 3969d4d

Browse files
authored
Add condition to skip installer build steps (#6001)
1 parent 7b1d3e6 commit 3969d4d

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

build/AzurePipelinesTemplates/WindowsAppSDK-BuildInstaller-Steps.yml

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,36 @@ parameters:
1616
default: false
1717

1818
steps:
19+
- task: PowerShell@2
20+
name: InitializeSkipInstallerBuild
21+
displayName: 'Decide if we can skip this installer build job'
22+
inputs:
23+
targetType: 'inline'
24+
# If this pipeline run is validating an arm test OS image but this job is set to build the installer for
25+
# non-arm, we can skip building the installer because it won't be used for running tests. Same
26+
# argument when validating a non-arm test OS image but this job is set to build the installer for arm.
27+
# Setting SkipInstallerBuild to true causes all subsequent steps in this job to be skipped. When it is
28+
# set to false or left uninitialized (normal / majority case), we run the remaining steps as usual.
29+
script: |
30+
$ValidatingArmImage = '$(TestImageToValidate)' -match '(?i)arm'
31+
Write-Host "ValidatingArmImage: " $ValidatingArmImage
32+
$BuildArmPlatform = '$(buildPlatform)' -match '(?i)arm'
33+
Write-Host "BuildArmPlatform:" $BuildArmPlatform
34+
$DisableBuildLocal = ($BuildArmPlatform -xor $ValidatingArmImage)
35+
Write-Host "DisableBuildLocal: " $DisableBuildLocal
36+
Write-Host "##vso[task.setvariable variable=SkipInstallerBuild;isOutput=true]$DisableBuildLocal"
37+
Write-Host "##vso[task.setvariable variable=SkipInstallerBuild;]$DisableBuildLocal"
38+
Write-Host 'parameters.SignOutput: ' ${{parameters.SignOutput}}
39+
# Don't bother doing this step if we are not validating a test OS image. All steps below work as usual.
40+
condition: and(succeeded(), eq(variables.EnableTestImageValidation , true))
41+
1942
- ${{ if eq(parameters.UseCurrentBuild, 'true') }}:
2043
- task: DownloadPipelineArtifact@2
2144
displayName: 'Download WindowsAppSDK From Current Build'
2245
inputs:
2346
artifactName: 'WindowsAppSDK_Nuget_And_MSIX'
2447
targetPath: '$(System.ArtifactsDirectory)'
48+
condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
2549
- ${{ else }}:
2650
###
2751
# This step downloads the WindowsAppSDK NuGet package from a pipeline
@@ -36,7 +60,8 @@ steps:
3660
project: $(System.TeamProjectId)
3761
pipeline: $(OfficialPipelineID)
3862
pipelineId: $(LatestOfficialBuildID)
39-
63+
condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
64+
4065
###
4166
# Install the internal licensing support for release-signed packages. This can always be present in
4267
# pipeline builds. The installer code will automatically degrade / skip licenses in non-release builds
@@ -49,6 +74,7 @@ steps:
4974
inputs:
5075
filePath: '$(Build.SourcesDirectory)\$(foundationRepoPath)build\Scripts\ConvertVersionDetailsToPackageConfig.ps1'
5176
arguments: -versionDetailsPath '$(Build.SourcesDirectory)\$(foundationRepoPath)eng\Version.Details.xml' -packageConfigPath '$(Build.SourcesDirectory)\$(foundationRepoPath)build\packages.config'
77+
condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
5278

5379
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
5480
displayName: RestoreNuGetPackages
@@ -57,6 +83,7 @@ steps:
5783
feedsToUse: config
5884
nugetConfigPath: $(foundationRepoPath)nuget.config
5985
restoreDirectory: packages
86+
condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
6087

6188
- task: powershell@2
6289
displayName: 'Create test pfx to sign MSIX test packages (DevCheck)'
@@ -65,6 +92,7 @@ steps:
6592
filePath: $(foundationRepoPath)tools\DevCheck\DevCheck.ps1
6693
arguments: -NoInteractive -Offline -Verbose -CheckTestPfx -Clean
6794
workingDirectory: '$(Build.SourcesDirectory)'
95+
condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
6896

6997
- task: powershell@2
7098
displayName: 'Install test certificate for MSIX test packages (DevCheck)'
@@ -73,6 +101,7 @@ steps:
73101
filePath: $(foundationRepoPath)tools\DevCheck\DevCheck.ps1
74102
arguments: -NoInteractive -Offline -Verbose -CheckTestCert
75103
workingDirectory: '$(Build.SourcesDirectory)'
104+
condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
76105

77106
# Copy license files into the InstallerInput directory. License files should be named consistently with the
78107
# package naming used in the installer. See build\Scripts\ExtractMSIXFromNuget.ps1 for specifics.
@@ -86,6 +115,7 @@ steps:
86115
*.xml
87116
TargetFolder: '$(Build.SourcesDirectory)\InstallerInput'
88117
flattenFolders: false
118+
condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
89119

90120
# Copy license installation header into the correct installer source location.
91121
- task: CopyFiles@2
@@ -97,6 +127,7 @@ steps:
97127
TargetFolder: '$(Build.SourcesDirectory)\$(foundationRepoPath)installer\dev'
98128
flattenFolders: false
99129
overWrite: true
130+
condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
100131

101132
###
102133
# Copy MSIX packages from build artifacts into the installer content location and create
@@ -109,6 +140,7 @@ steps:
109140
arguments: >
110141
-Source '$(System.ArtifactsDirectory)'
111142
-Dest '$(Build.SourcesDirectory)\InstallerInput'
143+
condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
112144

113145
- task: PowerShell@2
114146
displayName: CreateInstallerOverrideHeader
@@ -117,6 +149,7 @@ steps:
117149
arguments: >
118150
-SourceFolder '$(Build.SourcesDirectory)\InstallerInput'
119151
-DestinationFolder '$(Build.SourcesDirectory)\InstallerInput'
152+
condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
120153

121154
# NuGetCommand@2
122155
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
@@ -126,6 +159,7 @@ steps:
126159
restoreSolution: $(foundationRepoPath)installer\WindowsAppRuntimeInstall.sln
127160
feedsToUse: config
128161
nugetConfigPath: $(Build.SourcesDirectory)\$(foundationRepoPath)nuget.config
162+
condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
129163

130164
- task: CopyFiles@2
131165
displayName: 'Copy installer override header'
@@ -135,11 +169,13 @@ steps:
135169
windowsappruntime_definitions_override.h
136170
TargetFolder: $(foundationRepoPath)installer\dev
137171
flattenFolders: false
172+
condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
138173

139174
- task: NuGetAuthenticate@1
140175
displayName: "NuGet authenticate to restore Microsoft.Telemetry.Inbox.Native"
141176
inputs:
142177
nuGetServiceConnections: "TelemetryInternal"
178+
condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
143179

144180
# NuGetCommand@2
145181
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
@@ -148,6 +184,7 @@ steps:
148184
command: "custom"
149185
arguments:
150186
'restore $(Build.SourcesDirectory)\$(foundationRepoPath)installer\dev\telemetry\packages.config -ConfigFile $(Build.SourcesDirectory)\$(foundationRepoPath)nuget.config -PackagesDirectory $(Build.SourcesDirectory)\$(foundationRepoPath)packages'
187+
condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
151188

152189
# Overwrite wil\Traceloggingconfig.h content in public nuget with that of MicrosoftTelemetry.h from internal nuget
153190
# This step enables telemetry in the Installer
@@ -178,6 +215,7 @@ steps:
178215
Write-Host Did not find the source MicrosoftTelemetry.h under $(Build.SourcesDirectory)\$(foundationRepoPath)packages\
179216
Get-Childitem -Path '$(Build.SourcesDirectory)\$(foundationRepoPath)packages\' -Recurse
180217
}
218+
condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
181219

182220
# Extract Microsoft.WindowsAppSDK Nuget package artifact published by BuildWindowsAppSDKPackages job of Aggregate stage,
183221
# that runs before the current CreateInstaller stage in the same build pipeline, to the installer's packages folder.
@@ -202,6 +240,7 @@ steps:
202240
Rename-Item -Path $destWinAppSDKNupkgPath.FullName -NewName $winAppSDKZip
203241
Expand-Archive $winAppSDKZip -DestinationPath ($destWinAppSDKNupkgPath.Directory.FullName + '\' + $destWinAppSDKNupkgPath.BaseName)
204242
Copy-Item -Force ($destWinAppSDKNupkgPath.Directory.FullName + '\' + $destWinAppSDKNupkgPath.BaseName + "\include\WindowsAppSDK-VersionInfo.h") '$(Build.SourcesDirectory)\$(foundationRepoPath)installer\dev\'
243+
condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
205244

206245
- task: WinUndockNativeCompiler@1
207246
displayName: 'Setup native compiler version override'
@@ -213,6 +252,7 @@ steps:
213252
includeUCRT: true
214253
ucrtFeedPat: $(System.AccessToken)
215254
platform: $(buildPlatform)
255+
condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
216256

217257
- task: VSBuild@1
218258
displayName: 'Build Windows App Runtime Install'
@@ -221,6 +261,7 @@ steps:
221261
platform: '$(buildPlatform)'
222262
configuration: '$(buildConfiguration)'
223263
msbuildArgs: /binaryLogger:$(ob_outputDirectory)\binlogs\WindowsAppRuntimeInstall.$(buildPlatform).$(buildConfiguration).binlog
264+
condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
224265

225266
# The VSBuild@1 task above seems to be able to do inline PREfast scanning with the EO-compliant ruleset now. So, we don't seem to
226267
# need the following any more. Commenting it out for now and observe a bit more. Remove it when we feel comfortable.
@@ -241,18 +282,21 @@ steps:
241282
# continueOnError: true
242283
# env:
243284
# SYSTEM_ACCESSTOKEN: $(System.AccessToken)
285+
# condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
244286

245287
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
246288
displayName: 'Component Governance Detection'
247289
inputs:
248290
scanType: 'Register'
249291
failOnAlert: false
292+
condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
250293

251294
- ${{ if eq(parameters.IsOneBranch, 'true') }}:
252295
- template: ${{variables['System.DefaultWorkingDirectory']}}\AzurePipelinesTemplates\WindowsAppSDK-PublishSymbol-Steps.yml@WindowsAppSDKConfig
253296
parameters:
254297
SearchPattern: '$(foundationRepoPath)BuildOutput\$(buildConfiguration)\$(buildPlatform)\WindowsAppRuntimeInstall\*.pdb'
255298
IsOfficial: ${{ parameters.IsOfficial }}
299+
condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
256300

257301
- ${{ if eq(parameters.SignOutput, 'true') }}:
258302
- template: ${{variables['System.DefaultWorkingDirectory']}}\AzurePipelinesTemplates/WindowsAppSDK-EsrpCodeSigning-Steps.yml@WindowsAppSDKConfig
@@ -267,6 +311,7 @@ steps:
267311
inputs:
268312
SourceFolder: '$(foundationRepoPath)BuildOutput'
269313
TargetFolder: '$(ob_outputDirectory)\Installer'
314+
condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
270315

271316
- task: powershell@2
272317
displayName: 'Remove test certificate for MSIX test packages (DevCheck)'
@@ -275,10 +320,11 @@ steps:
275320
filePath: $(foundationRepoPath)tools\DevCheck\DevCheck.ps1
276321
arguments: -NoInteractive -Offline -Verbose -RemoveTestCert -RemoveTestPfx
277322
workingDirectory: '$(Build.SourcesDirectory)'
323+
condition: and(succeeded(), ne(variables.SkipInstallerBuild, true))
278324

279325
- ${{ if ne(parameters.IsOneBranch, 'true') }}:
280326
- task: PublishBuildArtifacts@1
281-
condition: always()
327+
condition: ne(variables.SkipInstallerBuild, true)
282328
inputs:
283329
PathtoPublish: '$(ob_outputDirectory)'
284330
artifactName: '$(ob_artifactBaseName)'

0 commit comments

Comments
 (0)