-
Notifications
You must be signed in to change notification settings - Fork 54
/
Jenkinsfile.mac
144 lines (122 loc) · 4.95 KB
/
Jenkinsfile.mac
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/usr/bin/env groovy
// Check for required variables
MAC_REBUILD_IMAGE
NODE_MEMORY
NODE_CPU_COUNT
NODE_VNC_PORT
/*
TRIGGERING JOB
```groovy
node(MAC_BUILD_NODE) {
step([
$class: 'CopyArtifact',
projectName: TRIGGERING_JOB_NAME,
selector: [$class: 'SpecificBuildSelector', buildNumber: TRIGGERING_BUILD_NUMBER],
target: 'artifacts'
])
def helpers = load "artifacts/build-helpers.groovy"
helpers.withVagrant("artifacts/${VAGRANTFILE}", "/jenkins", NODE_CPU_COUNT.toInteger(), NODE_MEMORY.toInteger(), NODE_VNC_PORT.toInteger(), MAC_REBUILD_IMAGE.toBoolean()) { nodeId ->
node(nodeId) {
stage("Checkout") {
helpers.checkoutSCM(REPO_URL, COMMIT_ID)
}
load ENTRY_POINT
}
}
}
```
*/
/*
Firefox 62 bootstrap steps, do it manually once on fresh build image:
brew update
brew install python
brew link --overwrite autoconf@2.13
brew install mercurial
python mozilla-release/python/mozboot/bin/bootstrap.py --application-choice=browser --no-interactive (use python 2.7), may be need to restart console to complete this step
brew install xz
brew uninstall terminal-notifier (in other case build will hang up, because there are no console)
*/
withEnv([
"CQZ_BUILD_ID=$CQZ_BUILD_ID",
"CQZ_BUILD_DE_LOCALIZATION=$CQZ_BUILD_DE_LOCALIZATION",
"CQZ_RELEASE_CHANNEL=$CQZ_RELEASE_CHANNEL"]) {
withCredentials([
[$class: 'StringBinding', credentialsId: CQZ_MOZILLA_API_KEY_CREDENTIAL_ID, variable: 'MOZ_MOZILLA_API_KEY'],
[$class: 'StringBinding', credentialsId: CQZ_GOOGLE_API_KEY_CREDENTIAL_ID, variable: 'CQZ_GOOGLE_API_KEY']]) {
stage('fix keys') {
writeFile file: "mozilla-desktop-geoloc-api.key", text: "${MOZ_MOZILLA_API_KEY}"
writeFile file: "google-desktop-api.key", text: "${CQZ_GOOGLE_API_KEY}"
}
stage('build') {
sh "/bin/bash -lc './magic_build_and_package.sh --clobber'"
}
}
stage('sign') {
// remove old package - important if clobber was not done
sh 'rm -rf obj/pkg || true'
withCredentials([
[$class: 'FileBinding', credentialsId: MAC_CERT_CREDENTIAL_ID, variable: 'MAC_CERT'],
[$class: 'StringBinding', credentialsId: MAC_CERT_PASS_CREDENTIAL_ID, variable: 'MAC_CERT_PASS']
]) {
try {
// create temporary keychain and make it a default one
sh '''#!/bin/bash -l -x
security create-keychain -p cliqz cliqz
security list-keychains -s cliqz
security default-keychain -s cliqz
security unlock-keychain -p cliqz cliqz
'''
sh '''#!/bin/bash -l +x
security import $MAC_CERT -P $MAC_CERT_PASS -k cliqz -A
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k cliqz cliqz
'''
withEnv(["MAC_CERT_NAME=$MAC_CERT_NAME"]) {
sh "./sign_mac.sh"
}
} finally {
sh '''#!/bin/bash -l -x
security delete-keychain cliqz
security list-keychains -s login.keychain
security default-keychain -s login.keychain
true
'''
}
}
}
stage('upload') {
withEnv(['CQZ_CERT_DB_PATH=/Users/vagrant/certs']) {
try {
//expose certs
withCredentials([
[$class: 'FileBinding', credentialsId: MAR_CERT_CREDENTIAL_ID, variable: 'MAR_CERT'],
[$class: 'StringBinding', credentialsId: MAR_CERT_PASS_CREDENTIAL_ID, variable: 'MAR_CERT_PASS']]) {
sh '''#!/bin/bash -x
mkdir $CQZ_CERT_DB_PATH
cd `brew --prefix nss`/bin
./certutil -N -d $CQZ_CERT_DB_PATH -f emptypw.txt
set +x
./pk12util -i $MAR_CERT -W $MAR_CERT_PASS -d $CQZ_CERT_DB_PATH
'''
}
withCredentials([[
$class: 'UsernamePasswordMultiBinding',
credentialsId: CQZ_AWS_CREDENTIAL_ID,
passwordVariable: 'AWS_SECRET_ACCESS_KEY',
usernameVariable: 'AWS_ACCESS_KEY_ID']]) {
sh """#!/bin/bash -l -x
./magic_upload_files.sh
"""
if (CQZ_BUILD_DE_LOCALIZATION == "1") {
archiveArtifacts 'obj/en_build_properties.json'
archiveArtifacts 'obj/de_build_properties.json'
} else {
archiveArtifacts 'obj/build_properties.json'
}
}
} finally {
// remove certs
sh 'rm -r $CQZ_CERT_DB_PATH || true'
}
}
}
}