Skip to content

Commit 8436910

Browse files
andkononykhinashcherbakov
authored andcommitted
[WIP] Detaching CI logic from private repos (INDY-834) (#386)
* Detached testing logic from shared lib * defined missed nodes, stages and builds * fixed missing attributes, removed unnecessary things * custom test runner that wraps pytest * removed fortgotten variables * fixed path to runner.py * added service python codes and dockerfiles * added other ci related stages * fixed property name and declaration * flake8 * flake8 for runner.py * workaround for groovy sandbox violation * fixed automerge routine * fixed exception catch syntax * refactored test routine * fixed function parameter * added missed aprameter for test closures * removed automerge and istested stages, added some docs to Jenkinsfile * added default value for linux agent * added check for optional windows agent * updated docs, added email notifications * added options to skip stages, refactored stages * fixed names and build result check * fixed email notification * restored old Jenkinsfile, moved ci to Jenkinsfile.ci * made a copy of Jenkinsfile as cd routine
1 parent 45c91ce commit 8436910

File tree

4 files changed

+660
-0
lines changed

4 files changed

+660
-0
lines changed

Jenkinsfile.cd

Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
#!groovy
2+
3+
// TODO remove after shared libs refactoring
4+
@Library('SovrinHelpers') _
5+
6+
def name = 'indy-plenum'
7+
8+
def plenumTestUbuntu = { offset, increment ->
9+
try {
10+
echo 'Ubuntu Test: Checkout csm'
11+
checkout scm
12+
13+
echo 'Ubuntu Test: Build docker image'
14+
def testEnv = dockerHelpers.build(name)
15+
16+
testEnv.inside('--network host') {
17+
echo 'Ubuntu Test: Install dependencies'
18+
testHelpers.install()
19+
20+
echo 'Ubuntu Test: Test'
21+
testHelpers.testRunner([resFile: "test-result-plenum-$offset.${NODE_NAME}.txt", testDir: 'plenum', testOnlySlice: "$offset/$increment"])
22+
}
23+
}
24+
finally {
25+
echo 'Ubuntu Test: Cleanup'
26+
step([$class: 'WsCleanup'])
27+
}
28+
}
29+
30+
def plenumTestUbuntuPart1 = {
31+
plenumTestUbuntu(1, 3)
32+
}
33+
34+
def plenumTestUbuntuPart2 = {
35+
plenumTestUbuntu(2, 3)
36+
}
37+
38+
def plenumTestUbuntuPart3 = {
39+
plenumTestUbuntu(3, 3)
40+
}
41+
42+
def ledgerTestUbuntu = {
43+
try {
44+
echo 'Ubuntu Test: Checkout csm'
45+
checkout scm
46+
47+
echo 'Ubuntu Test: Build docker image'
48+
def testEnv = dockerHelpers.build(name)
49+
50+
testEnv.inside {
51+
echo 'Ubuntu Test: Install dependencies'
52+
testHelpers.install()
53+
54+
echo 'Ubuntu Test: Test'
55+
testHelpers.testJUnit([testDir: 'common', resFile: "test-result-common.${NODE_NAME}.xml"])
56+
testHelpers.testJUnit([testDir: 'ledger', resFile: "test-result-ledger.${NODE_NAME}.xml"])
57+
testHelpers.testJUnit([testDir: 'state', resFile: "test-result-state.${NODE_NAME}.xml"])
58+
testHelpers.testJUnit([testDir: 'storage', resFile: "test-result-storage.${NODE_NAME}.xml"])
59+
}
60+
61+
}
62+
finally {
63+
echo 'Ubuntu Test: Cleanup'
64+
step([$class: 'WsCleanup'])
65+
}
66+
}
67+
68+
def stpTestUbuntu = {
69+
try {
70+
echo 'Ubuntu Test: Checkout csm'
71+
checkout scm
72+
73+
echo 'Ubuntu Test: Build docker image'
74+
def testEnv = dockerHelpers.build(name)
75+
76+
testEnv.inside {
77+
echo 'Ubuntu Test: Install dependencies'
78+
testHelpers.install()
79+
80+
echo 'Ubuntu Test: Test'
81+
testHelpers.testJUnit([testDir: 'stp_raet', resFile: "test-result-stp-raet.${NODE_NAME}.xml"])
82+
testHelpers.testJUnit([testDir: 'stp_zmq', resFile: "test-result-stp-zmq.${NODE_NAME}.xml"])
83+
}
84+
}
85+
finally {
86+
echo 'Ubuntu Test: Cleanup'
87+
step([$class: 'WsCleanup'])
88+
}
89+
}
90+
91+
def plenumTestWindows = {
92+
echo 'TODO: Implement me'
93+
94+
/* win2016 for now (03-23-2017) is not supported by Docker for Windows
95+
* (Hyper-V version), so we can't use linux containers
96+
* https://github.com/docker/for-win/issues/448#issuecomment-276328342
97+
*
98+
* possible solutions:
99+
* - use host-installed OrientDB (trying this one)
100+
* - wait until Docker support will be provided for win2016
101+
*/
102+
103+
//try {
104+
// echo 'Windows Test: Checkout csm'
105+
// checkout scm
106+
107+
// echo 'Windows Test: Build docker image'
108+
// dockerHelpers.buildAndRunWindows(name, testHelpers.installDepsWindowsCommands() + ["cd C:\\test && python -m pytest -k orientdb --junit-xml=C:\\testOrig\\$testFile"] /*testHelpers.testJunitWindowsCommands()*/)
109+
// junit 'test-result.xml'
110+
//}
111+
//finally {
112+
// echo 'Windows Test: Cleanup'
113+
// step([$class: 'WsCleanup'])
114+
//}
115+
}
116+
117+
def ledgerTestWindows = {
118+
try {
119+
echo 'Windows Test: Checkout csm'
120+
checkout scm
121+
122+
echo 'Windows Test: Build docker image'
123+
dockerHelpers.buildAndRunWindows(name, testHelpers.installDepsWindowsCommands() + testHelpers.testJunitWindowsCommands())
124+
junit 'test-result.xml'
125+
}
126+
finally {
127+
echo 'Windows Test: Cleanup'
128+
step([$class: 'WsCleanup'])
129+
}
130+
}
131+
132+
def stateTestWindows = {
133+
try {
134+
echo 'Windows Test: Checkout csm'
135+
checkout scm
136+
137+
echo 'Windows Test: Build docker image'
138+
dockerHelpers.buildAndRunWindows(name, testHelpers.installDepsWindowsCommands() + testHelpers.testJunitWindowsCommands())
139+
junit 'test-result.xml'
140+
}
141+
finally {
142+
echo 'Windows Test: Cleanup'
143+
step([$class: 'WsCleanup'])
144+
}
145+
}
146+
147+
def plenumTestWindowsNoDocker = {
148+
try {
149+
echo 'Windows No Docker Test: Checkout csm'
150+
checkout scm
151+
152+
testHelpers.createVirtualEnvAndExecute({ python, pip ->
153+
echo 'Windows No Docker Test: Install dependencies'
154+
testHelpers.install(python: python, pip: pip, isVEnv: true)
155+
156+
echo 'Windows No Docker Test: Test'
157+
testHelpers.testRunner(resFile: "test-result.${NODE_NAME}.txt", python: python)
158+
})
159+
}
160+
finally {
161+
echo 'Windows No Docker Test: Cleanup'
162+
step([$class: 'WsCleanup'])
163+
}
164+
}
165+
166+
def ledgerTestWindowsNoDocker = {
167+
try {
168+
echo 'Windows No Docker Test: Checkout csm'
169+
checkout scm
170+
171+
testHelpers.createVirtualEnvAndExecute({ python, pip ->
172+
echo 'Windows No Docker Test: Install dependencies'
173+
testHelpers.installDepsBat(python, pip)
174+
175+
echo 'Windows No Docker Test: Test'
176+
testHelpers.testJunitBat(python, pip)
177+
})
178+
}
179+
finally {
180+
echo 'Windows No Docker Test: Cleanup'
181+
step([$class: 'WsCleanup'])
182+
}
183+
}
184+
185+
def stateTestWindowsNoDocker = {
186+
try {
187+
echo 'Windows No Docker Test: Checkout csm'
188+
checkout scm
189+
190+
testHelpers.createVirtualEnvAndExecute({ python, pip ->
191+
echo 'Windows No Docker Test: Install dependencies'
192+
testHelpers.installDepsBat(python, pip)
193+
194+
echo 'Windows No Docker Test: Test'
195+
testHelpers.testJunitBat(python, pip)
196+
})
197+
}
198+
finally {
199+
echo 'Windows No Docker Test: Cleanup'
200+
step([$class: 'WsCleanup'])
201+
}
202+
}
203+
204+
def buildDebUbuntu = { repoName, releaseVersion, sourcePath ->
205+
def volumeName = "$name-deb-u1604"
206+
sh "docker volume rm -f $volumeName"
207+
dir('build-scripts/ubuntu-1604') {
208+
sh "./build-$name-docker.sh $sourcePath $releaseVersion"
209+
sh "./build-3rd-parties-docker.sh"
210+
}
211+
return "$volumeName"
212+
}
213+
214+
def options = new TestAndPublishOptions()
215+
testAndPublish(name, [ubuntu: [plenum1: plenumTestUbuntuPart1, plenum2: plenumTestUbuntuPart2, plenum3: plenumTestUbuntuPart3,
216+
ledger: ledgerTestUbuntu,
217+
stp: stpTestUbuntu]], true, options, [ubuntu: buildDebUbuntu])

0 commit comments

Comments
 (0)