This repository has been archived by the owner on Sep 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Jenkinsfile.artifact
99 lines (93 loc) · 3.87 KB
/
Jenkinsfile.artifact
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
89
90
91
92
93
94
95
96
97
98
99
#!/bin/env groovy
@Library(['[email protected]', 'browser-android@automation']) _
properties([
parameters([
booleanParam(name: 'REPLACE_TARGET', defaultValue: false, description: 'Replaces the existing target.apk from S3')
])
])
def matrix = [
'x86':[
'target':'i686-linux-android',
],
'arm':[
'target':'arm-linux-androideabi',
],
]
def build(Map m){
def target = m.target
def nodeLabel = 'us-east-1 && ubuntu && docker && !gpu'
def arch = m.name
return {
node(nodeLabel) {
def version = ((("https://raw.githubusercontent.com/cliqz-oss/cliqz-android/master/mozilla-release/browser/config/version.txt").toURL()).getText()).trim()
def url = "https://repository.cliqz.com/dist/android/artifacts/${version}"
def createTarget = false
if (!params.REPLACE_TARGET) {
try {
def targetAPK = sh(returnStdout: true,
script: """wget -S --spider '${url}/${arch}/cliqz-target.apk' 2>&1 | grep 'HTTP/1.1 200 OK'""").trim()[-2..-1]
} catch(e) {
createTarget = true
}
}
else {
createTarget = true
}
if (createTarget) {
def dockerTag = ""
def apk = ""
try {
stage('Checkout') {
checkout scm
dockerTag = readFile('mozilla-release/browser/config/version.txt').trim()
}
def baseImageName = "browser-f/android:${dockerTag}"
docker.withRegistry('https://141047255820.dkr.ecr.us-east-1.amazonaws.com') {
docker.image("${baseImageName}").inside {
stage('Build Artifacts') {
apk = cliqz.buildBrowser("${target}", "cliqz", "artifact")
}
stage('Upload to S3'){
sh "cp build/${apk} cliqz-target.apk"
archiveArtifacts allowEmptyArchive: true, artifacts: 'cliqz-target.apk'
withCredentials([
[
$class: 'AmazonWebServicesCredentialsBinding',
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
credentialsId: 'd7e38c4a-37eb-490b-b4da-2f53cc14ab1b',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]
]) {
def s3Path = "s3://repository.cliqz.com/dist/android/artifacts/${version}/${arch}"
if (!params.REPLACE_TARGET) {
utils.s3rm("${s3Path}/cliqz-target.apk")
}
utils.s3Copy(
"build/${apk}",
"${s3Path}",
"cliqz-target",
"",
false
)
}
}
}
}
}
finally {
stage('Clean Up') {
utils.cleanUp()
sh 'rm -f target.apk'
}
}
}
}
}
}
def stepsForParallelBuilds = helpers.entries(matrix).collectEntries{
[("ARCH: ${it[0]}"):build(
name: it[0],
target: it[1]['target']
)]
}
parallel stepsForParallelBuilds