forked from wavesplatform/Waves
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
119 lines (108 loc) · 4.27 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
#!/usr/bin/env groovy
@Library('jenkins-shared-lib')
import devops.waves.*
ut = new utils()
def buildTasks = [:]
def repo_url = 'https://github.com/wavesplatform/Waves.git'
properties([
parameters([
listGitBranches(
branchFilter: 'origin/(.*)',
credentialsId: '',
defaultValue: '',
name: 'branch',
listSize: '20',
quickFilterEnabled: false,
remoteURL: repo_url,
selectedValue: 'NONE',
sortMode: 'DESCENDING_SMART',
type: 'PT_BRANCH')])
])
stage('Aborting this build'){
// On the first launch pipeline doesn't have any parameters configured and must skip all the steps
if (env.BUILD_NUMBER == '1'){
echo "This is the first run of the pipeline! It is now should be configured and ready to go!"
currentBuild.result = Constants.PIPELINE_ABORTED
return
}
if (! params.branch ) {
echo "Aborting this build. Please run it again with the required parameters specified."
currentBuild.result = Constants.PIPELINE_ABORTED
return
}
else
echo "Parameters are specified. Branch: ${branch}"
}
if (currentBuild.result == Constants.PIPELINE_ABORTED){
return
}
timeout(time:90, unit:'MINUTES') {
node('wavesnode'){
currentBuild.result = Constants.PIPELINE_SUCCESS
timestamps {
wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) {
try {
withEnv(["SBT_THREAD_NUMBER=7"]) {
currentBuild.displayName = "#${env.BUILD_NUMBER} - ${branch}"
stage('Checkout') {
sh 'env'
step([$class: 'WsCleanup'])
checkout([
$class: 'GitSCM',
branches: [[ name: branch ]],
doGenerateSubmoduleConfigurations: false,
extensions: [],
submoduleCfg: [],
userRemoteConfigs: [[url: repo_url]]
])
}
stage('Unit Test') {
ut.sbt '-mem 10240 checkPR'
}
stage('Check containers') {
sh 'docker rmi com.wavesplatform/it com.wavesplatform/node-it com.wavesplatform/dex-it || true'
sh 'docker ps -a'
sh 'docker images'
sh 'docker network ls'
sh 'rm -rf it/target || true'
}
stage('Integration Test') {
try {
ut.sbt '-mem 40960 clean it/test'
}
catch (err) {}
finally{
dir('it/target/logs') {
sh "tar -czvf logs.tar.gz * || true"
}
dir('node-it/target/logs') {
sh "tar -czvf node.logs.tar.gz * || true"
}
}
}
stage('Docker cleanup') {
sh "docker system prune -af --volumes"
}
}
}
catch (err) {
currentBuild.result = Constants.PIPELINE_FAILURE
println("ERROR caught")
println(err)
println(err.getMessage())
println(err.getStackTrace())
println(err.getCause())
println(err.getLocalizedMessage())
println(err.toString())
}
finally{
logArchiveLocation = findFiles(glob: '**/*logs.tar.gz')
logArchiveLocation.each {
archiveArtifacts it.path
}
ut.notifySlack("mtuktarov-test", currentBuild.result)
}
}
}
}
}