From 2a6f20f2aef838f8c55959485a4ca7dc2301d39a Mon Sep 17 00:00:00 2001 From: Micah Snyder Date: Wed, 28 Aug 2024 15:42:31 -0400 Subject: [PATCH] Jenkins: build tarball in Docker container Due to build issues with libldtl and/or Autotools in Ubuntu:22.04, perform the build within a Docker container running Ubuntu:18.04. --- Jenkins/Dockerfile | 6 ++++++ Jenkinsfile | 27 +++++++++++++++++++-------- 2 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 Jenkins/Dockerfile diff --git a/Jenkins/Dockerfile b/Jenkins/Dockerfile new file mode 100644 index 0000000000..1d6759f872 --- /dev/null +++ b/Jenkins/Dockerfile @@ -0,0 +1,6 @@ +FROM ubuntu:18.04 + +RUN apt-get update && apt-get install -y \ + gcc make automake autoconf m4 pkg-config libtool flex bison valgrind \ + check libbz2-dev libcurl4-openssl-dev libjson-c-dev libmilter-dev \ + libncurses5-dev libpcre2-dev libssl-dev libxml2-dev zlib1g-dev diff --git a/Jenkinsfile b/Jenkinsfile index 114671eca9..7c3768cd60 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -53,7 +53,7 @@ properties( ] ) -node('default') { +node('docker') { stage('Generate Tarball') { cleanWs() @@ -72,13 +72,24 @@ node('default') { ''' } - dir(path: 'build') { - sh """# Make Dist - if [ -f '../autogen.sh' ] ; then /bin/chmod +x ../autogen.sh && ../autogen.sh ; fi - ../configure --enable-milter --disable-clamav --disable-silent-rules --enable-llvm --with-system-llvm=no - make distcheck - mv clamav-${params.VERSION}*.tar.gz clamav-${params.VERSION}.tar.gz || true""" - archiveArtifacts(artifacts: "clamav-${params.VERSION}.tar.gz", onlyIfSuccessful: true) + // start up docker image + def dockerImage = docker.build("autoconf", "./Jenkins") + + try { + dockerImage.inside("-u root --privileged") { c -> + dir(path: "build") { + sh """# Make Dist + if [ -f '../autogen.sh' ] ; then /bin/chmod +x ../autogen.sh && ../autogen.sh ; fi + ../configure --enable-milter --disable-clamav --disable-silent-rules --enable-llvm --with-system-llvm=no + make distcheck + mv clamav-${params.VERSION}*.tar.gz clamav-${params.VERSION}.tar.gz || true""" + archiveArtifacts(artifacts: "clamav-${params.VERSION}.tar.gz", onlyIfSuccessful: true) + } + } + } + catch(IOException err) { + cleanWs() + throw err } cleanWs()