-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathJenkinsfile
58 lines (51 loc) · 1.39 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
51
52
53
54
55
56
57
58
/*
This jenkins pipeline should be configured as Multibranch Pipeline job in Jenkins
Required Jenkins Plugins:
* All basic Jenkins Pipeline Plugins
* Git plugin
* Docker Pipeline Plugin
* Amazon ECR plugin (if push to ECR)
* Lockable Resources Plugin
*/
pipeline {
agent {
label "${params.AGENT_LABEL ?: 'build'}"
}
environment {
ANDROID_HOME = tool(name: 'android-sdk-tools', type: 'com.cloudbees.jenkins.plugins.customtools.CustomTool')
}
parameters {
string(name: 'AGENT_LABEL', defaultValue: 'build')
booleanParam(name: 'BINTRAY_PUBLISH', defaultValue: false)
string(name: 'BINTRAY_CERDENTIAL_ID', defaultValue: 'visenze-jfrog-bintray',
description: 'The jenkins credential ID to push to bintray')
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Build') {
steps {
script {
sh "./gradlew assembleRelease"
}
}
}
stage('Push to Bintray') {
when {
expression {
params.BINTRAY_PUBLISH
}
}
steps {
script {
withCredentials([usernamePassword(credentialsId: params.BINTRAY_CERDENTIAL_ID, usernameVariable: 'bintrayUser', passwordVariable: 'bintrayKey')]) {
sh "./gradlew bintrayUpload -PbintrayUser=${bintrayUser} -PbintrayKey=${bintrayKey}"
}
}
}
}
}
}