forked from hyperledger/indy-plenum
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
221 lines (184 loc) · 6.45 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
#!groovy
// TODO remove after shared libs refactoring
@Library('SovrinHelpers') _
def name = 'indy-plenum'
def plenumTestUbuntu = { offset, increment ->
try {
echo 'Ubuntu Test: Checkout csm'
checkout scm
echo 'Ubuntu Test: Build docker image'
def testEnv = dockerHelpers.build(name)
testEnv.inside('--network host') {
echo 'Ubuntu Test: Install dependencies'
testHelpers.install()
echo 'Ubuntu Test: Test'
testHelpers.testRunner([resFile: "test-result-plenum-$offset.${NODE_NAME}.txt", testDir: 'plenum', testOnlySlice: "$offset/$increment"])
}
}
finally {
echo 'Ubuntu Test: Cleanup'
step([$class: 'WsCleanup'])
}
}
def plenumTestUbuntuPart1 = {
plenumTestUbuntu(1, 3)
}
def plenumTestUbuntuPart2 = {
plenumTestUbuntu(2, 3)
}
def plenumTestUbuntuPart3 = {
plenumTestUbuntu(3, 3)
}
def ledgerTestUbuntu = {
try {
echo 'Ubuntu Test: Checkout csm'
checkout scm
echo 'Ubuntu Test: Build docker image'
def testEnv = dockerHelpers.build(name)
testEnv.inside {
echo 'Ubuntu Test: Install dependencies'
testHelpers.install()
echo 'Ubuntu Test: Test'
testHelpers.testJUnit([testDir: 'common', resFile: "test-result-common.${NODE_NAME}.xml"])
testHelpers.testJUnit([testDir: 'ledger', resFile: "test-result-ledger.${NODE_NAME}.xml"])
testHelpers.testJUnit([testDir: 'state', resFile: "test-result-state.${NODE_NAME}.xml"])
testHelpers.testJUnit([testDir: 'storage', resFile: "test-result-storage.${NODE_NAME}.xml"])
}
}
finally {
echo 'Ubuntu Test: Cleanup'
step([$class: 'WsCleanup'])
}
}
def stpTestUbuntu = {
try {
echo 'Ubuntu Test: Checkout csm'
checkout scm
echo 'Ubuntu Test: Build docker image'
def testEnv = dockerHelpers.build(name)
testEnv.inside {
echo 'Ubuntu Test: Install dependencies'
testHelpers.install()
echo 'Ubuntu Test: Test'
testHelpers.testJUnit([testDir: 'stp_zmq', resFile: "test-result-stp-zmq.${NODE_NAME}.xml"])
}
}
finally {
echo 'Ubuntu Test: Cleanup'
step([$class: 'WsCleanup'])
}
}
def plenumTestWindows = {
echo 'TODO: Implement me'
/* win2016 for now (03-23-2017) is not supported by Docker for Windows
* (Hyper-V version), so we can't use linux containers
* https://github.com/docker/for-win/issues/448#issuecomment-276328342
*
* possible solutions:
* - use host-installed OrientDB (trying this one)
* - wait until Docker support will be provided for win2016
*/
//try {
// echo 'Windows Test: Checkout csm'
// checkout scm
// echo 'Windows Test: Build docker image'
// dockerHelpers.buildAndRunWindows(name, testHelpers.installDepsWindowsCommands() + ["cd C:\\test && python -m pytest -k orientdb --junit-xml=C:\\testOrig\\$testFile"] /*testHelpers.testJunitWindowsCommands()*/)
// junit 'test-result.xml'
//}
//finally {
// echo 'Windows Test: Cleanup'
// step([$class: 'WsCleanup'])
//}
}
def ledgerTestWindows = {
try {
echo 'Windows Test: Checkout csm'
checkout scm
echo 'Windows Test: Build docker image'
dockerHelpers.buildAndRunWindows(name, testHelpers.installDepsWindowsCommands() + testHelpers.testJunitWindowsCommands())
junit 'test-result.xml'
}
finally {
echo 'Windows Test: Cleanup'
step([$class: 'WsCleanup'])
}
}
def stateTestWindows = {
try {
echo 'Windows Test: Checkout csm'
checkout scm
echo 'Windows Test: Build docker image'
dockerHelpers.buildAndRunWindows(name, testHelpers.installDepsWindowsCommands() + testHelpers.testJunitWindowsCommands())
junit 'test-result.xml'
}
finally {
echo 'Windows Test: Cleanup'
step([$class: 'WsCleanup'])
}
}
def plenumTestWindowsNoDocker = {
try {
echo 'Windows No Docker Test: Checkout csm'
checkout scm
testHelpers.createVirtualEnvAndExecute({ python, pip ->
echo 'Windows No Docker Test: Install dependencies'
testHelpers.install(python: python, pip: pip, isVEnv: true)
echo 'Windows No Docker Test: Test'
testHelpers.testRunner(resFile: "test-result.${NODE_NAME}.txt", python: python)
})
}
finally {
echo 'Windows No Docker Test: Cleanup'
step([$class: 'WsCleanup'])
}
}
def ledgerTestWindowsNoDocker = {
try {
echo 'Windows No Docker Test: Checkout csm'
checkout scm
testHelpers.createVirtualEnvAndExecute({ python, pip ->
echo 'Windows No Docker Test: Install dependencies'
testHelpers.installDepsBat(python, pip)
echo 'Windows No Docker Test: Test'
testHelpers.testJunitBat(python, pip)
})
}
finally {
echo 'Windows No Docker Test: Cleanup'
step([$class: 'WsCleanup'])
}
}
def stateTestWindowsNoDocker = {
try {
echo 'Windows No Docker Test: Checkout csm'
checkout scm
testHelpers.createVirtualEnvAndExecute({ python, pip ->
echo 'Windows No Docker Test: Install dependencies'
testHelpers.installDepsBat(python, pip)
echo 'Windows No Docker Test: Test'
testHelpers.testJunitBat(python, pip)
})
}
finally {
echo 'Windows No Docker Test: Cleanup'
step([$class: 'WsCleanup'])
}
}
def buildDebUbuntu = { repoName, releaseVersion, sourcePath ->
def volumeName = "$name-deb-u1604"
if (env.BRANCH_NAME != '' && env.BRANCH_NAME != 'master') {
volumeName = "${volumeName}.${BRANCH_NAME}"
}
if (sh(script: "docker volume ls -q | grep -q '^$volumeName\$'", returnStatus: true) == 0) {
sh "docker volume rm $volumeName"
}
dir('build-scripts/ubuntu-1604') {
sh "./build-$name-docker.sh \"$sourcePath\" $releaseVersion $volumeName"
sh "./build-3rd-parties-docker.sh $volumeName"
}
return "$volumeName"
}
def options = new TestAndPublishOptions()
testAndPublish(name, [ubuntu: [plenum1: plenumTestUbuntuPart1, plenum2: plenumTestUbuntuPart2, plenum3: plenumTestUbuntuPart3,
ledger: ledgerTestUbuntu,
stp: stpTestUbuntu]], true, options, [ubuntu: buildDebUbuntu])