Skip to content

Commit 2b164fd

Browse files
committed
DevOps-416 Added Fastlane
1 parent 7d83b17 commit 2b164fd

File tree

2 files changed

+47
-31
lines changed

2 files changed

+47
-31
lines changed

Jenkinsfile

+23-16
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
#!groovy
22

33
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+
617
def args = '--device /dev/kvm:/dev/kvm -v /var/local/container_shared/gradle_cache/$EXECUTOR_NUMBER:/home/user/.gradle -m=14G'
718
def label = 'LimitedEmulator'
819
}
9-
20+
1021
def d = new DockerParameters()
1122

1223
def junitAndCoverage(String jacocoReportDir, String jacocoReportXml, String coverageName) {
@@ -77,11 +88,12 @@ pipeline {
7788
parallel {
7889
stage('1') {
7990
agent {
80-
docker {
81-
image useDockerLabelParameter(d.image, d.imageLabel)
91+
dockerfile {
92+
filename d.fileName
93+
dir d.dir
94+
additionalBuildArgs d.buildArgs
8295
args d.args
8396
label useDebugLabelParameter(d.label)
84-
alwaysPull true
8597
}
8698
}
8799

@@ -222,18 +234,19 @@ pipeline {
222234

223235
stage('2') {
224236
agent {
225-
docker {
226-
image useDockerLabelParameter(d.image, d.imageLabel)
237+
dockerfile {
238+
filename d.fileName
239+
dir d.dir
240+
additionalBuildArgs d.buildArgs
227241
args d.args
228242
label useDebugLabelParameter(d.label)
229-
alwaysPull true
230243
}
231244
}
232245

233246
stages {
234247
stage('Pull Request Suite') {
235248
steps {
236-
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
249+
catchError(buildResult: 'FAILURE' ,stageResult: 'FAILURE') {
237250
sh '''./gradlew copyAndroidNatives -PenableCoverage -PlogcatFile=pull_request_suite_logcat.txt -Pemulator=android28 \
238251
startEmulator createCatroidDebugAndroidTestCoverageReport \
239252
-Pandroid.testInstrumentationRunnerArguments.class=org.catrobat.catroid.testsuites.UiEspressoPullRequestTriggerSuite'''
@@ -253,12 +266,6 @@ pipeline {
253266
}
254267

255268
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-
}
262269
changed {
263270
node('master') {
264271
notifyChat()

docker/Dockerfile.jenkins

+24-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM debian:stretch
1+
FROM debian:buster
22
# Android Dependencies
33
# --------------------
44
# Adapt the paramters below to change the dependencies.
@@ -31,7 +31,7 @@ ARG _SDKMANAGER=$ANDROID_SDK_ROOT/tools/bin/sdkmanager
3131
# x11-commons/x11-utils/libpulse0 needed to start emulator
3232
RUN apt-get update && apt-get install -y --no-install-recommends \
3333
curl \
34-
openjdk-8-jdk \
34+
# openjdk-8-jdk \
3535
unzip \
3636
openssh-client \
3737
x11-common \
@@ -40,21 +40,30 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
4040
libxcursor-dev \
4141
libnss3-dev \
4242
libasound2 \
43+
wget \
44+
gnupg \
45+
software-properties-common \
4346
&& rm -rf /var/lib/apt/lists/*
4447
# Install Fastlane
45-
#RUN apt-get update && apt-get install -y --no-install-recommends \
46-
# rubygems \
47-
# ruby-dev \
48-
# g++ \
49-
# make \
50-
# less \
51-
# && rm -rf /var/lib/apt/lists/* \
52-
# && gem update --system \
53-
# && gem install fastlane -NV \
54-
# && apt-get purge -y --auto-remove \
55-
# ruby-dev \
56-
# g++ \
57-
# make
48+
RUN wget --no-check-certificate -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | apt-key add -
49+
RUN add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
50+
51+
RUN apt-get update && apt-get install -y adoptopenjdk-8-hotspot
52+
RUN apt-get install -y python2
53+
RUN apt-get install -y --no-install-recommends \
54+
rubygems \
55+
ruby-dev \
56+
g++ \
57+
make \
58+
less \
59+
git \
60+
&& rm -rf /var/lib/apt/lists/* \
61+
&& gem update --system \
62+
&& gem install fastlane -NV \
63+
&& apt-get purge -y --auto-remove \
64+
ruby-dev \
65+
g++ \
66+
make
5867
# User Management
5968
# ---------------
6069
#

0 commit comments

Comments
 (0)