-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
build-job.yml
248 lines (209 loc) · 9.06 KB
/
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
parameters:
buildConfig: ''
osGroup: ''
archType: ''
osSubgroup: ''
platform: ''
crossBuild: false
timeoutInMinutes: 120
condition: true
shouldContinueOnError: false
container: ''
buildSteps: []
dependsOn: []
globalBuildSuffix: ''
variables: []
name: ''
displayName: ''
runtimeVariant: ''
pool: ''
# The target names here should match container names in the resources section in our pipelines, like runtime.yml
packageDistroList:
- target: debpkg
packageType: deb
packagingArgs: /p:BuildDebPackage=true
- target: rpmpkg
packageType: rpm
packagingArgs: /p:BuildRpmPackage=true
isOfficialBuild: false
buildFullPlatformManifest: false
liveRuntimeBuildConfig: ''
liveLibrariesBuildConfig: ''
runtimeFlavor: 'coreclr'
unifiedArtifactsName: ''
unifiedBuildNameSuffix: ''
unifiedBuildConfigOverride: ''
### Product build
jobs:
- template: /eng/common/templates/job/job.yml
parameters:
buildConfig: ${{ parameters.buildConfig }}
archType: ${{ parameters.archType }}
osGroup: ${{ parameters.osGroup }}
osSubgroup: ${{ parameters.osSubgroup }}
runtimeVariant: ${{ parameters.runtimeVariant }}
testGroup: ${{ parameters.testGroup }}
helixType: 'build/product/'
enableMicrobuild: true
pool: ${{ parameters.pool }}
# Compute job name from template parameters
name: ${{ format('installer_{0}_{1}', coalesce(parameters.name, parameters.platform), parameters.buildConfig) }}
displayName: ${{ format('Installer Build and Test {0} {1}', coalesce(parameters.name, parameters.platform), parameters.buildConfig) }}
# Run all steps in the container.
# Note that the containers are defined in platform-matrix.yml
container: ${{ parameters.container }}
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
crossBuild: ${{ parameters.crossBuild }}
gatherAssetManifests: true
# Component governance does not work on musl machines
${{ if eq(parameters.osSubGroup, '_musl') }}:
disableComponentGovernance: true
variables:
- ${{ each variable in parameters.variables }}:
- ${{ variable }}
- name: BuildAction
value: -test
- name: buildCommandSourcesDirectory
value: '$(Build.SourcesDirectory)/'
- name: librariesBuildConfigArg
value: -lc ${{ coalesce(parameters.liveLibrariesBuildConfig, parameters.buildConfig) }}
- name: runtimeBuildConfigArg
value: -rc ${{ coalesce(parameters.liveRuntimeBuildConfig, parameters.buildConfig) }}
###
### Platform-specific variable setup
###
- ${{ if eq(parameters.osGroup, 'windows') }}:
- name: CommonMSBuildArgs
value: >-
/p:TargetArchitecture=${{ parameters.archType }}
/p:PortableBuild=true
/p:RuntimeFlavor=${{ parameters.runtimeFlavor }}
- name: TargetArchitecture
value: ${{ parameters.archType }}
- name: BaseJobBuildCommand
value: >-
build.cmd -subset host+packs -ci
$(BuildAction)
-configuration $(_BuildConfig)
$(librariesBuildConfigArg)
$(runtimeBuildConfigArg)
$(CommonMSBuildArgs)
- ${{ elseif eq(parameters.osGroup, 'osx') }}:
- name: CommonMSBuildArgs
value: >-
/p:PortableBuild=true
/p:RuntimeFlavor=${{ parameters.runtimeFlavor }}
/p:TargetArchitecture=${{ parameters.archType }}
/p:CrossBuild=${{ parameters.crossBuild }}
- name: BaseJobBuildCommand
value: >-
$(Build.SourcesDirectory)/build.sh -subset host+packs -ci
$(BuildAction)
-configuration $(_BuildConfig)
-arch ${{ parameters.archType }}
$(librariesBuildConfigArg)
$(runtimeBuildConfigArg)
$(CommonMSBuildArgs)
- ${{ elseif in(parameters.osGroup, 'linux', 'freebsd') }}:
- name: CommonMSBuildArgs
value: >-
/p:Configuration=$(_BuildConfig)
/p:TargetOS=${{ parameters.osGroup }}
/p:TargetArchitecture=${{ parameters.archType }}
/p:RuntimeFlavor=${{ parameters.runtimeFlavor }}
- name: _PortableBuild
value: ${{ eq(parameters.osSubgroup, '') }}
- ${{ if and(eq(parameters.osSubgroup, '_musl'), eq(parameters.osGroup, 'linux')) }}:
- name: _PortableBuild
value: true
- ${{ if eq(parameters.crossBuild, true) }}:
- name: ArchArg
value: -arch ${{ parameters.archType }}
- name: BaseJobBuildCommand
value: >-
$(Build.SourcesDirectory)/build.sh -subset host+packs -ci
$(BuildAction)
$(librariesBuildConfigArg)
$(runtimeBuildConfigArg)
$(ArchArg)
/p:CrossBuild=${{ parameters.crossBuild }}
/p:PortableBuild=$(_PortableBuild)
$(CommonMSBuildArgs)
- name: installersSubsetArg
value: --subset packs.installers
dependsOn:
- 'build_${{ parameters.osGroup }}${{ parameters.osSubgroup }}_${{ parameters.archType }}_${{ coalesce(parameters.unifiedBuildConfigOverride, parameters.buildConfig) }}_${{ parameters.unifiedBuildNameSuffix }}'
- ${{ parameters.dependsOn }}
steps:
- ${{ if eq(parameters.osGroup, 'windows') }}:
- template: /eng/pipelines/common/templates/disable-vsupdate-or-failfast.yml
- checkout: self
clean: true
fetchDepth: $(checkoutFetchDepth)
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- ${{ if ne(parameters.osGroup, '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)
- template: /eng/pipelines/common/download-artifact-step.yml
parameters:
unpackFolder: $(Build.SourcesDirectory)/artifacts/bin
artifactFileName: '${{ parameters.unifiedArtifactsName }}$(archiveExtension)'
artifactName: '${{ parameters.unifiedArtifactsName }}'
displayName: 'unified artifacts'
- ${{ if in(parameters.osGroup, 'osx', 'maccatalyst', 'ios', 'iossimulator', 'tvos', 'tvossimulator') }}:
- script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }}
displayName: Install Build Dependencies
- script: |
du -sh $(Build.SourcesDirectory)/*
df -h
displayName: Disk Usage before Build
- script: $(BaseJobBuildCommand)
displayName: Build
continueOnError: ${{ eq(parameters.shouldContinueOnError, true) }}
- ${{ 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()
- ${{ if in(parameters.osGroup, 'osx', 'ios', 'tvos') }}:
- script: |
du -sh $(Build.SourcesDirectory)/*
df -h
displayName: Disk Usage after Build
# Only in glibc leg, we produce RPMs and Debs
- ${{ if and(eq(parameters.runtimeFlavor, 'coreclr'), or(eq(parameters.platform, 'linux_x64'), eq(parameters.platform, 'linux_arm64')), eq(parameters.osSubgroup, ''))}}:
- ${{ each packageBuild in parameters.packageDistroList }}:
# This leg's RID matches the build image. Build its distro-dependent packages, as well as
# the distro-independent installers. (There's no particular reason to build the distro-
# independent installers on this leg, but we need to do it somewhere.)
# Currently, linux_arm64 supports 'rpm' type only.
- ${{ if or(not(eq(parameters.platform, 'linux_arm64')), eq(packageBuild.packageType, 'rpm')) }}:
- template: /eng/pipelines/installer/jobs/steps/build-linux-package.yml
parameters:
packageType: ${{ packageBuild.packageType }}
target: ${{ packageBuild.target }}
packageStepDescription: Runtime Deps, Runtime, Framework Packs installers
subsetArg: $(installersSubsetArg)
packagingArgs: ${{ packageBuild.packagingArgs }}
- template: /eng/pipelines/installer/jobs/steps/upload-job-artifacts.yml
parameters:
name: ${{ coalesce(parameters.name, parameters.platform) }}
runtimeFlavor: ${{ parameters.runtimeFlavor }}
runtimeVariant: ${{ parameters.runtimeVariant }}
- ${{ if ne(parameters.osGroup, 'windows') }}:
- script: set -x && df -h
displayName: Check remaining storage space
condition: always()
continueOnError: true