1
1
parameters :
2
- dockerRegistryPassword : ' '
3
- dockerRegistryServer : ' '
4
- dockerRegistryUserName : ' '
5
- matrix : null
6
- name : ci
7
- queueDemands : Agent.OS -equals Linux
8
- queueName : DotNet-Build
9
-
10
- phases :
11
- - phase : ${{ parameters.name }}
2
+ job : null
3
+ matrix :
4
+ Production : {}
5
+ pool :
6
+ name : Hosted Ubuntu 1604
7
+ imageName : null
8
+
9
+ jobs :
10
+ - job : ${{ parameters.job }}
11
+ strategy :
12
+ matrix : ${{ parameters.matrix }}
13
+ pool : ${{ parameters.pool }}
14
+ timeoutInMinutes : 270
12
15
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
16
+ # Prefix to distinguish artifacts from different legs.
17
+ artifactName : ${{ format('$(type) {0}', parameters.job) }}
18
18
# Use ":z" to set selinux flag for sharing in build-owned root dir. https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label
19
19
docker.agentSrc.map : -v $(Build.SourcesDirectory):/agentSrc:z
20
20
docker.agentSrc.work : -w /agentSrc
@@ -26,107 +26,67 @@ phases:
26
26
docker.src.work : -w /src
27
27
docker.tb.map : -v $(rootDirectory)/sb/tarball:/tb:z
28
28
docker.tb.work : -w /tb
29
- dockerRegistry.password : ${{ parameters.dockerRegistryPassword }}
30
- dockerRegistry.server : ${{ parameters.dockerRegistryServer }}
31
- dockerRegistry.userName : ${{ parameters.dockerRegistryUserName }}
32
29
dropDirectory : $(stagingDirectory)/drop
30
+ imageName : ${{ parameters.imageName }}
33
31
rootDirectory : $(Build.SourcesDirectory)/..
34
32
stagingDirectory : $(rootDirectory)/sb/staging
35
33
tarballName : tarball_$(Build.BuildId)
36
- queue :
37
- name : ${{ parameters.queueName }}
38
- demands : ${{ parameters.queueDemands }}
39
- timeoutInMinutes : 240
40
- parallel : 2
41
- matrix : ${{ parameters.matrix }}
34
+ # Default type, can be overridden by matrix legs.
35
+ type : Production
36
+
42
37
steps :
43
38
- 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'], '')
39
+ - template : ../steps/calculate-config-flags-linux.yml
56
40
57
41
# Create working directory and copy source into it.
58
42
- script : |
59
43
set -x
44
+ df -h
60
45
$(docker.run) $(docker.root.map) $(docker.agentSrc.map) $(docker.agentSrc.work) $(imageName) bash -c '
61
46
rm -rf /root/sb/
62
47
mkdir -p /root/sb/tarball
63
48
cp -r . /root/sb/source-build'
64
49
displayName: Clean sb directory and copy source from cloned directory
65
50
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
51
+ - template : ../steps/init-submodules-sh.yml
52
+ parameters :
53
+ commandPrefix : $(docker.run) $(docker.src.map) $(docker.src.work) $(imageName)
81
54
82
55
# Build source-build.
83
56
- script : |
57
+ set -x
58
+ df -h
59
+ if [ "$(sb.tarball)" != "true" ]; then
60
+ failOnBaselineError=true
61
+ fi
84
62
$(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 )
63
+ /p:Configuration=$(sb.configuration) \
64
+ /p:PortableBuild =$(sb.portable ) \
65
+ /p:ArchiveDownloadedPackages =$(sb.tarball ) \
66
+ /p:FailOnPrebuiltBaselineError=$failOnBaselineError \
67
+ /p:ProdConBlobFeedUrlPrefix=$(prodConBlobFeedUrlPrefix )
90
68
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
69
+ timeoutInMinutes: 120
105
70
106
71
# Run smoke tests.
107
72
- script : |
73
+ set -x
74
+ df -h
108
75
$(docker.run) $(docker.src.map) $(docker.src.work) $(imageName) ./build.sh \
109
76
/t:RunSmokeTest \
110
- /p:Configuration=$(buildConfiguration ) \
77
+ /p:Configuration=$(sb.configuration ) \
111
78
/p:ProdConBlobFeedUrlPrefix=$(prodConBlobFeedUrlPrefix)
112
79
displayName: Run smoke-test
113
80
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
-
123
81
# Create tarball.
124
82
- script : |
83
+ set -x
84
+ df -h
125
85
$(docker.run) $(docker.tb.map) $(docker.src.map) $(docker.src.work) $(imageName) ./build-source-tarball.sh \
126
86
"/tb/$(tarballName)" \
127
87
--skip-build
128
88
displayName: Create tarball
129
- condition: and(succeeded(), eq(variables['buildOfflineTarball '], true))
89
+ condition: and(succeeded(), eq(variables['sb.tarball '], true))
130
90
131
91
# tar the tarball directory into the drop directory.
132
92
- script : |
@@ -144,46 +104,68 @@ phases:
144
104
tar --numeric-owner "--exclude=$smokeTestPackages" -zcf "/drop/tarball/$(tarballName).tar.gz" "$(tarballName)"
145
105
tar --numeric-owner -zcf "/drop/tarball/$(tarballName)-smoke-test-prereqs.tar.gz" "$smokeTestPackages"'
146
106
displayName: Copy tarball to output
147
- condition: and(succeeded(), eq(variables['buildOfflineTarball '], true))
107
+ condition: and(succeeded(), eq(variables['sb.tarball '], true))
148
108
149
109
# Build tarball.
150
110
- script : |
151
- $(docker.run) $(docker.tb.map) $(docker.tb.work) --network='none' $(imageName) "$(tarballName)/build.sh" \
152
- /p:Configuration=$(buildConfiguration) \
153
- $(buildLoggingOptions)
111
+ set -x
112
+ df -h
113
+ networkArg=
114
+ if [ "$(sb.tarballOffline)" = "true" ]; then
115
+ networkArg="--network=none"
116
+ fi
117
+ $(docker.run) $(docker.tb.map) $(docker.tb.work) $networkArg $(imageName) "$(tarballName)/build.sh" \
118
+ /p:Configuration=$(sb.configuration) \
119
+ /p:PortableBuild=$(sb.portable) \
120
+ /p:FailOnPrebuiltBaselineError=true
154
121
displayName: Build tarball
155
- timeoutInMinutes: 90
156
- condition: and(succeeded(), eq(variables['buildOfflineTarball '], true))
122
+ timeoutInMinutes: 120
123
+ condition: and(succeeded(), eq(variables['sb.tarball '], true))
157
124
158
125
# Run smoke tests.
159
126
- script : |
127
+ set -x
128
+ df -h
160
129
$(docker.run) $(docker.tb.map) $(docker.tb.work) $(imageName) "$(tarballName)/smoke-test.sh" \
161
130
--minimal \
162
131
--projectOutput \
163
- --configuration $(buildConfiguration ) \
132
+ --configuration $(sb.configuration ) \
164
133
--prodConBlobFeedUrl ''
165
134
displayName: Run smoke-test in tarball
166
- condition: and(succeeded(), eq(variables['buildOfflineTarball '], true))
135
+ condition: and(succeeded(), eq(variables['sb.tarball '], true))
167
136
168
- # Copy all tarball logs to working directory.
137
+ - script : df -h
138
+ displayName : Check space (df -h)
139
+ condition : always()
140
+ continueOnError : true
141
+
142
+ # Copy logs and reports to staging directory.
143
+ - script : |
144
+ set -x
145
+ $(docker.run) $(docker.logs.map) $(docker.src.map) $(docker.src.work) $(imageName) /bin/bash -c "
146
+ mkdir -p /logs/source-build/logs
147
+ find . \( \
148
+ -path './bin/*-report/*' -o \
149
+ -path './bin/msbuild-debug/*' -o \
150
+ -iname '*.binlog' -o \
151
+ -iname '*.log' \) \
152
+ -exec cp {} --parents /logs/source-build/logs \;"
153
+ displayName: Copy source-build logs
154
+ condition: always()
155
+ continueOnError: true
169
156
- script : |
170
157
set -x
171
158
$(docker.run) $(docker.logs.map) $(docker.tb.map) $(docker.tb.work) $(imageName) /bin/bash -c "
172
159
mkdir -p /logs/tarball/logs
173
160
cd \"$(tarballName)\"
174
161
find . \( \
162
+ -path './bin/*-report/*' -o \
163
+ -path './bin/msbuild-debug/*' -o \
175
164
-iname '*.binlog' -o \
176
165
-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 \;"
185
167
displayName: Copy tarball logs
186
- condition: eq(variables['buildOfflineTarball '], true)
168
+ condition: eq(variables['sb.tarball '], true)
187
169
continueOnError: true
188
170
189
171
# Copy artifacts to staging - Copy to VSTS owned folder is done outside of docker so copied files
@@ -201,15 +183,15 @@ phases:
201
183
condition : always()
202
184
continueOnError : true
203
185
inputs :
204
- PathtoPublish : $(dropDirectory) /logs
186
+ PathtoPublish : $(Build.ArtifactStagingDirectory)/drop /logs
205
187
ArtifactName : Logs $(artifactName)
206
188
ArtifactType : Container
207
189
- task : PublishBuildArtifacts@1
208
190
displayName : Publish Tarball artifact
209
- condition : eq(variables['buildOfflineTarball '], true)
191
+ condition : eq(variables['sb.tarball '], true)
210
192
continueOnError : true
211
193
inputs :
212
- PathtoPublish : $(dropDirectory) /tarball
194
+ PathtoPublish : $(Build.ArtifactStagingDirectory)/drop /tarball
213
195
ArtifactName : Tarball $(artifactName)
214
196
ArtifactType : Container
215
197
@@ -220,3 +202,8 @@ phases:
220
202
continueOnError : true
221
203
222
204
- 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