This repository has been archived by the owner on Feb 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
50 lines (44 loc) · 1.52 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
@Library('jenkins-library@master') _
properties(
[
buildDiscarder(
logRotator(
daysToKeepStr: '5',
numToKeepStr: '5'
)
),
disableConcurrentBuilds()
]
)
// Every jenkins file should start with either a Declarative or Scripted Pipeline entry point.
node {
//Utilizing a try block so as to make the code cleaner and send slack notification in case of any error
try {
// Global variable declaration
def project = 'dukecon_android'
def appName = 'Dukecon Android'
// Stage, is to tell the Jenkins that this is the new process/step that needs to be executed
stage('Checkout') {
// Pull the code from the repo
checkout scm
}
stage('Build Image') {
// Build our docker Image
sh("docker build -t ${project} docker")
}
stage('Build application') {
def workspace = pwd()
sh("docker run --rm -v $workspace:/opt/workspace -u `id -u` -w /opt/workspace ${project} ./gradlew --stacktrace --info clean assembleJavalandDebug")
}
stage("Archive") {
// move all apk file from various build variants folder into working path
sh("find ${WORKSPACE} -name '*javaland*.apk' -exec cp {} ${WORKSPACE} \\;")
archive '*javaland*.apk'
}
} catch (e) {
currentBuild.result = "FAILED"
throw e
} finally {
sendNotification currentBuild.result
}
}