Skip to content

Commit 833dcf4

Browse files
authored
[release/5.0] Add x64 RHEL7 and 8 builds. (#2175)
* Add x64 RHEL7 and 8 builds. * Only clean apt-get when necessary. * Address code review comment. * Add tarball to local CI * Bring forward release/3.1 fix for tarball path. * Use profile and bashrc so we get the right clang and llvm paths.
1 parent 5229695 commit 833dcf4

File tree

6 files changed

+240
-26
lines changed

6 files changed

+240
-26
lines changed

.vsts.pipelines/builds/matrix.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ stages:
5454
name: debian9
5555
jobParameters:
5656
imageName: mcr.microsoft.com/dotnet-buildtools/prereqs:debian-stretch-d61254f-20190807161114
57+
cleanAptGet: true
5758
matrix:
5859
Production: {}
5960
Online: { type: Online }
@@ -86,6 +87,7 @@ stages:
8687
name: ubuntu1804
8788
jobParameters:
8889
imageName: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-source-build-20200401093015-ed32d26
90+
cleanAptGet: true
8991

9092
- template: ../stages/stage-jobs-matrix.yml
9193
parameters:
@@ -98,6 +100,38 @@ stages:
98100
scriptSuffix: .sh
99101
setupMac: true
100102

103+
# RHEL builds only internal
104+
- ${{ if not(eq(variables['System.TeamProject'], 'public')) }}:
105+
- template: ../stages/stage-jobs-matrix.yml
106+
parameters:
107+
jobTemplateName: ../jobs/ci-local.yml
108+
name: rhel7_x64
109+
jobParameters:
110+
pool:
111+
name: DotNet-SourceBuild-Internal
112+
demands:
113+
- Agent.OSArchitecture -equals X64
114+
- rhel -equals 7
115+
scriptPrefix: ./
116+
scriptSuffix: .sh
117+
matrix:
118+
Offline: { type: Offline }
119+
- template: ../stages/stage-jobs-matrix.yml
120+
parameters:
121+
jobTemplateName: ../jobs/ci-local.yml
122+
name: rhel8_x64
123+
jobParameters:
124+
pool:
125+
name: DotNet-SourceBuild-Internal
126+
demands:
127+
- Agent.OSArchitecture -equals X64
128+
- rhel -equals 8
129+
scriptPrefix: ./
130+
scriptSuffix: .sh
131+
useSystemLibunwind: true
132+
matrix:
133+
Offline: { type: Offline }
134+
101135
# Prepare artifacts in all situations but public PR validation.
102136
- ${{ if not(and(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest'))) }}:
103137
- template: ../stages/prepare-artifacts.yml
@@ -108,4 +142,6 @@ stages:
108142
- job: centos8_Offline
109143
- job: debian9_Online
110144
- job: fedora31_Offline
145+
- job: rhel7_x64_Offline
146+
- job: rhel8_x64_Offline
111147
gatherPortableJob: centos71_Offline_Portable

.vsts.pipelines/jobs/ci-linux.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ parameters:
66
reportPrebuiltLeaks: false
77
generatePrebuiltBurndown: false
88
runUnitTests: false
9+
cleanAptGet: false
910

1011
jobs:
1112
- job: ${{ parameters.job }}
@@ -52,6 +53,8 @@ jobs:
5253
5354
steps:
5455
- template: ../steps/cleanup-unneeded-files.yml
56+
parameters:
57+
cleanAptGet: ${{ parameters.cleanAptGet }}
5558
- template: ../steps/docker-cleanup-linux.yml
5659
- template: ../steps/calculate-config-flags.yml
5760

.vsts.pipelines/jobs/ci-linux_bootstrap.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ parameters:
33
pool:
44
name: Hosted Ubuntu 1604
55
imageName: null
6+
cleanAptGet: false
67

78
jobs:
89
- job: ${{ parameters.job }}
@@ -30,6 +31,8 @@ jobs:
3031

3132
steps:
3233
- template: ../steps/cleanup-unneeded-files.yml
34+
parameters:
35+
cleanAptGet: ${{ parameters.cleanAptGet }}
3336
- template: ../steps/docker-cleanup-linux.yml
3437

3538
- task: DownloadBuildArtifacts@0

.vsts.pipelines/jobs/ci-local.yml

Lines changed: 173 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,52 @@
11
parameters:
22
job: null
3-
matrix:
4-
Production: {}
53
pool: null
64
scriptPrefix: null
75
scriptSuffix: null
86
setupMac: false
97
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
139
failOnPrebuiltBaselineError: true
10+
reportPrebuiltLeaks: false
11+
generatePrebuiltBurndown: false
12+
runUnitTests: false
13+
cleanAptGet: false
1414

1515
jobs:
1616
- job: ${{ parameters.job }}
17-
strategy:
18-
matrix: ${{ parameters.matrix }}
1917
pool: ${{ parameters.pool }}
20-
timeoutInMinutes: 240
18+
timeoutInMinutes: 300
2119
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)
2226
args.build: >-
2327
/p:Configuration=$(sb.configuration)
2428
/p:BuildPortableRuntime=$(sb.portable)
2529
/p:BuildPortableSdk=$(sb.portable)
2630
/p:FailOnPrebuiltBaselineError=$(failOnPrebuiltBaselineError)
2731
/p:ProdConBlobFeedUrlPrefix=$(prodConBlobFeedUrlPrefix)
2832
/p:AzDoPat=$(dn-bot-all-orgs-build-rw-code-rw)
33+
/p:ArchiveDownloadedPackages=$(sb.tarball)
2934
$(tarballDownloadArgs)
3035
args.smokeTest: >
3136
--run-smoke-test
3237
/p:Configuration=$(sb.configuration)
3338
/p:ProdConBlobFeedUrlPrefix=$(prodConBlobFeedUrlPrefix)
3439
# Prefix to distinguish artifacts from different legs.
35-
artifactName: ${{ format('{0} $(type)', parameters.job) }}
40+
artifactName: ${{ parameters.job }}
3641
failOnPrebuiltBaselineError: ${{ parameters.failOnPrebuiltBaselineError }}
37-
logsDirectory: $(Build.ArtifactStagingDirectory)/logs
42+
reportPrebuiltLeaks: ${{ parameters.reportPrebuiltLeaks }}
43+
systemLibunwind: ${{ parameters.systemLibunwind }}
3844
tarballDownloadArgs: >-
39-
/p:SkipDownloadingReferencePackages=true
40-
/p:SkipDownloadingPreviouslySourceBuiltPackages=true
45+
/p:DownloadSourceBuildReferencePackagesTimeoutSeconds=600
46+
/p:DownloadSourceBuiltArtifactsTimeoutSeconds=1500
4147
SOURCE_BUILD_SKIP_SUBMODULE_CHECK: true
4248
# Default type, can be overridden by matrix legs.
43-
type: Production
49+
type: ${{ coalesce(parameters.type, 'Production') }}
4450

4551
${{ if not(and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'))) }}:
4652
SetInternalPackageFeedPatBashCommand: ''
@@ -56,6 +62,9 @@ jobs:
5662
clean: true
5763

5864
- template: ../steps/cleanup-unneeded-files.yml
65+
parameters:
66+
cleanAptGet: ${{ parameters.cleanAptGet }}
67+
- template: ../steps/calculate-config-flags.yml
5968

6069
# Make sure submodules from other branches are removed: pass extra f.
6170
- script: git clean -xdff
@@ -79,11 +88,18 @@ jobs:
7988
- template: ../steps/check-space-powershell.yml
8089

8190
# 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
87103
displayName: Build source-build
88104
timeoutInMinutes: 150
89105

@@ -98,6 +114,131 @@ jobs:
98114
${{ format('{0}build{1} $(args.smokeTest)', parameters.scriptPrefix, parameters.scriptSuffix) }}
99115
displayName: Run smoke-test
100116
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+
101242
# Gather artifacts. Uses git bash on Windows.
102243
- bash: |
103244
set -ex
@@ -123,11 +264,20 @@ jobs:
123264
continueOnError: true
124265
125266
# Publish artifacts.
126-
- task: PublishBuildArtifacts@1
267+
- publish: $(logsDirectory)
268+
artifact: Logs $(artifactName)
127269
displayName: Publish Logs artifact
128270
condition: always()
129271
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

.vsts.pipelines/steps/cleanup-unneeded-files.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
# Delete some files from the default image since we're tight on disk space.
22
# List is from https://github.com/microsoft/azure-pipelines-image-generation/pull/1231#issuecomment-537174621
3+
parameters:
4+
- name: cleanAptGet
5+
type: boolean
6+
default: false
37

48
steps:
59
- script: sudo apt-get clean
610
displayName: Clean apt-get cache
7-
condition: ne(variables['Agent.OS'], 'Darwin')
11+
condition: ${{ eq(parameters.cleanAptGet, true) }}
812
continueOnError: true
913

1014
- script: sudo rm -rf /usr/local/lib/android

0 commit comments

Comments
 (0)