forked from Cisco-Talos/clamav
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
145 lines (138 loc) · 7.24 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
properties(
[
disableConcurrentBuilds(),
parameters(
[
string(name: 'CLAMAV_BRANCH',
defaultValue: "${env.BRANCH_NAME}",
description: 'clamav-devel branch'),
string(name: 'VERSION',
defaultValue: '0.103.0-devel',
description: 'ClamAV version string'),
string(name: 'BUILD_BRANCH',
defaultValue: 'build-0.103',
description: 'test-pipelines branch for build acceptance'),
string(name: 'FRAMEWORK_BRANCH',
defaultValue: 'dev/0.103',
description: 'test-framework branch'),
string(name: 'TEST_BRANCH',
defaultValue: 'dev/0.103',
description: 'tests branch'),
string(name: 'TEST_CUSTOM_BRANCH',
defaultValue: 'dev/0.103',
description: 'tests-custom branch'),
string(name: 'REGULAR_PIPELINE',
defaultValue: 'regular-0.103',
description: 'test-pipelines branch for regular tests.'),
string(name: 'CUSTOM_PIPELINE',
defaultValue: 'custom-0.103',
description: 'test-pipelines branch for custom tests'),
string(name: 'FUZZ_PIPELINE',
defaultValue: 'fuzz-regression-0.103',
description: 'test-pipelines branch for fuzz regression tests'),
string(name: 'FUZZ_BRANCH',
defaultValue: 'master',
description: 'private-fuzz-corpus branch'),
string(name: 'FUZZ_TEST_BRANCH',
defaultValue: 'dev/0.103',
description: 'tests-fuzz-regression branch'),
string(name: 'SHARED_LIB_BRANCH',
defaultValue: 'master',
description: 'tests-jenkins-shared-libraries branch')
]
)
]
)
def buildResult
node('master') {
stage('Build') {
buildResult = build(job: "test-pipelines/${params.BUILD_BRANCH}",
propagate: true,
wait: true,
parameters: [
[$class: 'StringParameterValue', name: 'TARGET_BRANCH', value: "${params.CLAMAV_BRANCH}"],
[$class: 'StringParameterValue', name: 'FRAMEWORK_BRANCH', value: "${params.FRAMEWORK_BRANCH}"],
[$class: 'StringParameterValue', name: 'VERSION', value: "${params.VERSION}"],
[$class: 'StringParameterValue', name: 'SHARED_LIB_BRANCH', value: "${params.SHARED_LIB_BRANCH}"]
]
)
echo "test-pipelines/${params.BUILD_BRANCH} #${buildResult.number} succeeded."
}
stage('Test') {
def tasks = [:]
tasks["regular_and_custom"] = {
def regularResult
def exception = null
try {
stage("Regular Pipeline") {
regularResult = build(job: "test-pipelines/${params.REGULAR_PIPELINE}",
propagate: true,
wait: true,
parameters: [
[$class: 'StringParameterValue', name: 'BUILD_JOB_NAME', value: "test-pipelines/${params.BUILD_BRANCH}"],
[$class: 'StringParameterValue', name: 'BUILD_JOB_NUMBER', value: "${buildResult.number}"],
[$class: 'StringParameterValue', name: 'TEST_BRANCH', value: "${params.TEST_BRANCH}"],
[$class: 'StringParameterValue', name: 'FRAMEWORK_BRANCH', value: "${params.FRAMEWORK_BRANCH}"],
[$class: 'StringParameterValue', name: 'VERSION', value: "${params.VERSION}"],
[$class: 'StringParameterValue', name: 'SHARED_LIB_BRANCH', value: "${params.SHARED_LIB_BRANCH}"]
]
)
echo "test-pipelines/${params.REGULAR_PIPELINE} #${regularResult.number} succeeded."
}
} catch (exc) {
echo "test-pipelines/${params.REGULAR_PIPELINE} failed."
exception = exc
}
stage("Custom Pipeline") {
final customResult = build(job: "test-pipelines/${params.CUSTOM_PIPELINE}",
propagate: true,
wait: true,
parameters: [
[$class: 'StringParameterValue', name: 'BUILD_JOB_NAME', value: "test-pipelines/${params.BUILD_BRANCH}"],
[$class: 'StringParameterValue', name: 'BUILD_JOB_NUMBER', value: "${buildResult.number}"],
[$class: 'StringParameterValue', name: 'TEST_BRANCH', value: "${params.TEST_CUSTOM_BRANCH}"],
[$class: 'StringParameterValue', name: 'FRAMEWORK_BRANCH', value: "${params.FRAMEWORK_BRANCH}"],
[$class: 'StringParameterValue', name: 'VERSION', value: "${params.VERSION}"],
[$class: 'StringParameterValue', name: 'SHARED_LIB_BRANCH', value: "${params.SHARED_LIB_BRANCH}"]
]
)
echo "test-pipelines/${params.CUSTOM_PIPELINE} #${customResult.number} succeeded."
}
if(exception != null) {
echo "Custom Pipeline passed, but Regular pipeline failed!"
throw exception
}
}
tasks["fuzz_regression"] = {
stage("Fuzz Regression") {
final fuzzResult = build(job: "test-pipelines/${params.FUZZ_PIPELINE}",
propagate: true,
wait: true,
parameters: [
[$class: 'StringParameterValue', name: 'BUILD_JOB_NAME', value: "test-pipelines/${params.BUILD_BRANCH}"],
[$class: 'StringParameterValue', name: 'BUILD_JOB_NUMBER', value: "${buildResult.number}"],
[$class: 'StringParameterValue', name: 'FUZZ_TEST_BRANCH', value: "${params.FUZZ_TEST_BRANCH}"],
[$class: 'StringParameterValue', name: 'FUZZ_BRANCH', value: "${params.FUZZ_BRANCH}"],
[$class: 'StringParameterValue', name: 'VERSION', value: "${params.VERSION}"],
]
)
echo "test-pipelines/${params.FUZZ_PIPELINE} #${fuzzResult.number} succeeded."
}
}
tasks["appcheck"] = {
stage("AppCheck") {
final appcheckResult = build(job: "test-pipelines/appcheck",
propagate: true,
wait: true,
parameters: [
[$class: 'StringParameterValue', name: 'BUILD_JOB_NAME', value: "test-pipelines/${params.BUILD_BRANCH}"],
[$class: 'StringParameterValue', name: 'BUILD_JOB_NUMBER', value: "${buildResult.number}"],
[$class: 'StringParameterValue', name: 'VERSION', value: "${params.VERSION}"]
]
)
echo "test-pipelines/appcheck #${appcheckResult.number} succeeded."
}
}
parallel tasks
}
}