forked from hyperledger/indy-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.cd
136 lines (116 loc) · 3.72 KB
/
Jenkinsfile.cd
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
#!groovy
@Library('SovrinHelpers@v2.2.1') _
String name = 'indy-node'
String pkgName = name
String mainModuleName = 'indy_node'
Boolean gatherLogs = (params.GATHER_LOGS ?: env.GATHER_LOGS) != 'false'
def nodeTestUbuntu = {
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-node.${NODE_NAME}.txt", testDir: 'indy_node'])
//testHelpers.testJUnit(resFile: "test-result-node.${NODE_NAME}.xml")
}
}
finally {
echo 'Ubuntu Test: Cleanup'
step([$class: 'WsCleanup'])
}
}
def commonTestUbuntu = {
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([resFile: "test-result-common.${NODE_NAME}.xml", testDir: 'indy_common'])
}
}
finally {
echo 'Ubuntu Test: Cleanup'
step([$class: 'WsCleanup'])
}
}
def buildDebUbuntu = { releaseVersion, sourcePath, packageVersion=null, missedPkgs=false ->
def volumeName = "$name-deb-u1604"
packageVersion = packageVersion ?: releaseVersion
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"
}
// TODO build only missed ones
dir('build-scripts/ubuntu-1604') {
sh "./build-$name-docker.sh \"$sourcePath\" $releaseVersion $volumeName $packageVersion"
if (missedPkgs == [pkgName]) {
echo "Skip 3rd parties building"
} else {
sh "./build-3rd-parties-docker.sh $volumeName"
}
}
return "$volumeName"
}
def systemTests = { component, releaseVersion ->
def localLib
nodeWrapper('ubuntu') {
stage('Load local shared library') {
checkout scm
localLib = load 'ci/pipeline.groovy'
}
}
localLib.systemTests {
repoChannel = component
pkgVersion = releaseVersion
testSchema = [
['test_ledger.py'],
['TestViewChangeSuite.py'],
['TestConsensusSuite.py'],
['test_state_proof.py']
]
testVersion = 'v0.8.23'
testVersionByTag = true
delegate.gatherLogs = gatherLogs
}
}
def options = new TestAndPublishOptions()
options.setPkgName(pkgName)
options.setApprovers(['QA'])
options.setNotifEmails([
QA: [
to: "${env.INDY_NODE_QA_RECIPIENTS ?: ''}",
cc: "${env.INDY_NODE_RECIPIENTS ?: ''}"
],
success: [
to: "${env.INDY_NODE_RECIPIENTS ?: ''}"
],
fail: [
to: "${env.INDY_NODE_RECIPIENTS ?: ''}"
]
])
// TODO duplicates list from build scripts
options.setBuiltPkgs([
'python3-timeout-decorator': '0.4.0',
'python3-distro': '1.3.0',
])
options.enable([StagesEnum.PACK_RELEASE_COPY, StagesEnum.PACK_RELEASE_COPY_ST])
options.setCopyWithDeps(true)
options.setSystemTestsCb(systemTests)
options.setPrContexts([env.INDY_GITHUB_PR_REQUIRED_CONTEXT ?: "ci/hyperledger-jenkins/pr-merge"])
testAndPublish(
name,
[
ubuntu: [node: nodeTestUbuntu, common: commonTestUbuntu]
],
true, options, [ubuntu: buildDebUbuntu], mainModuleName
)