Skip to content

Commit

Permalink
Merge pull request Cisco-Talos#1272 from micahsnyder/CLAM-2615-git-pi…
Browse files Browse the repository at this point in the history
…peline-migration

Jenkins: separate build pipeline and package test pipeline
micahsnyder authored Jun 25, 2024
2 parents 8317780 + d84ec62 commit 4eb26b6
Showing 1 changed file with 59 additions and 12 deletions.
71 changes: 59 additions & 12 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -17,19 +17,25 @@ properties(
description: 'test-framework branch'),
string(name: 'TESTS_BRANCH',
defaultValue: '1.4',
description: 'tests branch'),
description: 'tests branch for the package and regular tests'),
string(name: 'TESTS_CUSTOM_BRANCH',
defaultValue: '1.4',
description: 'tests-custom branch'),
string(name: 'TESTS_FUZZ_BRANCH',
defaultValue: '1.4',
description: 'tests-fuzz-regression branch'),
string(name: 'BUILD_PIPELINES_PATH',
defaultValue: 'ClamAV/build-pipelines',
description: 'build-pipelines path for clamav in Jenkins'),
string(name: 'TEST_PIPELINES_PATH',
defaultValue: 'ClamAV/test-pipelines',
description: 'test-pipelines path for clamav in Jenkins'),
string(name: 'BUILD_PIPELINE',
defaultValue: 'build-1.4',
description: 'test-pipelines branch for build acceptance'),
string(name: 'PACKAGE_PIPELINE',
defaultValue: 'package-1.4',
description: 'test-pipelines branch for package tests.'),
string(name: 'REGULAR_PIPELINE',
defaultValue: 'regular-1.4',
description: 'test-pipelines branch for regular tests.'),
@@ -50,7 +56,7 @@ properties(
]
)

node('ubuntu-18-x64') {
node('default') {
stage('Generate Tarball') {
cleanWs()

@@ -71,7 +77,27 @@ node('ubuntu-18-x64') {

dir(path: 'build') {
sh """# CPack
cmake .. -D VENDOR_DEPENDENCIES=ON
cmake .. -D VENDOR_DEPENDENCIES=ON \
-D JSONC_INCLUDE_DIR="$HOME/.mussels/install/host-static/include/json-c" \
-D JSONC_LIBRARY="$HOME/.mussels/install/host-static/lib/libjson-c.a" \
-D ENABLE_JSON_SHARED=OFF \
-D BZIP2_INCLUDE_DIR="$HOME/.mussels/install/host-static/include" \
-D BZIP2_LIBRARY_RELEASE="$HOME/bzip2-1.0.8-install/lib/libbz2.a" \
-D OPENSSL_ROOT_DIR="$HOME/.mussels/install/host-static" \
-D OPENSSL_INCLUDE_DIR="$HOME/.mussels/install/host-static/include" \
-D OPENSSL_CRYPTO_LIBRARY="$HOME/.mussels/install/host-static/lib/libcrypto.a" \
-D OPENSSL_SSL_LIBRARY="$HOME/.mussels/install/host-static/lib/libssl.a" \
-D LIBXML2_INCLUDE_DIR="$HOME/.mussels/install/host-static/include/libxml2" \
-D LIBXML2_LIBRARY="$HOME/.mussels/install/host-static/lib/libxml2.a" \
-D PCRE2_INCLUDE_DIR="$HOME/.mussels/install/host-static/include" \
-D PCRE2_LIBRARY="$HOME/.mussels/install/host-static/lib/libpcre2-8.a" \
-D CURSES_INCLUDE_DIR="$HOME/.mussels/install/host-static/include" \
-D CURSES_LIBRARY="$HOME/.mussels/install/host-static/lib/libncurses.a;$HOME/.mussels/install/host-static/lib/libtinfo.a" \
-D ZLIB_INCLUDE_DIR="$HOME/.mussels/install/host-static/include" \
-D ZLIB_LIBRARY="$HOME/.mussels/install/host-static/lib/libz.a" \
-D LIBCHECK_INCLUDE_DIR="$HOME/.mussels/install/host-static/include" \
-D LIBCHECK_LIBRARY="$HOME/.mussels/install/host-static/lib/libcheck.a"
cpack --config CPackSourceConfig.cmake """
archiveArtifacts(artifacts: "clamav-${params.VERSION}*.tar.gz", onlyIfSuccessful: true)
}
@@ -82,7 +108,7 @@ node('ubuntu-18-x64') {
def buildResult

stage('Build') {
buildResult = build(job: "${params.TEST_PIPELINES_PATH}/${params.BUILD_PIPELINE}",
buildResult = build(job: "${params.BUILD_PIPELINES_PATH}/${params.BUILD_PIPELINE}",
propagate: true,
wait: true,
parameters: [
@@ -93,38 +119,59 @@ node('ubuntu-18-x64') {
[$class: 'StringParameterValue', name: 'SHARED_LIB_BRANCH', value: "${params.SHARED_LIB_BRANCH}"]
]
)
echo "${params.TEST_PIPELINES_PATH}/${params.BUILD_PIPELINE} #${buildResult.number} succeeded."
echo "${params.BUILD_PIPELINES_PATH}/${params.BUILD_PIPELINE} #${buildResult.number} succeeded."
}

stage('Test') {
def tasks = [:]

tasks["regular_and_custom"] = {
def regularResult
tasks["package_regular_custom"] = {
def exception = null
try {
stage("Regular Pipeline") {
regularResult = build(job: "${params.TEST_PIPELINES_PATH}/${params.REGULAR_PIPELINE}",
stage("Package") {
final regularResult = build(job: "${params.TEST_PIPELINES_PATH}/${params.PACKAGE_PIPELINE}",
propagate: true,
wait: true,
parameters: [
[$class: 'StringParameterValue', name: 'CLAMAV_JOB_NAME', value: "${JOB_NAME}"],
[$class: 'StringParameterValue', name: 'CLAMAV_JOB_NUMBER', value: "${BUILD_NUMBER}"],
[$class: 'StringParameterValue', name: 'BUILD_JOB_NAME', value: "${params.TEST_PIPELINES_PATH}/${params.BUILD_PIPELINE}"],
[$class: 'StringParameterValue', name: 'BUILD_JOB_NAME', value: "${params.BUILD_PIPELINES_PATH}/${params.BUILD_PIPELINE}"],
[$class: 'StringParameterValue', name: 'BUILD_JOB_NUMBER', value: "${buildResult.number}"],
[$class: 'StringParameterValue', name: 'TESTS_BRANCH', value: "${params.TESTS_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 "${params.TEST_PIPELINES_PATH}/${params.PACKAGE_PIPELINE} #${regularResult.number} succeeded."
}
} catch (exc) {
echo "${params.TEST_PIPELINES_PATH}/${params.PACKAGE_PIPELINE} failed."
exception = exc
}

try {
stage("Regular From-Source") {
final regularResult = build(job: "${params.TEST_PIPELINES_PATH}/${params.REGULAR_PIPELINE}",
propagate: true,
wait: true,
parameters: [
[$class: 'StringParameterValue', name: 'CLAMAV_JOB_NAME', value: "${JOB_NAME}"],
[$class: 'StringParameterValue', name: 'CLAMAV_JOB_NUMBER', value: "${BUILD_NUMBER}"],
[$class: 'StringParameterValue', name: 'TESTS_BRANCH', value: "${params.TESTS_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 "${params.TEST_PIPELINES_PATH}/${params.REGULAR_PIPELINE} #${regularResult.number} succeeded."
}
} catch (exc) {
echo "${params.TEST_PIPELINES_PATH}/${params.REGULAR_PIPELINE} failed."
exception = exc
}
stage("Custom Pipeline") {

stage("Custom From-Source") {
final customResult = build(job: "${params.TEST_PIPELINES_PATH}/${params.CUSTOM_PIPELINE}",
propagate: true,
wait: true,
@@ -140,7 +187,7 @@ node('ubuntu-18-x64') {
echo "${params.TEST_PIPELINES_PATH}/${params.CUSTOM_PIPELINE} #${customResult.number} succeeded."
}
if(exception != null) {
echo "Custom Pipeline passed, but Regular pipeline failed!"
echo "Custom Pipeline passed, but prior pipelines failed!"
throw exception
}
}

0 comments on commit 4eb26b6

Please sign in to comment.