-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathJenkinsfile.upload
88 lines (85 loc) · 3.53 KB
/
Jenkinsfile.upload
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/env groovy
@Library(['[email protected]']) _
properties([
parameters([
string(name: 'PRODUCT', defaultValue: '', description: 'Select product to build - when empty defaults to canary, possible values: cliqz or lumen'),
]),
])
node('master'){
def imageName = 'android-browser'
def scmVars = [:]
stage('Checkout'){
scmVars = checkout scm
}
stage('Build docker image') {
docker.build(imageName, '--build-arg UID=`id -u` --build-arg GID=`id -g` .')
}
docker.image(imageName).inside() {
try {
stage('Extension') {
sh '''#!/bin/bash -l
set -x
set -e
npm ci
npm run bundle
'''
}
withEnv([
"GRADLE_USER_HOME=${pwd()}/gradle_home",
"BUILD_NUMBER=${BUILD_NUMBER}",
"GIT_COMMIT=${scmVars.GIT_COMMIT}"
]) {
withCredentials([
file(credentialsId: '263e59fb-e9de-4e51-962c-0237c6ee167b', variable: 'CERT_PATH'),
string(credentialsId: '60354bba-8ed0-4df9-8f8e-5be7454c1680', variable: 'CERT_PASS'),
file(credentialsId: '2939d2e1-dd9a-4097-adc2-430e3d67157a', variable: 'PLAY_STORE_CERT'),
file(credentialsId: 'cliqz-config.json', variable: 'CLIQZ_CONFIG_JSON'),
file(credentialsId: '6006a534-9f2e-4ba8-93f9-f0f27c0713df', variable: 'GOOGLE_SERVICES')]) {
stage('Compile and Upload') {
sh '''#!/bin/bash -l
set -x
set -e
cp "$CLIQZ_CONFIG_JSON" app/cliqz-config.json
cp "$GOOGLE_SERVICES" app/google-services.json
'''
def pkg = ""
def lane = ""
switch (env.PRODUCT) {
case 'lumen':
pkg = 'com.cliqz.lumen'
lane = 'internal_lumen'
break
case 'cliqz':
pkg = 'com.cliqz.browser'
lane = 'internal_cliqz'
break
default:
pkg = 'com.cliqz.browser.ut'
lane = 'production_canary'
break
}
sh """#!/bin/bash -l
set -x
set -e
export APP_PACKAGE="$pkg"
fastlane android $lane
"""
}
}
}
} finally {
stage('Upload Artifacts and Clean Up') {
archiveArtifacts allowEmptyArchive: true, artifacts: 'app/build/**/*.apk'
sh'''#!/bin/bash -l
set -x
set -e
rm -f app/cliqz-config.json
rm -f app/google-services.json
rm -rf app/build || true
rm -rf jsengine/* || true
rm -rf gradle_home/ || true
'''
}
}
}
}