Browse code

Adds a new Jenkins pipeline that invokes QA test pipelines in parallel after build-acceptance creates build artifacts.

Micah Snyder authored on 2019/06/29 09:41:37
Showing 1 changed files
... ...
@@ -2,20 +2,128 @@ properties(
2 2
     [
3 3
         parameters(
4 4
             [
5
-                string(name: 'CLAMAV_BRANCH', defaultValue: "${env.BRANCH_NAME}"),
6
-                string(name: 'VERSION', defaultValue: '0.102.0-devel'),
7
-                string(name: 'TESTS_BRANCH', defaultValue: 'build-0.102')
5
+                string(name: 'CLAMAV_BRANCH',
6
+                       defaultValue: "${env.BRANCH_NAME}",
7
+                       description: 'clamav-devel branch'),
8
+                string(name: 'VERSION',
9
+                       defaultValue: '0.102.0-devel',
10
+                       description: 'ClamAV version string'),
11
+                string(name: 'BUILD_BRANCH',
12
+                       defaultValue: 'build-0.102',
13
+                       description: 'build-acceptance branch'),
14
+                string(name: 'TEST_BRANCH',
15
+                       defaultValue: 'dev/0.102',
16
+                       description: 'tests branch'),
17
+                string(name: 'REGULAR_PIPELINE',
18
+                       defaultValue: 'regular-scripted-chain-0.102',
19
+                       description: 'test-pipelines branch for regular tests.'),
20
+                string(name: 'CUSTOM_PIPELINE',
21
+                       defaultValue: 'custom-scripted-chain-0.102',
22
+                       description: 'test-pipelines branch for custom tests'),
23
+                string(name: 'FUZZ_PIPELINE',
24
+                       defaultValue: 'fuzz-regression-chain-0.102',
25
+                       description: 'test-pipelines branch for fuzz regression tests'),
26
+                string(name: 'FUZZ_BRANCH',
27
+                       defaultValue: 'master',
28
+                       description: 'private-fuzz-corpus branch'),
29
+                string(name: 'FUZZ_TEST_BRANCH',
30
+                       defaultValue: 'dev/0.102',
31
+                       description: 'tests-fuzz-regression branch')
8 32
             ]
9 33
         )
10 34
     ]
11 35
 )
12 36
 
37
+def buildResult
38
+
13 39
 node('master') {
14
-    build job: "clamav-build-acceptance/${params.TESTS_BRANCH}",
15
-        propagate: true,
16
-        wait: true,
17
-        parameters: [
18
-            [$class: 'StringParameterValue', name: 'TARGET_BRANCH', value: "${params.CLAMAV_BRANCH}"],
19
-            [$class: 'StringParameterValue', name: 'VERSION', value: "${params.VERSION}"]
20
-        ]
40
+    stage('Build') {
41
+        buildResult = build(job: "build-acceptance/${params.BUILD_BRANCH}",
42
+            propagate: true,
43
+            wait: true,
44
+            parameters: [
45
+                [$class: 'StringParameterValue', name: 'TARGET_BRANCH', value: "${params.CLAMAV_BRANCH}"],
46
+                [$class: 'StringParameterValue', name: 'VERSION', value: "${params.VERSION}"]
47
+            ]
48
+        )
49
+        echo "build-acceptance/${params.BUILD_BRANCH} #${buildResult.number} succeeded."
50
+    }
51
+
52
+    stage('Test') {
53
+        def tasks = [:]
54
+
55
+        tasks["regular_and_custom"] = {
56
+            def regularResult
57
+            def exception = null
58
+            try {
59
+                stage("Regular Pipeline") {
60
+                    regularResult = build(job: "test-pipelines/${params.REGULAR_PIPELINE}",
61
+                        propagate: true,
62
+                        wait: true,
63
+                        parameters: [
64
+                            [$class: 'StringParameterValue', name: 'BUILD_JOB_NAME', value: "build-acceptance/${params.BUILD_BRANCH}"],
65
+                            [$class: 'StringParameterValue', name: 'BUILD_JOB_NUMBER', value: "${buildResult.number}"],
66
+                            [$class: 'StringParameterValue', name: 'TEST_BRANCH', value: "${params.TEST_BRANCH}"],
67
+                            [$class: 'StringParameterValue', name: 'VERSION', value: "${params.VERSION}"]
68
+                        ]
69
+                    )
70
+                    echo "test-pipelines/${params.REGULAR_PIPELINE} #${regularResult.number} succeeded."
71
+                }
72
+            } catch (exc) {
73
+                echo "test-pipelines/${params.REGULAR_PIPELINE} #${regularResult.number} failed."
74
+                exception = exc
75
+            }
76
+            stage("Custom Pipeline") {
77
+                final customResult = build(job: "test-pipelines/${params.CUSTOM_PIPELINE}",
78
+                    propagate: true,
79
+                    wait: true,
80
+                    parameters: [
81
+                        [$class: 'StringParameterValue', name: 'BUILD_JOB_NAME', value: "build-acceptance/${params.BUILD_BRANCH}"],
82
+                        [$class: 'StringParameterValue', name: 'BUILD_JOB_NUMBER', value: "${buildResult.number}"],
83
+                        [$class: 'StringParameterValue', name: 'TEST_BRANCH', value: "${params.TEST_BRANCH}"],
84
+                        [$class: 'StringParameterValue', name: 'VERSION', value: "${params.VERSION}"]
85
+                    ]
86
+                )
87
+                echo "test-pipelines/${params.CUSTOM_PIPELINE} #${customResult.number} succeeded."
88
+            }
89
+            if(exception != null) {
90
+                echo "Custom Pipeline passed, but Regular pipeline failed!"
91
+                throw exception
92
+            }
93
+        }
94
+
95
+        tasks["fuzz_regression"] = {
96
+            stage("Fuzz Regression") {
97
+                final fuzzResult = build(job: "test-pipelines/${params.FUZZ_PIPELINE}",
98
+                    propagate: true,
99
+                    wait: true,
100
+                    parameters: [
101
+                        [$class: 'StringParameterValue', name: 'BUILD_JOB_NAME', value: "build-acceptance/${params.BUILD_BRANCH}"],
102
+                        [$class: 'StringParameterValue', name: 'BUILD_JOB_NUMBER', value: "${buildResult.number}"],
103
+                        [$class: 'StringParameterValue', name: 'FUZZ_TEST_BRANCH', value: "${params.FUZZ_TEST_BRANCH}"],
104
+                        [$class: 'StringParameterValue', name: 'FUZZ_BRANCH', value: "${params.FUZZ_BRANCH}"],
105
+                        [$class: 'StringParameterValue', name: 'VERSION', value: "${params.VERSION}"],
106
+                    ]
107
+                )
108
+                echo "test-pipelines/${params.FUZZ_PIPELINE} #${fuzzResult.number} succeeded."
109
+            }
110
+        }
111
+
112
+        tasks["appcheck"] = {
113
+            stage("AppCheck") {
114
+                final appcheckResult = build(job: "test-pipelines/appcheck",
115
+                    propagate: true,
116
+                    wait: true,
117
+                    parameters: [
118
+                        [$class: 'StringParameterValue', name: 'BUILD_JOB_NAME', value: "build-acceptance/${params.BUILD_BRANCH}"],
119
+                        [$class: 'StringParameterValue', name: 'BUILD_JOB_NUMBER', value: "${buildResult.number}"],
120
+                        [$class: 'StringParameterValue', name: 'VERSION', value: "${params.VERSION}"]
121
+                    ]
122
+                )
123
+                echo "test-pipelines/appcheck #${appcheckResult.number} succeeded."
124
+            }
125
+        }
126
+
127
+        parallel tasks
128
+    }
21 129
 }