forked from loomnetwork/loomchain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
251 lines (236 loc) · 14.1 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
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
void setBuildStatus(String message, String state, String context) {
step([
$class: "GitHubCommitStatusSetter",
reposSource: [$class: "ManuallyEnteredRepositorySource", url: "[email protected]:loomnetwork/loomchain.git"],
contextSource: [$class: "ManuallyEnteredCommitContextSource", context: context],
errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]],
statusResultSource: [ $class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ]
]);
}
def builders = [:]
def disabled = [:]
builders['linux'] = {
node('linux-any') {
timestamps {
def thisBuild = null
try {
stage ('Checkout - Linux') {
checkout changelog: true, poll: true, scm:
[
$class: 'GitSCM',
branches: [[name: 'refs/heads/master']],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'PruneStaleBranch']],
submoduleCfg: [],
userRemoteConfigs:
[[
credentialsId: 'loom-sdk',
url: '[email protected]:loomnetwork/loomchain.git'
]]
]
}
setBuildStatus("Build ${env.BUILD_DISPLAY_NAME} is in progress", "PENDING", "Linux");
stage ('Build - Linux') {
sh '''
./jenkins.sh
cd /tmp/gopath-${BUILD_TAG}/src/github.com/loomnetwork/loomchain/
gsutil cp loom-generic gs://downloads.loomx.io/loom/linux/build-$BUILD_NUMBER/loom
gsutil cp loom-gateway gs://downloads.loomx.io/loom/linux/build-$BUILD_NUMBER/loom-gateway
gsutil cp loom-cleveldb gs://downloads.loomx.io/loom/linux/build-$BUILD_NUMBER/loom-cleveldb
gsutil cp basechain gs://downloads.loomx.io/loom/linux/build-$BUILD_NUMBER/basechain
gsutil cp basechain-cleveldb gs://downloads.loomx.io/loom/linux/build-$BUILD_NUMBER/basechain-cleveldb
gsutil cp e2e/validators-tool gs://downloads.loomx.io/loom/linux/build-$BUILD_NUMBER/validators-tool
gsutil cp tgoracle gs://downloads.loomx.io/loom/linux/build-$BUILD_NUMBER/tgoracle
gsutil cp loomcoin_tgoracle gs://downloads.loomx.io/loom/linux/build-$BUILD_NUMBER/loomcoin_tgoracle
gsutil cp tron_tgoracle gs://downloads.loomx.io/loom/linux/build-$BUILD_NUMBER/tron_tgoracle
gsutil cp bsc_tgoracle gs://downloads.loomx.io/loom/linux/build-$BUILD_NUMBER/bsc_tgoracle
gsutil cp loom-generic gs://downloads.loomx.io/loom/linux/latest/loom
gsutil cp loom-gateway gs://downloads.loomx.io/loom/linux/latest/loom-gateway
gsutil cp loom-cleveldb gs://downloads.loomx.io/loom/linux/latest/loom-cleveldb
gsutil cp basechain gs://downloads.loomx.io/loom/linux/latest/basechain
gsutil cp basechain-cleveldb gs://downloads.loomx.io/loom/linux/latest/basechain-cleveldb
gsutil cp e2e/validators-tool gs://downloads.loomx.io/loom/linux/latest/validators-tool
gsutil cp tgoracle gs://downloads.loomx.io/loom/linux/latest/tgoracle
gsutil cp loomcoin_tgoracle gs://downloads.loomx.io/loom/linux/latest/loomcoin_tgoracle
gsutil cp tron_tgoracle gs://downloads.loomx.io/loom/linux/latest/tron_tgoracle
gsutil cp bsc_tgoracle gs://downloads.loomx.io/loom/linux/latest/bsc_tgoracle
gsutil cp install.sh gs://downloads.loomx.io/install.sh
docker build --build-arg BUILD_NUMBER=${BUILD_NUMBER} --build-arg ARCH= -t loomnetwork/loom:latest .
docker tag loomnetwork/loom:latest loomnetwork/loom:${BUILD_NUMBER}
docker push loomnetwork/loom:latest
docker push loomnetwork/loom:${BUILD_NUMBER}
'''
}
} catch (e) {
thisBuild = 'FAILURE'
throw e
} finally {
if (currentBuild.currentResult == 'FAILURE' || thisBuild == 'FAILURE') {
setBuildStatus("Build ${env.BUILD_DISPLAY_NAME} failed", "FAILURE", "Linux");
slackSend channel: '#blockchain-engineers', color: '#FF0000', message: "${env.JOB_NAME} (LINUX) - #${env.BUILD_NUMBER} Failure after ${currentBuild.durationString.replace(' and counting', '')} (<${env.BUILD_URL}|Open>)"
sh '''
cd /tmp/gopath-jenkins-${JOB_BASE_NAME}-${BUILD_NUMBER}/src/github.com/loomnetwork/loomchain/e2e
find test-data -name "*.log" | tar -czf ${JOB_BASE_NAME}-${BUILD_NUMBER}-linux-test-data.tar.gz -T -
mkdir -p /tmp/test-data
mv ${JOB_BASE_NAME}-${BUILD_NUMBER}-linux-test-data.tar.gz /tmp/test-data
'''
}
else if (currentBuild.currentResult == 'SUCCESS') {
setBuildStatus("Build ${env.BUILD_DISPLAY_NAME} succeeded in ${currentBuild.durationString.replace(' and counting', '')}", "SUCCESS", "Linux");
slackSend channel: '#blockchain-engineers', color: '#006400', message: "${env.JOB_NAME} (LINUX) - #${env.BUILD_NUMBER} Success after ${currentBuild.durationString.replace(' and counting', '')} (<${env.BUILD_URL}|Open>)"
}
}
}
}
}
builders['linux-arm'] = {
node('linux-arm') {
timestamps {
def thisBuild = null
try {
stage ('Checkout - Linux-ARM') {
checkout changelog: true, poll: true, scm:
[
$class: 'GitSCM',
branches: [[name: 'refs/heads/master']],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'PruneStaleBranch']],
submoduleCfg: [],
userRemoteConfigs:
[[
credentialsId: 'loom-sdk',
url: '[email protected]:loomnetwork/loomchain.git'
]]
]
}
setBuildStatus("Build ${env.BUILD_DISPLAY_NAME} is in progress", "PENDING", "Linux-arm");
stage ('Build - Linux - ARM') {
sh '''
./jenkins.sh
cd /tmp/gopath-${BUILD_TAG}/src/github.com/loomnetwork/loomchain/
gsutil cp loom-generic gs://downloads.loomx.io/loom/linux-aarch64/build-$BUILD_NUMBER/loom
gsutil cp loom-gateway gs://downloads.loomx.io/loom/linux-aarch64/build-$BUILD_NUMBER/loom-gateway
gsutil cp loom-cleveldb gs://downloads.loomx.io/loom/linux-aarch64/build-$BUILD_NUMBER/loom-cleveldb
gsutil cp basechain gs://downloads.loomx.io/loom/linux-aarch64/build-$BUILD_NUMBER/basechain
gsutil cp basechain-cleveldb gs://downloads.loomx.io/loom/linux-aarch64/build-$BUILD_NUMBER/basechain-cleveldb
gsutil cp e2e/validators-tool gs://downloads.loomx.io/loom/linux-aarch64/build-$BUILD_NUMBER/validators-tool
gsutil cp tgoracle gs://downloads.loomx.io/loom/linux-aarch64/build-$BUILD_NUMBER/tgoracle
gsutil cp loomcoin_tgoracle gs://downloads.loomx.io/loom/linux-aarch64/build-$BUILD_NUMBER/loomcoin_tgoracle
gsutil cp tron_tgoracle gs://downloads.loomx.io/loom/linux-aarch64/build-$BUILD_NUMBER/tron_tgoracle
gsutil cp bsc_tgoracle gs://downloads.loomx.io/loom/linux-aarch64/build-$BUILD_NUMBER/bsc_tgoracle
gsutil cp loom-generic gs://downloads.loomx.io/loom/linux-aarch64/latest/loom
gsutil cp loom-gateway gs://downloads.loomx.io/loom/linux-aarch64/latest/loom-gateway
gsutil cp loom-cleveldb gs://downloads.loomx.io/loom/linux-aarch64/latest/loom-cleveldb
gsutil cp basechain gs://downloads.loomx.io/loom/linux-aarch64/latest/basechain
gsutil cp basechain-cleveldb gs://downloads.loomx.io/loom/linux-aarch64/latest/basechain-cleveldb
gsutil cp e2e/validators-tool gs://downloads.loomx.io/loom/linux-aarch64/latest/validators-tool
gsutil cp tgoracle gs://downloads.loomx.io/loom/linux-aarch64/latest/tgoracle
gsutil cp loomcoin_tgoracle gs://downloads.loomx.io/loom/linux-aarch64/latest/loomcoin_tgoracle
gsutil cp tron_tgoracle gs://downloads.loomx.io/loom/linux-aarch64/latest/tron_tgoracle
gsutil cp bsc_tgoracle gs://downloads.loomx.io/loom/linux-aarch64/latest/bsc_tgoracle
gsutil cp install.sh gs://downloads.loomx.io/install.sh
docker build --build-arg BUILD_NUMBER=${BUILD_NUMBER} --build-arg ARCH=-aarch64 -t loomnetwork/loom-arm:latest .
docker tag loomnetwork/loom-arm:latest loomnetwork/loom-arm:${BUILD_NUMBER}
docker push loomnetwork/loom-arm:latest
docker push loomnetwork/loom-arm:${BUILD_NUMBER}
'''
}
} catch (e) {
thisBuild = 'FAILURE'
throw e
} finally {
if (currentBuild.currentResult == 'FAILURE' || thisBuild == 'FAILURE') {
setBuildStatus("Build ${env.BUILD_DISPLAY_NAME} failed", "FAILURE", "Linux-arm");
slackSend channel: '#blockchain-engineers', color: '#FF0000', message: "${env.JOB_NAME} (LINUX-ARM) - #${env.BUILD_NUMBER} Failure after ${currentBuild.durationString.replace(' and counting', '')} (<${env.BUILD_URL}|Open>)"
sh '''
cd /tmp/gopath-jenkins-${JOB_BASE_NAME}-${BUILD_NUMBER}/src/github.com/loomnetwork/loomchain/e2e
find test-data -name "*.log" | tar -czf ${JOB_BASE_NAME}-${BUILD_NUMBER}-linux-test-data.tar.gz -T -
mkdir -p /tmp/test-data
mv ${JOB_BASE_NAME}-${BUILD_NUMBER}-linux-test-data.tar.gz /tmp/test-data
'''
}
else if (currentBuild.currentResult == 'SUCCESS') {
setBuildStatus("Build ${env.BUILD_DISPLAY_NAME} succeeded in ${currentBuild.durationString.replace(' and counting', '')}", "SUCCESS", "Linux-arm");
slackSend channel: '#blockchain-engineers', color: '#006400', message: "${env.JOB_NAME} (LINUX-ARM) - #${env.BUILD_NUMBER} Success after ${currentBuild.durationString.replace(' and counting', '')} (<${env.BUILD_URL}|Open>)"
}
}
}
}
}
disabled['osx'] = {
node('osx-any') {
timestamps {
def thisBuild = null
try {
stage ('Checkout - OSX') {
checkout changelog: true, poll: true, scm:
[
$class: 'GitSCM',
branches: [[name: 'refs/heads/master']],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'PruneStaleBranch']],
submoduleCfg: [],
userRemoteConfigs:
[[
credentialsId: 'loom-sdk',
url: '[email protected]:loomnetwork/loomchain.git'
]]
]
}
setBuildStatus("Build ${env.BUILD_DISPLAY_NAME} is in progress", "PENDING", "OSX");
stage ('Build - OSX') {
nodejs('v10.16.3 (LTS)') {
sh '''
./jenkins.sh
cd /tmp/gopath-${BUILD_TAG}/src/github.com/loomnetwork/loomchain/
gsutil cp loom-generic gs://downloads.loomx.io/loom/osx/build-$BUILD_NUMBER/loom
gsutil cp loom-gateway gs://downloads.loomx.io/loom/osx/build-$BUILD_NUMBER/loom-gateway
gsutil cp loom-cleveldb gs://downloads.loomx.io/loom/osx/build-$BUILD_NUMBER/loom-cleveldb
gsutil cp basechain gs://downloads.loomx.io/loom/osx/build-$BUILD_NUMBER/basechain
gsutil cp basechain-cleveldb gs://downloads.loomx.io/loom/osx/build-$BUILD_NUMBER/basechain-cleveldb
gsutil cp e2e/validators-tool gs://downloads.loomx.io/loom/osx/build-$BUILD_NUMBER/validators-tool
gsutil cp tgoracle gs://downloads.loomx.io/loom/osx/build-$BUILD_NUMBER/tgoracle
gsutil cp loomcoin_tgoracle gs://downloads.loomx.io/loom/osx/build-$BUILD_NUMBER/loomcoin_tgoracle
gsutil cp tron_tgoracle gs://downloads.loomx.io/loom/osx/build-$BUILD_NUMBER/tron_tgoracle
gsutil cp bsc_tgoracle gs://downloads.loomx.io/loom/osx/build-$BUILD_NUMBER/bsc_tgoracle
gsutil cp loom-generic gs://downloads.loomx.io/loom/osx/latest/loom
gsutil cp loom-gateway gs://downloads.loomx.io/loom/osx/latest/loom-gateway
gsutil cp loom-cleveldb gs://downloads.loomx.io/loom/osx/latest/loom-cleveldb
gsutil cp basechain gs://downloads.loomx.io/loom/osx/latest/basechain
gsutil cp basechain-cleveldb gs://downloads.loomx.io/loom/osx/latest/basechain-cleveldb
gsutil cp e2e/validators-tool gs://downloads.loomx.io/loom/osx/latest/validators-tool
gsutil cp tgoracle gs://downloads.loomx.io/loom/osx/latest/tgoracle
gsutil cp loomcoin_tgoracle gs://downloads.loomx.io/loom/osx/latest/loomcoin_tgoracle
gsutil cp tron_tgoracle gs://downloads.loomx.io/loom/osx/latest/tron_tgoracle
gsutil cp bsc_tgoracle gs://downloads.loomx.io/loom/osx/latest/bsc_tgoracle
'''
}
}
} catch (e) {
thisBuild = 'FAILURE'
throw e
} finally {
if (currentBuild.currentResult == 'FAILURE' || thisBuild == 'FAILURE') {
setBuildStatus("Build ${env.BUILD_DISPLAY_NAME} failed", "FAILURE", "OSX");
slackSend channel: '#blockchain-engineers', color: '#FF0000', message: "${env.JOB_NAME} (OSX) - #${env.BUILD_NUMBER} Failure after ${currentBuild.durationString.replace(' and counting', '')} (<${env.BUILD_URL}|Open>)"
sh '''
cd /tmp/gopath-jenkins-${JOB_BASE_NAME}-${BUILD_NUMBER}/src/github.com/loomnetwork/loomchain/e2e
find test-data -name "*.log" | tar -czf ${JOB_BASE_NAME}-${BUILD_NUMBER}-osx-test-data.tar.gz -T -
mkdir -p /tmp/test-data
mv ${JOB_BASE_NAME}-${BUILD_NUMBER}-osx-test-data.tar.gz /tmp/test-data
'''
}
else if (currentBuild.currentResult == 'SUCCESS') {
setBuildStatus("Build ${env.BUILD_DISPLAY_NAME} succeeded in ${currentBuild.durationString.replace(' and counting', '')}", "SUCCESS", "OSX");
slackSend channel: '#blockchain-engineers', color: '#006400', message: "${env.JOB_NAME} (OSX) - #${env.BUILD_NUMBER} Success after ${currentBuild.durationString.replace(' and counting', '')} (<${env.BUILD_URL}|Open>)"
}
}
build job: 'homebrew-client', parameters: [[$class: 'StringParameterValue', name: 'LOOM_BUILD', value: "$BUILD_NUMBER"]]
}
}
}
throttle(['loom-sdk']) {
timeout(time: 60, unit: 'MINUTES'){
parallel builders
}
}