1
1
#! groovy
2
2
3
3
class DockerParameters {
4
- def image = ' catrobat/catrobat-android'
5
- def imageLabel = ' stable'
4
+ def fileName = ' Dockerfile.jenkins'
5
+
6
+ // 'docker build' would normally copy the whole build-dir to the container, changing the
7
+ // docker build directory avoids that overhead
8
+ def dir = ' docker'
9
+
10
+ // Pass the uid and the gid of the current user (jenkins-user) to the Dockerfile, so a
11
+ // corresponding user can be added. This is needed to provide the jenkins user inside
12
+ // the container for the ssh-agent to work.
13
+ // Another way would be to simply map the passwd file, but would spoil additional information
14
+ // Also hand in the group id of kvm to allow using /dev/kvm.
15
+ def buildArgs = ' --build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g) --build-arg KVM_GROUP_ID=$(getent group kvm | cut -d: -f3)'
16
+
6
17
def args = ' --device /dev/kvm:/dev/kvm -v /var/local/container_shared/gradle_cache/$EXECUTOR_NUMBER:/home/user/.gradle -m=14G'
7
18
def label = ' LimitedEmulator'
8
19
}
9
-
20
+
10
21
def d = new DockerParameters ()
11
22
12
23
def junitAndCoverage (String jacocoReportDir , String jacocoReportXml , String coverageName ) {
@@ -77,11 +88,12 @@ pipeline {
77
88
parallel {
78
89
stage(' 1' ) {
79
90
agent {
80
- docker {
81
- image useDockerLabelParameter(d. image, d. imageLabel)
91
+ dockerfile {
92
+ filename d. fileName
93
+ dir d. dir
94
+ additionalBuildArgs d. buildArgs
82
95
args d. args
83
96
label useDebugLabelParameter(d. label)
84
- alwaysPull true
85
97
}
86
98
}
87
99
@@ -222,18 +234,19 @@ pipeline {
222
234
223
235
stage(' 2' ) {
224
236
agent {
225
- docker {
226
- image useDockerLabelParameter(d. image, d. imageLabel)
237
+ dockerfile {
238
+ filename d. fileName
239
+ dir d. dir
240
+ additionalBuildArgs d. buildArgs
227
241
args d. args
228
242
label useDebugLabelParameter(d. label)
229
- alwaysPull true
230
243
}
231
244
}
232
245
233
246
stages {
234
247
stage(' Pull Request Suite' ) {
235
248
steps {
236
- catchError(buildResult : ' FAILURE' , stageResult : ' FAILURE' ) {
249
+ catchError(buildResult : ' FAILURE' , stageResult : ' FAILURE' ) {
237
250
sh ''' ./gradlew copyAndroidNatives -PenableCoverage -PlogcatFile=pull_request_suite_logcat.txt -Pemulator=android28 \
238
251
startEmulator createCatroidDebugAndroidTestCoverageReport \
239
252
-Pandroid.testInstrumentationRunnerArguments.class=org.catrobat.catroid.testsuites.UiEspressoPullRequestTriggerSuite'''
@@ -253,12 +266,6 @@ pipeline {
253
266
}
254
267
255
268
post {
256
- always {
257
- node(' master' ) {
258
- unstash ' logParserRules'
259
- step([$class : ' LogParserPublisher' , failBuildOnError : true , projectRulePath : ' buildScripts/log_parser_rules' , unstableOnWarning : true , useProjectRule : true ])
260
- }
261
- }
262
269
changed {
263
270
node(' master' ) {
264
271
notifyChat()
0 commit comments