Skip to content

Commit fc82cc4

Browse files
authored
Add Azure DevOps dnceng instance CI YAML (#813)
* Add Azure DevOps dnceng instance CI YAML CentOS, Ubuntu 16.04, and OSX legs included. * Include matrix directly from param, not insert * Use ' ', not '_', in artifact name Make separator consistent between phase name and artifact name.
1 parent 8982c16 commit fc82cc4

File tree

9 files changed

+298
-122
lines changed

9 files changed

+298
-122
lines changed

.vsts.pipelines/builds/ci.yml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
1+
# Matrix build types:
2+
# Production: Only runs the build, not a tarball build. Called "production" because it's the part
3+
# used to produce tarballs. Some platforms might not be capable of producing a tarball yet: we
4+
# still call this type of build "production" for consistency.
5+
# Online: The leg produces a tarball then builds it while connected to the internet.
6+
# Offline: The leg produces a tarball then builds it offline. Network disconnected using Docker.
7+
18
phases:
29
- template: ../phases/ci-linux.yml
310
parameters:
4-
name: ci_Docker
11+
phase: centos71
12+
imageName: microsoft/dotnet-buildtools-prereqs:centos-7-b46d863-20180719033416
513
matrix:
6-
centos71-unshared:
7-
artifactName: ci_Docker_centos71-unshared
8-
buildOfflineTarball: true
9-
imageName: microsoft/dotnet-buildtools-prereqs:centos711503_prereqs_2
14+
Production: {}
15+
Online: { type: Online }
16+
Online Portable: { type: Online Portable }
17+
Offline: { type: Offline }
18+
Offline Portable: { type: Offline Portable }
19+
1020
- template: ../phases/ci-linux.yml
1121
parameters:
12-
name: ci_Docker_RHEL_host
13-
dockerRegistryPassword: $(BotAccount-dotnet-docker-acr-bot-password)
14-
dockerRegistryServer: $(acr.server)
15-
dockerRegistryUserName: $(acr.userName)
16-
queueName: DotNetCore-Infra
17-
queueDemands: VSTS_OS -equals Linux_RHEL_7.4
18-
matrix:
19-
rhel7.5:
20-
artifactName: ci_Docker_RHEL_host_rhel7.5
21-
imageName: dotnetdocker.azurecr.io/dotnet-buildtools-prereqs:rhel-7.5-b4560f6-20180725153037
22+
phase: ubuntu1604
23+
imageName: microsoft/dotnet-buildtools-prereqs:ubuntu-16.04-c103199-20180628134544
24+
25+
- template: ../phases/ci-osx.yml

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

Lines changed: 83 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
parameters:
2-
dockerRegistryPassword: ''
3-
dockerRegistryServer: ''
4-
dockerRegistryUserName: ''
5-
matrix: null
6-
name: ci
7-
queueDemands: Agent.OS -equals Linux
8-
queueName: DotNet-Build
2+
imageName: null
3+
matrix:
4+
Production: {}
5+
phase: null
6+
queueDemands: docker
7+
queueName: dnceng-linux-external-temp
98

109
phases:
11-
- phase: ${{ parameters.name }}
10+
- phase: ${{ parameters.phase }}
1211
variables:
13-
# Prefix to distinguish artifacts from different legs. No documented variable for this exists.
14-
artifactName: no_artifact_name
15-
buildLoggingOptions: ''
16-
buildConfiguration: Release
17-
buildOfflineTarball: false
12+
# Prefix to distinguish artifacts from different legs.
13+
artifactName: ${{ format('$(type) {0}', parameters.phase) }}
1814
# Use ":z" to set selinux flag for sharing in build-owned root dir. https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label
1915
docker.agentSrc.map: -v $(Build.SourcesDirectory):/agentSrc:z
2016
docker.agentSrc.work: -w /agentSrc
@@ -26,107 +22,73 @@ phases:
2622
docker.src.work: -w /src
2723
docker.tb.map: -v $(rootDirectory)/sb/tarball:/tb:z
2824
docker.tb.work: -w /tb
29-
dockerRegistry.password: ${{ parameters.dockerRegistryPassword }}
30-
dockerRegistry.server: ${{ parameters.dockerRegistryServer }}
31-
dockerRegistry.userName: ${{ parameters.dockerRegistryUserName }}
3225
dropDirectory: $(stagingDirectory)/drop
26+
imageName: ${{ parameters.imageName }}
3327
rootDirectory: $(Build.SourcesDirectory)/..
3428
stagingDirectory: $(rootDirectory)/sb/staging
3529
tarballName: tarball_$(Build.BuildId)
30+
# Default type, can be overridden by matrix legs.
31+
type: Production
3632
queue:
3733
name: ${{ parameters.queueName }}
3834
demands: ${{ parameters.queueDemands }}
39-
timeoutInMinutes: 240
40-
parallel: 2
35+
timeoutInMinutes: 270
36+
parallel: 8
4137
matrix: ${{ parameters.matrix }}
38+
4239
steps:
4340
- template: ../steps/docker-cleanup-linux.yml
44-
45-
# Docker registry login and pull, if one is defined.
46-
- script: |
47-
docker login -u $(dockerRegistry.userName) -p $(dockerRegistry.password) $(dockerRegistry.server)
48-
docker pull $(imageName)
49-
displayName: Docker login and image pull
50-
condition: and(succeeded(), ne(variables['dockerRegistry.server'], ''))
51-
52-
# Docker registry logout, if one is defined. Do this immediately: avoid unnecessary login time.
53-
- script: docker logout $(dockerRegistry.server)
54-
displayName: Docker logout
55-
condition: ne(variables['dockerRegistry.server'], '')
41+
- template: ../steps/calculate-config-flags-linux.yml
5642

5743
# Create working directory and copy source into it.
5844
- script: |
5945
set -x
46+
df -h
6047
$(docker.run) $(docker.root.map) $(docker.agentSrc.map) $(docker.agentSrc.work) $(imageName) bash -c '
6148
rm -rf /root/sb/
6249
mkdir -p /root/sb/tarball
6350
cp -r . /root/sb/source-build'
6451
displayName: Clean sb directory and copy source from cloned directory
6552
66-
# Fetch vsts commits if building internally.
67-
- script: |
68-
set -x
69-
# Ignore failure for the first command. It will intentionally fail if the commit is only
70-
# available in VSTS. "submodule update --init" is the simplest way to set up the submodule
71-
# directory. ("submodule init" only sets up .git/config, not the e.g. src/coreclr/.git and
72-
# .git/modules/src/coreclr/ directories.)
73-
$(docker.run) $(docker.src.map) $(docker.src.work) $(imageName) git submodule update --init --recursive
74-
$(docker.run) $(docker.src.map) $(docker.src.work) $(imageName) ./fetch-vsts-commits.sh $(user.PAT)
75-
displayName: Fetch internal vsts commits
76-
condition: and(succeeded(), ne(variables['user.PAT'], ''))
77-
78-
# Initialize submodules.
79-
- script: $(docker.run) $(docker.src.map) $(docker.src.work) $(imageName) git submodule update --init --recursive
80-
displayName: Initialize submodules
53+
- template: ../steps/init-submodules-sh.yml
54+
parameters:
55+
commandPrefix: $(docker.run) $(docker.src.map) $(docker.src.work) $(imageName)
8156

8257
# Build source-build.
8358
- script: |
59+
set -x
60+
df -h
61+
if [ "$(sb.tarball)" != "true" ]; then
62+
failOnBaselineError=true
63+
fi
8464
$(docker.run) $(docker.src.map) $(docker.src.work) $(imageName) ./build.sh \
85-
/p:ArchiveDownloadedPackages=true \
86-
/p:Configuration=$(buildConfiguration) \
87-
/p:ContinueOnPrebuiltBaselineError=$(buildOfflineTarball) \
88-
/p:ProdConBlobFeedUrlPrefix=$(prodConBlobFeedUrlPrefix) \
89-
$(buildLoggingOptions)
65+
/p:Configuration=$(sb.configuration) \
66+
/p:PortableBuild=$(sb.portable) \
67+
/p:ArchiveDownloadedPackages=$(sb.tarball) \
68+
/p:FailOnPrebuiltBaselineError=$failOnBaselineError \
69+
/p:ProdConBlobFeedUrlPrefix=$(prodConBlobFeedUrlPrefix)
9070
displayName: Build source-build
91-
timeoutInMinutes: 90
92-
93-
# Copy logs to working directory.
94-
- script: |
95-
set -x
96-
$(docker.run) $(docker.logs.map) $(docker.src.map) $(docker.src.work) $(imageName) /bin/bash -c "
97-
mkdir -p /logs/source-build/logs
98-
find . \( \
99-
-iname '*.binlog' -o \
100-
-iname '*.log' \) \
101-
-exec cp {} --parents /logs/source-build/logs \;"
102-
displayName: Copy source-build logs
103-
condition: always()
104-
continueOnError: true
71+
timeoutInMinutes: 120
10572
10673
# Run smoke tests.
10774
- script: |
75+
set -x
76+
df -h
10877
$(docker.run) $(docker.src.map) $(docker.src.work) $(imageName) ./build.sh \
10978
/t:RunSmokeTest \
110-
/p:Configuration=$(buildConfiguration) \
79+
/p:Configuration=$(sb.configuration) \
11180
/p:ProdConBlobFeedUrlPrefix=$(prodConBlobFeedUrlPrefix)
11281
displayName: Run smoke-test
11382
114-
# Copy smoke test logs to working directory.
115-
- script: |
116-
$(docker.run) $(docker.logs.map) $(docker.src.map) $(docker.src.work) $(imageName) /bin/bash -c "
117-
mkdir -p /logs/source-build/smoke-test
118-
find ./testing-smoke -name '*.log' -exec cp {} /logs/source-build/smoke-test \;"
119-
displayName: Copy smoke-test logs
120-
condition: always()
121-
continueOnError: true
122-
12383
# Create tarball.
12484
- script: |
85+
set -x
86+
df -h
12587
$(docker.run) $(docker.tb.map) $(docker.src.map) $(docker.src.work) $(imageName) ./build-source-tarball.sh \
12688
"/tb/$(tarballName)" \
12789
--skip-build
12890
displayName: Create tarball
129-
condition: and(succeeded(), eq(variables['buildOfflineTarball'], true))
91+
condition: and(succeeded(), eq(variables['sb.tarball'], true))
13092
13193
# tar the tarball directory into the drop directory.
13294
- script: |
@@ -144,46 +106,66 @@ phases:
144106
tar --numeric-owner "--exclude=$smokeTestPackages" -zcf "/drop/tarball/$(tarballName).tar.gz" "$(tarballName)"
145107
tar --numeric-owner -zcf "/drop/tarball/$(tarballName)-smoke-test-prereqs.tar.gz" "$smokeTestPackages"'
146108
displayName: Copy tarball to output
147-
condition: and(succeeded(), eq(variables['buildOfflineTarball'], true))
109+
condition: and(succeeded(), eq(variables['sb.tarball'], true))
148110
149111
# Build tarball.
150112
- script: |
151-
$(docker.run) $(docker.tb.map) $(docker.tb.work) --network='none' $(imageName) "$(tarballName)/build.sh" \
152-
/p:Configuration=$(buildConfiguration) \
153-
$(buildLoggingOptions)
113+
set -x
114+
df -h
115+
networkArg=
116+
if [ "$(sb.tarballOffline)" = "true" ]; then
117+
networkArg="--network=none"
118+
fi
119+
$(docker.run) $(docker.tb.map) $(docker.tb.work) $networkArg $(imageName) "$(tarballName)/build.sh" \
120+
/p:Configuration=$(sb.configuration) \
121+
/p:PortableBuild=$(sb.portable) \
122+
/p:FailOnPrebuiltBaselineError=true
154123
displayName: Build tarball
155-
timeoutInMinutes: 90
156-
condition: and(succeeded(), eq(variables['buildOfflineTarball'], true))
124+
timeoutInMinutes: 120
125+
condition: and(succeeded(), eq(variables['sb.tarball'], true))
157126
158127
# Run smoke tests.
159128
- script: |
129+
set -x
130+
df -h
160131
$(docker.run) $(docker.tb.map) $(docker.tb.work) $(imageName) "$(tarballName)/smoke-test.sh" \
161132
--minimal \
162133
--projectOutput \
163-
--configuration $(buildConfiguration) \
134+
--configuration $(sb.configuration) \
164135
--prodConBlobFeedUrl ''
165136
displayName: Run smoke-test in tarball
166-
condition: and(succeeded(), eq(variables['buildOfflineTarball'], true))
137+
condition: and(succeeded(), eq(variables['sb.tarball'], true))
138+
139+
- script: df -h
140+
displayName: Check space (df -h)
141+
condition: always()
142+
continueOnError: true
167143

168-
# Copy all tarball logs to working directory.
144+
# Copy logs and reports to staging directory.
145+
- script: |
146+
set -x
147+
$(docker.run) $(docker.logs.map) $(docker.src.map) $(docker.src.work) $(imageName) /bin/bash -c "
148+
mkdir -p /logs/source-build/logs
149+
find . \( \
150+
-path './bin/*-report/*' -o \
151+
-iname '*.binlog' -o \
152+
-iname '*.log' \) \
153+
-exec cp {} --parents /logs/source-build/logs \;"
154+
displayName: Copy source-build logs
155+
condition: always()
156+
continueOnError: true
169157
- script: |
170158
set -x
171159
$(docker.run) $(docker.logs.map) $(docker.tb.map) $(docker.tb.work) $(imageName) /bin/bash -c "
172160
mkdir -p /logs/tarball/logs
173161
cd \"$(tarballName)\"
174162
find . \( \
163+
-path './bin/*-report/*' -o \
175164
-iname '*.binlog' -o \
176165
-iname '*.log' \) \
177-
-exec cp {} --parents /logs/tarball/logs \;
178-
# Copy offline prebuilt report
179-
mkdir -p /logs/prebuilt-report/offline
180-
cp -r ./bin/prebuilt-report/* /logs/prebuilt-report/offline"
181-
$(docker.run) $(docker.logs.map) $(docker.src.map) $(docker.src.work) $(imageName) /bin/bash -c "
182-
# Copy online prebuilt report
183-
mkdir -p /logs/prebuilt-report/online
184-
cp -r ./bin/prebuilt-report/* /logs/prebuilt-report/online"
166+
-exec cp {} --parents /logs/tarball/logs \;"
185167
displayName: Copy tarball logs
186-
condition: eq(variables['buildOfflineTarball'], true)
168+
condition: eq(variables['sb.tarball'], true)
187169
continueOnError: true
188170
189171
# Copy artifacts to staging - Copy to VSTS owned folder is done outside of docker so copied files
@@ -201,15 +183,15 @@ phases:
201183
condition: always()
202184
continueOnError: true
203185
inputs:
204-
PathtoPublish: $(dropDirectory)/logs
186+
PathtoPublish: $(Build.ArtifactStagingDirectory)/drop/logs
205187
ArtifactName: Logs $(artifactName)
206188
ArtifactType: Container
207189
- task: PublishBuildArtifacts@1
208190
displayName: Publish Tarball artifact
209-
condition: eq(variables['buildOfflineTarball'], true)
191+
condition: eq(variables['sb.tarball'], true)
210192
continueOnError: true
211193
inputs:
212-
PathtoPublish: $(dropDirectory)/tarball
194+
PathtoPublish: $(Build.ArtifactStagingDirectory)/drop/tarball
213195
ArtifactName: Tarball $(artifactName)
214196
ArtifactType: Container
215197

@@ -220,3 +202,8 @@ phases:
220202
continueOnError: true
221203

222204
- template: ../steps/docker-cleanup-linux.yml
205+
206+
- script: df -h
207+
displayName: Check space (df -h)
208+
condition: always()
209+
continueOnError: true

0 commit comments

Comments
 (0)