1
1
parameters :
2
2
job : null
3
- matrix :
4
- Production : {}
5
3
pool : null
6
4
scriptPrefix : null
7
5
scriptSuffix : null
8
6
setupMac : false
9
7
setupWindows : false
10
- # Temporarily disable smoke-tests until entire product builds.
11
- # See https://github.com/dotnet/source-build/issues/1552
12
- skipSmokeTest : true
8
+ skipSmokeTest : false
13
9
failOnPrebuiltBaselineError : true
10
+ reportPrebuiltLeaks : false
11
+ generatePrebuiltBurndown : false
12
+ runUnitTests : false
13
+ cleanAptGet : false
14
14
15
15
jobs :
16
16
- job : ${{ parameters.job }}
17
- strategy :
18
- matrix : ${{ parameters.matrix }}
19
17
pool : ${{ parameters.pool }}
20
- timeoutInMinutes : 240
18
+ timeoutInMinutes : 300
21
19
variables :
20
+ rootDirectory : $(Build.SourcesDirectory)/..
21
+ tarballDirectory : $(rootDirectory)/tb
22
+ stagingDirectory : $(rootDirectory)/staging
23
+ dropDirectory : $(stagingDirectory)/drop
24
+ logsDirectory : $(Build.ArtifactStagingDirectory)/logs
25
+ tarballName : tarball_$(Build.BuildId)
22
26
args.build : >-
23
27
/p:Configuration=$(sb.configuration)
24
28
/p:BuildPortableRuntime=$(sb.portable)
25
29
/p:BuildPortableSdk=$(sb.portable)
26
30
/p:FailOnPrebuiltBaselineError=$(failOnPrebuiltBaselineError)
27
31
/p:ProdConBlobFeedUrlPrefix=$(prodConBlobFeedUrlPrefix)
28
32
/p:AzDoPat=$(dn-bot-all-orgs-build-rw-code-rw)
33
+ /p:ArchiveDownloadedPackages=$(sb.tarball)
29
34
$(tarballDownloadArgs)
30
35
args.smokeTest : >
31
36
--run-smoke-test
32
37
/p:Configuration=$(sb.configuration)
33
38
/p:ProdConBlobFeedUrlPrefix=$(prodConBlobFeedUrlPrefix)
34
39
# Prefix to distinguish artifacts from different legs.
35
- artifactName : ${{ format('{0} $(type)', parameters.job) }}
40
+ artifactName : ${{ parameters.job }}
36
41
failOnPrebuiltBaselineError : ${{ parameters.failOnPrebuiltBaselineError }}
37
- logsDirectory : $(Build.ArtifactStagingDirectory)/logs
42
+ reportPrebuiltLeaks : ${{ parameters.reportPrebuiltLeaks }}
43
+ systemLibunwind : ${{ parameters.systemLibunwind }}
38
44
tarballDownloadArgs : >-
39
- /p:SkipDownloadingReferencePackages=true
40
- /p:SkipDownloadingPreviouslySourceBuiltPackages=true
45
+ /p:DownloadSourceBuildReferencePackagesTimeoutSeconds=600
46
+ /p:DownloadSourceBuiltArtifactsTimeoutSeconds=1500
41
47
SOURCE_BUILD_SKIP_SUBMODULE_CHECK : true
42
48
# Default type, can be overridden by matrix legs.
43
- type : Production
49
+ type : ${{ coalesce(parameters.type, ' Production') }}
44
50
45
51
${{ if not(and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'))) }} :
46
52
SetInternalPackageFeedPatBashCommand : ' '
56
62
clean : true
57
63
58
64
- template : ../steps/cleanup-unneeded-files.yml
65
+ parameters :
66
+ cleanAptGet : ${{ parameters.cleanAptGet }}
67
+ - template : ../steps/calculate-config-flags.yml
59
68
60
69
# Make sure submodules from other branches are removed: pass extra f.
61
70
- script : git clean -xdff
@@ -79,11 +88,18 @@ jobs:
79
88
- template : ../steps/check-space-powershell.yml
80
89
81
90
# Build source-build.
82
- - script : |
83
- set -x
84
- $(SetInternalPackageFeedPatBashCommand)
85
- set -e
86
- ${{ format('{0}build{1} $(args.build)', parameters.scriptPrefix, parameters.scriptSuffix) }}
91
+ # Use bash task here because it allows us to use the .bashrc, which sets up the correct
92
+ # paths for clang and llvm on RHEL machines.
93
+ - task : Bash@3
94
+ inputs :
95
+ targetType : inline
96
+ script : |
97
+ set -x
98
+ $(SetInternalPackageFeedPatBashCommand)
99
+ set -e
100
+ ${{ format('{0}build{1} $(args.build)', parameters.scriptPrefix, parameters.scriptSuffix) }}
101
+ noProfile : false
102
+ noRc : false
87
103
displayName : Build source-build
88
104
timeoutInMinutes : 150
89
105
@@ -98,6 +114,131 @@ jobs:
98
114
${{ format('{0}build{1} $(args.smokeTest)', parameters.scriptPrefix, parameters.scriptSuffix) }}
99
115
displayName: Run smoke-test
100
116
117
+ # Create tarball.
118
+ - script : |
119
+ set -ex
120
+ df -h
121
+ args="--skip-prebuilt-check --skip-build --minimize-disk-usage"
122
+ if [ "$(reportPrebuiltLeaks)" = "true" ]; then
123
+ args="$args --enable-leak-detection"
124
+ fi
125
+ ./build-source-tarball.sh \
126
+ "$(tarballDirectory)/$(tarballName)" \
127
+ $args
128
+ du -h $(rootDirectory) | sort -h | tail -n 50
129
+ displayName: Create tarball
130
+ condition: and(succeeded(), eq(variables['sb.tarball'], true))
131
+
132
+ # Copy logs from the production build
133
+ - bash : |
134
+ set -ex
135
+ df -h
136
+ mkdir -p "$(logsDirectory)"
137
+ find . \( \
138
+ -path './artifacts/*-report/*' -o \
139
+ -path './artifacts/msbuild-debug/*' -o \
140
+ -path './artifacts/roslyn-debug/*' -o \
141
+ -path './artifacts/aspnet-debug/*' -o \
142
+ -iname '*.binlog' -o \
143
+ -iname '*.log' \) \
144
+ -exec cp {} --parents "$(logsDirectory)" \;
145
+ du -h $(rootDirectory) | sort -h | tail -n 50
146
+ displayName: Copy source-build production build logs
147
+ condition: always()
148
+ continueOnError: true
149
+
150
+ # Delete key directories from local copy of repo to save space
151
+ - bash : |
152
+ set -ex
153
+ df -h
154
+ sudo rm -rf $(rootDirectory)/source-build/artifacts/src
155
+ sudo rm -rf $(rootDirectory)/source-build/artifacts/obj
156
+ sudo rm -rf $(rootDirectory)/source-build/.git
157
+ sudo rm -rf $(rootDirectory)/source-build/packages
158
+ du -h $(rootDirectory) | sort -h | tail -n 50
159
+ displayName: Delete key directories from source copy of repo to save space
160
+
161
+ # tar the tarball directory into the drop directory.
162
+ - bash : |
163
+ set -ex
164
+ df -h
165
+ mkdir -p $(dropDirectory)/tarball/
166
+ smokeTestPackages="$(tarballDirectory)/$(tarballName)/packages/smoke-test-packages"
167
+ # smokeTestPackages is a package cache, with redundant data and unnecessary structure. E.g.
168
+ # $smokeTestPackages/name/version/name.version.nupkg <- We want this.
169
+ # $smokeTestPackages/name/version/lib/net46/name.dll <- This is already in the nupkg.
170
+ # This find moves the nupkg files into $smokeTestPackages:
171
+ find "$smokeTestPackages" -iname "*.nupkg" -exec mv {} "$smokeTestPackages" \;
172
+ # This find removes all non-nupkg files, which are not wanted:
173
+ find "$smokeTestPackages" -mindepth 1 -not -iname "*.nupkg" -delete
174
+ # Make one .tar.gz for build, another for extras necessary to smoke test:
175
+ tar --numeric-owner "--exclude=$smokeTestPackages" -zcf "$(dropDirectory)/tarball/$(tarballName).tar.gz" -C "$(tarballDirectory)" "$(tarballDirectory)/$(tarballName)"
176
+ tar --numeric-owner -zcf "$(dropDirectory)/tarball/$(tarballName)-smoke-test-prereqs.tar.gz" "$smokeTestPackages"
177
+ du -h $(rootDirectory) | sort -h | tail -n 50
178
+ displayName: Copy tarball to output
179
+ condition: and(succeeded(), eq(variables['sb.tarball'], true))
180
+
181
+ # Build tarball.
182
+ - task : Bash@3
183
+ inputs :
184
+ targetType : inline
185
+ script : |
186
+ set -ex
187
+ df -h
188
+ networkArg=
189
+ if [ "$(sb.tarballOffline)" = "true" ]; then
190
+ networkArg="sudo unshare -n"
191
+ fi
192
+ poisonArg=
193
+ if [ "$(reportPrebuiltLeaks)" = "true" ]; then
194
+ poisonArg="/p:EnablePoison=true"
195
+ fi
196
+ $networkArg "$(tarballDirectory)/$(tarballName)/build.sh" -- \
197
+ /p:Configuration=$(sb.configuration) \
198
+ /p:PortableBuild=$(sb.portable) \
199
+ /p:UseSystemLibunwind=$(systemLibunwind) \
200
+ /p:FailOnPrebuiltBaselineError=true \
201
+ $poisonArg
202
+ du -h $(rootDirectory) | sort -h | tail -n 50
203
+ noProfile : false
204
+ noRc : false
205
+ displayName : Build tarball
206
+ timeoutInMinutes : 150
207
+ condition : and(succeeded(), eq(variables['sb.tarball'], true))
208
+
209
+ # Run smoke tests.
210
+ - script : |
211
+ set -ex
212
+ df -h
213
+ sudo chown -R "$(id -u):$(id -g)" "$(tarballDirectory)/$(tarballName)"
214
+ "$(tarballDirectory)/$(tarballName)/build.sh" \
215
+ --run-smoke-test \
216
+ -- \
217
+ /p:Configuration=$(sb.configuration) \
218
+ /p:ProdConBlobFeedUrlPrefix=$(prodConBlobFeedUrlPrefix)
219
+ du -h $(rootDirectory) | sort -h | tail -n 50
220
+ displayName: Run smoke-test in tarball
221
+ condition: and(succeeded(), eq(variables['sb.tarball'], true))
222
+
223
+ - script : df -h
224
+ displayName : Check space (df -h)
225
+ condition : always()
226
+ continueOnError : true
227
+
228
+ # Copy source-built artifacts tarball to drop directory.
229
+ - bash : |
230
+ set -ex
231
+ df -h
232
+ mkdir -p "$(dropDirectory)/tarball/"
233
+ cd "$(tarballDirectory)/$(tarballName)"
234
+ find ./artifacts \( \
235
+ -iname 'Private.SourceBuilt.Artifacts*.tar.gz' \) \
236
+ -exec cp {} "$(dropDirectory)/tarball/" \;
237
+ du -h $(rootDirectory) | sort -h | tail -n 50
238
+ displayName: Copy source-built artifacts tarball
239
+ condition: eq(variables['sb.tarball'], true)
240
+ continueOnError: true
241
+
101
242
# Gather artifacts. Uses git bash on Windows.
102
243
- bash : |
103
244
set -ex
@@ -123,11 +264,20 @@ jobs:
123
264
continueOnError: true
124
265
125
266
# Publish artifacts.
126
- - task : PublishBuildArtifacts@1
267
+ - publish : $(logsDirectory)
268
+ artifact : Logs $(artifactName)
127
269
displayName : Publish Logs artifact
128
270
condition : always()
129
271
continueOnError : true
130
- inputs :
131
- PathtoPublish : $(logsDirectory)
132
- ArtifactName : Logs $(artifactName)
133
- ArtifactType : Container
272
+ - publish : $(dropDirectory)/tarball
273
+ artifact : Tarball $(artifactName)
274
+ displayName : Publish Tarball artifact
275
+ condition : eq(variables['sb.tarball'], true)
276
+ continueOnError : true
277
+
278
+ - bash : |
279
+ set -ex
280
+ rm -rf "$(tarballDirectory)" "$(stagingDirectory)" "$(dropDirectory)" "$(logsDirectory)"
281
+ displayName: Cleanup extra staging directories
282
+ condition: always()
283
+ continueOnError: true
0 commit comments