Browse code

Jenkins: separate build pipeline and package test pipeline

The build pipeline used to build clamav packages and then test those
packages with a rudimentary test set. This change will build the clamav
packages in one pipeline - then test the packages in a new test pipeline.

The new test pipeline will use the larger test suite that we use for
testing from-source builds in the "regular" test pipeline.

Micah Snyder authored on 2024/05/23 04:42:23
Showing 1 changed files
... ...
@@ -11,19 +11,25 @@ properties(
11 11
                        description: 'test-framework branch'),
12 12
                 string(name: 'TESTS_BRANCH',
13 13
                        defaultValue: '0.103',
14
-                       description: 'tests branch'),
14
+                       description: 'tests branch for the package and regular tests'),
15 15
                 string(name: 'TESTS_CUSTOM_BRANCH',
16 16
                        defaultValue: '0.103',
17 17
                        description: 'tests-custom branch'),
18 18
                 string(name: 'TESTS_FUZZ_BRANCH',
19 19
                        defaultValue: '0.103',
20 20
                        description: 'tests-fuzz-regression branch'),
21
+                string(name: 'BUILD_PIPELINES_PATH',
22
+                       defaultValue: 'ClamAV/build-pipelines',
23
+                       description: 'build-pipelines path for clamav in Jenkins'),
21 24
                 string(name: 'TEST_PIPELINES_PATH',
22 25
                        defaultValue: 'ClamAV/test-pipelines',
23 26
                        description: 'test-pipelines path for clamav in Jenkins'),
24 27
                 string(name: 'BUILD_PIPELINE',
25 28
                        defaultValue: 'build-0.103',
26 29
                        description: 'test-pipelines branch for build acceptance'),
30
+                string(name: 'PACKAGE_PIPELINE',
31
+                       defaultValue: 'package-0.103',
32
+                       description: 'test-pipelines branch for package tests.'),
27 33
                 string(name: 'REGULAR_PIPELINE',
28 34
                        defaultValue: 'regular-0.103',
29 35
                        description: 'test-pipelines branch for regular tests.'),
... ...
@@ -47,7 +53,7 @@ properties(
47 47
     ]
48 48
 )
49 49
 
50
-node('ubuntu-18-x64') {
50
+node('default') {
51 51
     stage('Generate Tarball') {
52 52
         cleanWs()
53 53
 
... ...
@@ -81,10 +87,11 @@ node('ubuntu-18-x64') {
81 81
     def buildResult
82 82
 
83 83
     stage('Build') {
84
-        buildResult = build(job: "${params.TEST_PIPELINES_PATH}/${params.BUILD_PIPELINE}",
84
+        buildResult = build(job: "${params.BUILD_PIPELINES_PATH}/${params.BUILD_PIPELINE}",
85 85
             propagate: true,
86 86
             wait: true,
87 87
             parameters: [
88
+                [$class: 'StringParameterValue', name: 'PIPELINE_BRANCH_NAME', value: "${params.BUILD_PIPELINE}"],
88 89
                 [$class: 'StringParameterValue', name: 'CLAMAV_JOB_NAME', value: "${JOB_NAME}"],
89 90
                 [$class: 'StringParameterValue', name: 'CLAMAV_JOB_NUMBER', value: "${BUILD_NUMBER}"],
90 91
                 [$class: 'StringParameterValue', name: 'FRAMEWORK_BRANCH', value: "${params.FRAMEWORK_BRANCH}"],
... ...
@@ -92,21 +99,45 @@ node('ubuntu-18-x64') {
92 92
                 [$class: 'StringParameterValue', name: 'SHARED_LIB_BRANCH', value: "${params.SHARED_LIB_BRANCH}"]
93 93
             ]
94 94
         )
95
-        echo "${params.TEST_PIPELINES_PATH}/${params.BUILD_PIPELINE} #${buildResult.number} succeeded."
95
+        echo "${params.BUILD_PIPELINES_PATH}/${params.BUILD_PIPELINE} #${buildResult.number} succeeded."
96 96
     }
97 97
 
98 98
     stage('Test') {
99 99
         def tasks = [:]
100 100
 
101
-        tasks["regular_and_custom"] = {
102
-            def regularResult
101
+        tasks["package_regular_custom"] = {
103 102
             def exception = null
104 103
             try {
105
-                stage("Regular Pipeline") {
106
-                    regularResult = build(job: "${params.TEST_PIPELINES_PATH}/${params.REGULAR_PIPELINE}",
104
+                stage("Package") {
105
+                    final regularResult = build(job: "${params.TEST_PIPELINES_PATH}/${params.PACKAGE_PIPELINE}",
107 106
                         propagate: true,
108 107
                         wait: true,
109 108
                         parameters: [
109
+                            [$class: 'StringParameterValue', name: 'PIPELINE_BRANCH_NAME', value: "${params.PACKAGE_PIPELINE}"],
110
+                            [$class: 'StringParameterValue', name: 'CLAMAV_JOB_NAME', value: "${JOB_NAME}"],
111
+                            [$class: 'StringParameterValue', name: 'CLAMAV_JOB_NUMBER', value: "${BUILD_NUMBER}"],
112
+                            [$class: 'StringParameterValue', name: 'BUILD_JOB_NAME', value: "${params.TEST_PIPELINES_PATH}/${params.BUILD_PIPELINE}"],
113
+                            [$class: 'StringParameterValue', name: 'BUILD_JOB_NUMBER', value: "${buildResult.number}"],
114
+                            [$class: 'StringParameterValue', name: 'TESTS_BRANCH', value: "${params.TESTS_BRANCH}"],
115
+                            [$class: 'StringParameterValue', name: 'FRAMEWORK_BRANCH', value: "${params.FRAMEWORK_BRANCH}"],
116
+                            [$class: 'StringParameterValue', name: 'VERSION', value: "${params.VERSION}"],
117
+                            [$class: 'StringParameterValue', name: 'SHARED_LIB_BRANCH', value: "${params.SHARED_LIB_BRANCH}"]
118
+                        ]
119
+                    )
120
+                    echo "${params.TEST_PIPELINES_PATH}/${params.PACKAGE_PIPELINE} #${regularResult.number} succeeded."
121
+                }
122
+            } catch (exc) {
123
+                echo "${params.TEST_PIPELINES_PATH}/${params.PACKAGE_PIPELINE} failed."
124
+                exception = exc
125
+            }
126
+
127
+            try {
128
+                stage("Regular From-Source") {
129
+                    final regularResult = build(job: "${params.TEST_PIPELINES_PATH}/${params.REGULAR_PIPELINE}",
130
+                        propagate: true,
131
+                        wait: true,
132
+                        parameters: [
133
+                            [$class: 'StringParameterValue', name: 'PIPELINE_BRANCH_NAME', value: "${params.REGULAR_PIPELINE}"],
110 134
                             [$class: 'StringParameterValue', name: 'CLAMAV_JOB_NAME', value: "${JOB_NAME}"],
111 135
                             [$class: 'StringParameterValue', name: 'CLAMAV_JOB_NUMBER', value: "${BUILD_NUMBER}"],
112 136
                             [$class: 'StringParameterValue', name: 'BUILD_JOB_NAME', value: "${params.TEST_PIPELINES_PATH}/${params.BUILD_PIPELINE}"],
... ...
@@ -123,11 +154,13 @@ node('ubuntu-18-x64') {
123 123
                 echo "${params.TEST_PIPELINES_PATH}/${params.REGULAR_PIPELINE} failed."
124 124
                 exception = exc
125 125
             }
126
-            stage("Custom Pipeline") {
126
+
127
+            stage("Custom From-Source") {
127 128
                 final customResult = build(job: "${params.TEST_PIPELINES_PATH}/${params.CUSTOM_PIPELINE}",
128 129
                     propagate: true,
129 130
                     wait: true,
130 131
                     parameters: [
132
+                        [$class: 'StringParameterValue', name: 'PIPELINE_BRANCH_NAME', value: "${params.CUSTOM_PIPELINE}"],
131 133
                         [$class: 'StringParameterValue', name: 'CLAMAV_JOB_NAME', value: "${JOB_NAME}"],
132 134
                         [$class: 'StringParameterValue', name: 'CLAMAV_JOB_NUMBER', value: "${BUILD_NUMBER}"],
133 135
                         [$class: 'StringParameterValue', name: 'TESTS_BRANCH', value: "${params.TESTS_CUSTOM_BRANCH}"],
... ...
@@ -139,7 +172,7 @@ node('ubuntu-18-x64') {
139 139
                 echo "${params.TEST_PIPELINES_PATH}/${params.CUSTOM_PIPELINE} #${customResult.number} succeeded."
140 140
             }
141 141
             if(exception != null) {
142
-                echo "Custom Pipeline passed, but Regular pipeline failed!"
142
+                echo "Custom Pipeline passed, but prior pipelines failed!"
143 143
                 throw exception
144 144
             }
145 145
         }