-
Notifications
You must be signed in to change notification settings - Fork 4.8k
/
global-build-job.yml
278 lines (247 loc) · 12.3 KB
/
global-build-job.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
parameters:
buildConfig: ''
nameSuffix: ''
buildArgs: ''
archType: ''
hostedOs: ''
osGroup: ''
osSubgroup: ''
container: ''
crossBuild: false
variables: []
targetRid: ''
timeoutInMinutes: ''
dependsOn: []
# The following parameter is used to specify dependencies on other global build for the same platform.
# We provide this mechanism to allow for global builds to depend on other global builds and use the multiplexing
# that platform-matrix.yml enables.
# Each item can have the following properties:
# - nameSuffix: The suffix of the job name to depend on.
# - buildConfig: The configuration of the job to depend on.
dependsOnGlobalBuilds: []
pool: ''
platform: ''
condition: true
useContinueOnErrorDuringBuild: false
shouldContinueOnError: false
isOfficialBuild: false
runtimeFlavor: 'coreclr'
runtimeVariant: ''
helixQueues: ''
enablePublishTestResults: false
testResultsFormat: ''
postBuildSteps: []
extraVariablesTemplates: []
preBuildSteps: []
templatePath: 'templates'
templateContext: ''
disableComponentGovernance: ''
jobs:
- template: /eng/common/${{ parameters.templatePath }}/job/job.yml
parameters:
${{ if eq(parameters.hostedOs, '') }}:
name: ${{ format('build_{0}{1}_{2}_{3}_{4}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig, parameters.nameSuffix) }}
displayName: ${{ format('{0}{1}-{2} {3} {4} {5}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig, parameters.nameSuffix, parameters.runtimeVariant) }}
${{ if ne(parameters.hostedOs, '') }}:
name: ${{ format('build_{0}{1}_{2}_{3}_{4}_{5}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.hostedOs, parameters.buildConfig, parameters.nameSuffix) }}
displayName: ${{ format('{0}{1}-{2} {3} {4} {5} {6}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.hostedOs, parameters.buildConfig, parameters.nameSuffix, parameters.runtimeVariant) }}
pool: ${{ parameters.pool }}
container: ${{ parameters.container }}
condition: and(succeeded(), ${{ parameters.condition }})
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
enablePublishTestResults: ${{ parameters.enablePublishTestResults }}
testResultsFormat: ${{ parameters.testResultsFormat }}
${{ if ne(parameters.templateContext, '') }}:
templateContext: ${{ parameters.templateContext }}
artifacts:
publish:
logs:
${{ if notin(parameters.osGroup, 'browser', 'wasi') }}:
name: Logs_Build_Attempt$(System.JobAttempt)_${{ parameters.osGroup }}_${{ parameters.osSubGroup }}_${{ parameters.archType }}_${{ parameters.buildConfig }}_${{ parameters.nameSuffix }}
${{ if in(parameters.osGroup, 'browser', 'wasi') }}:
name: Logs_Build_Attempt$(System.JobAttempt)_${{ parameters.osGroup }}_${{ parameters.archType }}_${{ parameters.hostedOs }}_${{ parameters.buildConfig }}_${{ parameters.nameSuffix }}
# Component governance does not work on musl machines
${{ if eq(parameters.osSubGroup, '_musl') }}:
disableComponentGovernance: true
${{ else }}:
disableComponentGovernance: ${{ parameters.disableComponentGovernance }}
workspace:
clean: all
${{ if or(ne(parameters.dependsOn,''), ne(parameters.dependsOnGlobalBuilds,'')) }}:
dependsOn:
- ${{ each build in parameters.dependsOn }}:
- ${{ build }}
- ${{ each globalBuild in parameters.dependsOnGlobalBuilds }}:
- ${{ format('build_{0}{1}_{2}_{3}_{4}', parameters.osGroup, parameters.osSubgroup, parameters.archType, coalesce(globalBuild.buildConfig, parameters.buildConfig), globalBuild.nameSuffix) }}
variables:
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
- group: DotNet-HelixApi-Access
- group: AzureDevOps-Artifact-Feeds-Pats
- name: _osParameter
value: -os ${{ parameters.osGroup }}
- name: _archParameter
value: -arch ${{ parameters.archType }}
- ${{ if and(eq(parameters.osGroup, 'linux'), eq(parameters.osSubGroup, '_bionic')) }}:
- name: _osParameter
value: -os linux-bionic
- name: crossArg
value: ''
- ${{ if eq(parameters.crossBuild, true) }}:
- name: crossArg
value: '-cross'
- name: CxxStandardLibraryArg
value: ''
- ${{ if ne(parameters.cxxStandardLibrary, '') }}:
- name: CxxStandardLibraryArg
value: /p:TargetCxxStandardLibrary=${{ parameters.cxxStandardLibrary }}
- name: CxxStandardLibraryStaticArg
value: ''
- ${{ if ne(parameters.cxxStandardLibraryStatic, '') }}:
- name: CxxStandardLibraryStaticArg
value: /p:TargetCxxStandardLibraryStatic=${{ parameters.cxxStandardLibraryStatic }}
- name: CxxAbiLibraryArg
value: ''
- ${{ if ne(parameters.cxxAbiLibrary, '') }}:
- name: CxxAbiLibraryArg
value: /p:TargetCxxAbiLibrary=${{ parameters.cxxAbiLibrary }}
- name: TargetCxxLibraryConfigurationArgs
value: $(CxxStandardLibraryArg) $(CxxStandardLibraryStaticArg) $(CxxAbiLibraryArg)
- name: _officialBuildParameter
${{ if eq(parameters.isOfficialBuild, true) }}:
value: /p:OfficialBuildId=$(Build.BuildNumber)
${{ if ne(parameters.isOfficialBuild, true) }}:
value: ''
- name: _buildDarwinFrameworksParameter
${{ if in(parameters.osGroup, 'ios', 'tvos', 'maccatalyst')}}:
value: /p:BuildDarwinFrameworks=true
${{ if notin(parameters.osGroup, 'ios', 'tvos', 'maccatalyst')}}:
value: ''
# Set no native sanitizers by default
- name: _nativeSanitizersArg
value: ''
- ${{ each variableTemplate in parameters.extraVariablesTemplates }}:
- template: ${{ variableTemplate.template }}
parameters:
osGroup: ${{ parameters.osGroup }}
osSubgroup: ${{ parameters.osSubgroup }}
archType: ${{ parameters.archType }}
buildConfig: ${{ parameters.buildConfig }}
runtimeFlavor: ${{ parameters.runtimeFlavor }}
runtimeVariant: ${{ parameters.runtimeVariant }}
helixQueues: ${{ parameters.helixQueues }}
targetRid: ${{ parameters.targetRid }}
nameSuffix: ${{ parameters.nameSuffix }}
platform: ${{ parameters.platform }}
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
${{ if ne(variableTemplate.forwardedParameters, '') }}:
${{ each parameter in variableTemplate.forwardedParameters }}:
${{ parameter }}: ${{ parameters[parameter] }}
${{ if ne(variableTemplate.parameters, '') }}:
${{ insert }}: ${{ variableTemplate.parameters }}
- ${{ each variable in parameters.variables }}:
- ${{ variable }}
steps:
- ${{ if eq(parameters.osGroup, 'windows') }}:
- template: /eng/pipelines/common/templates/disable-vsupdate-or-failfast.yml
- checkout: self
clean: true
fetchDepth: $(checkoutFetchDepth)
- ${{ if and(eq(parameters.isOfficialBuild, true), notin(parameters.osGroup, 'osx', 'maccatalyst', 'ios', 'iossimulator', 'tvos', 'tvossimulator')) }}:
- template: /eng/pipelines/common/restore-internal-tools.yml
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- ${{ if and(ne(parameters.osGroup, 'windows'), ne(parameters.hostedOs, 'windows')) }}:
- task: Bash@3
displayName: Setup Private Feeds Credentials
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh
arguments: $(Build.SourcesDirectory)/NuGet.config $Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- ${{ else }}:
- task: PowerShell@2
displayName: Setup Private Feeds Credentials
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1
arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
# Run the NuGetAuthenticate task after the internal feeds are added to the nuget.config
# This ensures that creds are set appropriately for all feeds in the config, and that the
# credential provider is installed.
- task: NuGetAuthenticate@1
- ${{ if in(parameters.osGroup, 'osx', 'maccatalyst', 'ios', 'iossimulator', 'tvos', 'tvossimulator') }}:
- script: $(Build.SourcesDirectory)/eng/common/native/install-dependencies.sh ${{ parameters.osGroup }}
displayName: Install Build Dependencies
- script: |
du -sh $(Build.SourcesDirectory)/*
df -h
displayName: Disk Usage before Build
- ${{ if in(parameters.platform, 'browser_wasm_win', 'wasi_wasm_win') }}:
# Update machine certs
- task: PowerShell@2
displayName: Update machine certs
inputs:
filePath: $(Build.SourcesDirectory)/eng/pipelines/mono/update-machine-certs.ps1
- ${{ if ne(parameters.preBuildSteps,'') }}:
- ${{ each preBuildStep in parameters.preBuildSteps }}:
- ${{ if ne(preBuildStep.template, '') }}:
- template: ${{ preBuildStep.template }}
parameters:
osGroup: ${{ parameters.osGroup }}
osSubgroup: ${{ parameters.osSubgroup }}
archType: ${{ parameters.archType }}
buildConfig: ${{ parameters.buildConfig }}
runtimeFlavor: ${{ parameters.runtimeFlavor }}
runtimeVariant: ${{ parameters.runtimeVariant }}
helixQueues: ${{ parameters.helixQueues }}
targetRid: ${{ parameters.targetRid }}
nameSuffix: ${{ parameters.nameSuffix }}
platform: ${{ parameters.platform }}
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
${{ if ne(preBuildStep.forwardedParameters, '') }}:
${{ each parameter in preBuildStep.forwardedParameters }}:
${{ parameter }}: ${{ parameters[parameter] }}
${{ if ne(preBuildStep.parameters, '') }}:
${{ insert }}: ${{ preBuildStep.parameters }}
- ${{ else }}:
- ${{ preBuildStep }}
# Build
- template: /eng/pipelines/common/templates/global-build-step.yml
parameters:
buildArgs: ${{ parameters.buildArgs }}
useContinueOnErrorDuringBuild: ${{ parameters.useContinueOnErrorDuringBuild }}
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
- ${{ if in(parameters.osGroup, 'osx', 'ios', 'tvos', 'android') }}:
- script: |
du -sh $(Build.SourcesDirectory)/*
df -h
displayName: Disk Usage after Build
condition: always()
# If intended to send extra steps after regular build add them here.
- ${{ if ne(parameters.postBuildSteps,'') }}:
- ${{ each postBuildStep in parameters.postBuildSteps }}:
- ${{ if ne(postBuildStep.template, '') }}:
- template: ${{ postBuildStep.template }}
parameters:
osGroup: ${{ parameters.osGroup }}
osSubgroup: ${{ parameters.osSubgroup }}
archType: ${{ parameters.archType }}
buildConfig: ${{ parameters.buildConfig }}
runtimeFlavor: ${{ parameters.runtimeFlavor }}
runtimeVariant: ${{ parameters.runtimeVariant }}
helixQueues: ${{ parameters.helixQueues }}
targetRid: ${{ parameters.targetRid }}
nameSuffix: ${{ parameters.nameSuffix }}
platform: ${{ parameters.platform }}
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
${{ if ne(postBuildStep.forwardedParameters, '') }}:
${{ each parameter in postBuildStep.forwardedParameters }}:
${{ parameter }}: ${{ parameters[parameter] }}
${{ if ne(postBuildStep.parameters, '') }}:
${{ insert }}: ${{ postBuildStep.parameters }}
- ${{ else }}:
- ${{ postBuildStep }}
- ${{ if and(eq(parameters.isOfficialBuild, true), eq(parameters.osGroup, 'windows')) }}:
- powershell: ./eng/collect_vsinfo.ps1 -ArchiveRunName postbuild_log
displayName: Collect vslogs on exit
condition: always()