|
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 | 8 | skipSmokeTest: false
|
11 | 9 | failOnPrebuiltBaselineError: true
|
| 10 | + reportPrebuiltLeaks: false |
| 11 | + generatePrebuiltBurndown: false |
| 12 | + runUnitTests: false |
| 13 | + cleanAptGet: false |
12 | 14 |
|
13 | 15 | jobs:
|
14 | 16 | - job: ${{ parameters.job }}
|
15 |
| - strategy: |
16 |
| - matrix: ${{ parameters.matrix }} |
17 | 17 | pool: ${{ parameters.pool }}
|
18 |
| - timeoutInMinutes: 240 |
| 18 | + timeoutInMinutes: 300 |
19 | 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) |
20 | 26 | args.build: >-
|
21 | 27 | /p:Configuration=$(sb.configuration)
|
22 | 28 | /p:PortableBuild=$(sb.portable)
|
23 | 29 | /p:FailOnPrebuiltBaselineError=$(failOnPrebuiltBaselineError)
|
24 | 30 | /p:ProdConBlobFeedUrlPrefix=$(prodConBlobFeedUrlPrefix)
|
25 | 31 | /p:AzDoPat=$(System.AccessToken)
|
| 32 | + /p:ArchiveDownloadedPackages=$(sb.tarball) |
26 | 33 | $(tarballDownloadArgs)
|
27 | 34 | args.smokeTest: >
|
28 | 35 | --run-smoke-test
|
29 | 36 | /p:Configuration=$(sb.configuration)
|
30 | 37 | /p:ProdConBlobFeedUrlPrefix=$(prodConBlobFeedUrlPrefix)
|
31 | 38 | # Prefix to distinguish artifacts from different legs.
|
32 |
| - artifactName: ${{ format('{0} $(type)', parameters.job) }} |
| 39 | + artifactName: ${{ parameters.job }} |
33 | 40 | failOnPrebuiltBaselineError: ${{ parameters.failOnPrebuiltBaselineError }}
|
34 |
| - logsDirectory: $(Build.ArtifactStagingDirectory)/logs |
| 41 | + reportPrebuiltLeaks: ${{ parameters.reportPrebuiltLeaks }} |
| 42 | + systemLibunwind: ${{ parameters.systemLibunwind }} |
35 | 43 | tarballDownloadArgs: >-
|
36 |
| - /p:SkipDownloadingReferencePackages=true |
37 |
| - /p:SkipDownloadingPreviouslySourceBuiltPackages=true |
| 44 | + /p:DownloadSourceBuildReferencePackagesTimeoutSeconds=600 |
| 45 | + /p:DownloadSourceBuiltArtifactsTimeoutSeconds=1500 |
38 | 46 | SOURCE_BUILD_SKIP_SUBMODULE_CHECK: true
|
39 | 47 | # Default type, can be overridden by matrix legs.
|
40 |
| - type: Production |
| 48 | + type: ${{ coalesce(parameters.type, 'Production') }} |
41 | 49 |
|
42 | 50 | ${{ if not(and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'))) }}:
|
43 | 51 | SetInternalPackageFeedPatBashCommand: ''
|
|
53 | 61 | clean: true
|
54 | 62 |
|
55 | 63 | - template: ../steps/cleanup-unneeded-files.yml
|
| 64 | + parameters: |
| 65 | + cleanAptGet: ${{ parameters.cleanAptGet }} |
| 66 | + - template: ../steps/calculate-config-flags.yml |
56 | 67 |
|
57 | 68 | # Make sure submodules from other branches are removed: pass extra f.
|
58 | 69 | - script: git clean -xdff
|
@@ -95,6 +106,125 @@ jobs:
|
95 | 106 | ${{ format('{0}build{1} $(args.smokeTest)', parameters.scriptPrefix, parameters.scriptSuffix) }}
|
96 | 107 | displayName: Run smoke-test
|
97 | 108 |
|
| 109 | + # Create tarball. |
| 110 | + - script: | |
| 111 | + set -ex |
| 112 | + df -h |
| 113 | + args="--skip-prebuilt-check --skip-build --minimize-disk-usage" |
| 114 | + if [ "$(reportPrebuiltLeaks)" = "true" ]; then |
| 115 | + args="$args --enable-leak-detection" |
| 116 | + fi |
| 117 | + ./build-source-tarball.sh \ |
| 118 | + "$(tarballDirectory)/$(tarballName)" \ |
| 119 | + $args |
| 120 | + du -h $(rootDirectory) | sort -h | tail -n 50 |
| 121 | + displayName: Create tarball |
| 122 | + condition: and(succeeded(), eq(variables['sb.tarball'], true)) |
| 123 | +
|
| 124 | + # Copy logs from the production build |
| 125 | + - bash: | |
| 126 | + set -ex |
| 127 | + df -h |
| 128 | + mkdir -p "$(logsDirectory)" |
| 129 | + find . \( \ |
| 130 | + -path './artifacts/*-report/*' -o \ |
| 131 | + -path './artifacts/msbuild-debug/*' -o \ |
| 132 | + -path './artifacts/roslyn-debug/*' -o \ |
| 133 | + -path './artifacts/aspnet-debug/*' -o \ |
| 134 | + -iname '*.binlog' -o \ |
| 135 | + -iname '*.log' \) \ |
| 136 | + -exec cp {} --parents "$(logsDirectory)" \; |
| 137 | + du -h $(rootDirectory) | sort -h | tail -n 50 |
| 138 | + displayName: Copy source-build production build logs |
| 139 | + condition: always() |
| 140 | + continueOnError: true |
| 141 | +
|
| 142 | + # Delete key directories from local copy of repo to save space |
| 143 | + - bash: | |
| 144 | + set -ex |
| 145 | + df -h |
| 146 | + sudo rm -rf $(rootDirectory)/source-build/artifacts/src |
| 147 | + sudo rm -rf $(rootDirectory)/source-build/artifacts/obj |
| 148 | + sudo rm -rf $(rootDirectory)/source-build/.git |
| 149 | + sudo rm -rf $(rootDirectory)/source-build/packages |
| 150 | + du -h $(rootDirectory) | sort -h | tail -n 50 |
| 151 | + displayName: Delete key directories from source copy of repo to save space |
| 152 | +
|
| 153 | + # tar the tarball directory into the drop directory. |
| 154 | + - bash: | |
| 155 | + set -ex |
| 156 | + df -h |
| 157 | + mkdir -p $(dropDirectory)/tarball/ |
| 158 | + smokeTestPackages="$(tarballDirectory)/$(tarballName)/packages/smoke-test-packages" |
| 159 | + # smokeTestPackages is a package cache, with redundant data and unnecessary structure. E.g. |
| 160 | + # $smokeTestPackages/name/version/name.version.nupkg <- We want this. |
| 161 | + # $smokeTestPackages/name/version/lib/net46/name.dll <- This is already in the nupkg. |
| 162 | + # This find moves the nupkg files into $smokeTestPackages: |
| 163 | + find "$smokeTestPackages" -iname "*.nupkg" -exec mv {} "$smokeTestPackages" \; |
| 164 | + # This find removes all non-nupkg files, which are not wanted: |
| 165 | + find "$smokeTestPackages" -mindepth 1 -not -iname "*.nupkg" -delete |
| 166 | + # Make one .tar.gz for build, another for extras necessary to smoke test: |
| 167 | + tar --numeric-owner "--exclude=$smokeTestPackages" -zcf "$(dropDirectory)/tarball/$(tarballName).tar.gz" -C "$(tarballDirectory)" "$(tarballDirectory)/$(tarballName)" |
| 168 | + tar --numeric-owner -zcf "$(dropDirectory)/tarball/$(tarballName)-smoke-test-prereqs.tar.gz" "$smokeTestPackages" |
| 169 | + du -h $(rootDirectory) | sort -h | tail -n 50 |
| 170 | + displayName: Copy tarball to output |
| 171 | + condition: and(succeeded(), eq(variables['sb.tarball'], true)) |
| 172 | +
|
| 173 | + # Build tarball. |
| 174 | + - script: | |
| 175 | + set -ex |
| 176 | + df -h |
| 177 | + networkArg= |
| 178 | + if [ "$(sb.tarballOffline)" = "true" ]; then |
| 179 | + networkArg="sudo unshare -n" |
| 180 | + fi |
| 181 | + poisonArg= |
| 182 | + if [ "$(reportPrebuiltLeaks)" = "true" ]; then |
| 183 | + poisonArg="/p:EnablePoison=true" |
| 184 | + fi |
| 185 | + $networkArg "$(tarballDirectory)/$(tarballName)/build.sh" -- \ |
| 186 | + /p:Configuration=$(sb.configuration) \ |
| 187 | + /p:PortableBuild=$(sb.portable) \ |
| 188 | + /p:UseSystemLibunwind=$(systemLibunwind) \ |
| 189 | + /p:FailOnPrebuiltBaselineError=true \ |
| 190 | + $poisonArg |
| 191 | + du -h $(rootDirectory) | sort -h | tail -n 50 |
| 192 | + displayName: Build tarball |
| 193 | + timeoutInMinutes: 150 |
| 194 | + condition: and(succeeded(), eq(variables['sb.tarball'], true)) |
| 195 | +
|
| 196 | + # Run smoke tests. |
| 197 | + - script: | |
| 198 | + set -ex |
| 199 | + df -h |
| 200 | + sudo chown -R "$(id -u):$(id -g)" "$(tarballDirectory)/$(tarballName)" |
| 201 | + "$(tarballDirectory)/$(tarballName)/smoke-test.sh" \ |
| 202 | + --minimal \ |
| 203 | + --projectOutput \ |
| 204 | + --configuration $(sb.configuration) |
| 205 | + du -h $(rootDirectory) | sort -h | tail -n 50 |
| 206 | + displayName: Run smoke-test in tarball |
| 207 | + condition: and(succeeded(), eq(variables['sb.tarball'], true)) |
| 208 | +
|
| 209 | + - script: df -h |
| 210 | + displayName: Check space (df -h) |
| 211 | + condition: always() |
| 212 | + continueOnError: true |
| 213 | + |
| 214 | + # Copy source-built artifacts tarball to drop directory. |
| 215 | + - bash: | |
| 216 | + set -ex |
| 217 | + df -h |
| 218 | + mkdir -p "$(dropDirectory)/tarball/" |
| 219 | + cd "$(tarballDirectory)/$(tarballName)" |
| 220 | + find ./artifacts \( \ |
| 221 | + -iname 'Private.SourceBuilt.Artifacts*.tar.gz' \) \ |
| 222 | + -exec cp {} "$(dropDirectory)/tarball/" \; |
| 223 | + du -h $(rootDirectory) | sort -h | tail -n 50 |
| 224 | + displayName: Copy source-built artifacts tarball |
| 225 | + condition: eq(variables['sb.tarball'], true) |
| 226 | + continueOnError: true |
| 227 | +
|
98 | 228 | # Gather artifacts. Uses git bash on Windows.
|
99 | 229 | - bash: |
|
100 | 230 | set -ex
|
@@ -128,3 +258,18 @@ jobs:
|
128 | 258 | PathtoPublish: $(logsDirectory)
|
129 | 259 | ArtifactName: Logs $(artifactName)
|
130 | 260 | ArtifactType: Container
|
| 261 | + - task: PublishBuildArtifacts@1 |
| 262 | + displayName: Publish Tarball artifact |
| 263 | + condition: eq(variables['sb.tarball'], true) |
| 264 | + continueOnError: true |
| 265 | + inputs: |
| 266 | + PathtoPublish: $(dropDirectory)/tarball |
| 267 | + ArtifactName: Tarball $(artifactName) |
| 268 | + ArtifactType: Container |
| 269 | + |
| 270 | + - bash: | |
| 271 | + set -ex |
| 272 | + rm -rf "$(tarballDirectory)" "$(stagingDirectory)" "$(dropDirectory)" "$(logsDirectory)" |
| 273 | + displayName: Cleanup extra staging directories |
| 274 | + condition: always() |
| 275 | + continueOnError: true |
0 commit comments