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
2
+ imageName : null
3
+ matrix :
4
+ Production : {}
5
+ phase : null
6
+ queueDemands : docker
7
+ queueName : dnceng-linux-external-temp
9
8
10
9
phases :
11
- - phase : ${{ parameters.name }}
10
+ - phase : ${{ parameters.phase }}
12
11
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) }}
18
14
# 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
15
docker.agentSrc.map : -v $(Build.SourcesDirectory):/agentSrc:z
20
16
docker.agentSrc.work : -w /agentSrc
@@ -26,107 +22,73 @@ phases:
26
22
docker.src.work : -w /src
27
23
docker.tb.map : -v $(rootDirectory)/sb/tarball:/tb:z
28
24
docker.tb.work : -w /tb
29
- dockerRegistry.password : ${{ parameters.dockerRegistryPassword }}
30
- dockerRegistry.server : ${{ parameters.dockerRegistryServer }}
31
- dockerRegistry.userName : ${{ parameters.dockerRegistryUserName }}
32
25
dropDirectory : $(stagingDirectory)/drop
26
+ imageName : ${{ parameters.imageName }}
33
27
rootDirectory : $(Build.SourcesDirectory)/..
34
28
stagingDirectory : $(rootDirectory)/sb/staging
35
29
tarballName : tarball_$(Build.BuildId)
30
+ # Default type, can be overridden by matrix legs.
31
+ type : Production
36
32
queue :
37
33
name : ${{ parameters.queueName }}
38
34
demands : ${{ parameters.queueDemands }}
39
- timeoutInMinutes : 240
40
- parallel : 2
35
+ timeoutInMinutes : 270
36
+ parallel : 8
41
37
matrix : ${{ parameters.matrix }}
38
+
42
39
steps :
43
40
- 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
56
42
57
43
# Create working directory and copy source into it.
58
44
- script : |
59
45
set -x
46
+ df -h
60
47
$(docker.run) $(docker.root.map) $(docker.agentSrc.map) $(docker.agentSrc.work) $(imageName) bash -c '
61
48
rm -rf /root/sb/
62
49
mkdir -p /root/sb/tarball
63
50
cp -r . /root/sb/source-build'
64
51
displayName: Clean sb directory and copy source from cloned directory
65
52
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)
81
56
82
57
# Build source-build.
83
58
- script : |
59
+ set -x
60
+ df -h
61
+ if [ "$(sb.tarball)" != "true" ]; then
62
+ failOnBaselineError=true
63
+ fi
84
64
$(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 )
90
70
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
105
72
106
73
# Run smoke tests.
107
74
- script : |
75
+ set -x
76
+ df -h
108
77
$(docker.run) $(docker.src.map) $(docker.src.work) $(imageName) ./build.sh \
109
78
/t:RunSmokeTest \
110
- /p:Configuration=$(buildConfiguration ) \
79
+ /p:Configuration=$(sb.configuration ) \
111
80
/p:ProdConBlobFeedUrlPrefix=$(prodConBlobFeedUrlPrefix)
112
81
displayName: Run smoke-test
113
82
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
83
# Create tarball.
124
84
- script : |
85
+ set -x
86
+ df -h
125
87
$(docker.run) $(docker.tb.map) $(docker.src.map) $(docker.src.work) $(imageName) ./build-source-tarball.sh \
126
88
"/tb/$(tarballName)" \
127
89
--skip-build
128
90
displayName: Create tarball
129
- condition: and(succeeded(), eq(variables['buildOfflineTarball '], true))
91
+ condition: and(succeeded(), eq(variables['sb.tarball '], true))
130
92
131
93
# tar the tarball directory into the drop directory.
132
94
- script : |
@@ -144,46 +106,66 @@ phases:
144
106
tar --numeric-owner "--exclude=$smokeTestPackages" -zcf "/drop/tarball/$(tarballName).tar.gz" "$(tarballName)"
145
107
tar --numeric-owner -zcf "/drop/tarball/$(tarballName)-smoke-test-prereqs.tar.gz" "$smokeTestPackages"'
146
108
displayName: Copy tarball to output
147
- condition: and(succeeded(), eq(variables['buildOfflineTarball '], true))
109
+ condition: and(succeeded(), eq(variables['sb.tarball '], true))
148
110
149
111
# Build tarball.
150
112
- 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
154
123
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))
157
126
158
127
# Run smoke tests.
159
128
- script : |
129
+ set -x
130
+ df -h
160
131
$(docker.run) $(docker.tb.map) $(docker.tb.work) $(imageName) "$(tarballName)/smoke-test.sh" \
161
132
--minimal \
162
133
--projectOutput \
163
- --configuration $(buildConfiguration ) \
134
+ --configuration $(sb.configuration ) \
164
135
--prodConBlobFeedUrl ''
165
136
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
167
143
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
169
157
- script : |
170
158
set -x
171
159
$(docker.run) $(docker.logs.map) $(docker.tb.map) $(docker.tb.work) $(imageName) /bin/bash -c "
172
160
mkdir -p /logs/tarball/logs
173
161
cd \"$(tarballName)\"
174
162
find . \( \
163
+ -path './bin/*-report/*' -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