--- /dev/null
+pipeline {
+ agent none
+
+ stages {
+ /*
+ Run Pakfire through Clang's Static Analyzer...
+ */
+ stage("Clang Static Analyzer") {
+ agent {
+ docker {
+ image "debian:bookworm-backports"
+
+ // Run as root inside the containers to install dependencies
+ args "-u root"
+
+ customWorkspace "${JOB_NAME}/${BUILD_ID}/clang-static-analyzer"
+ }
+ }
+
+ stages {
+ stage("Install Dependencies") {
+ steps {
+ script {
+ installBuildDepsDebian("bookworm", "clang")
+
+ // Install Clang Tools
+ sh "apt-get install -y clang-tools"
+ }
+ }
+ }
+
+ stage("Configure") {
+ steps {
+ sh "./autogen.sh"
+ sh "scan-build ./configure --prefix=/usr --enable-debug"
+ }
+ }
+
+ stage("Build") {
+ steps {
+ sh "scan-build -o scan-build-output make"
+ }
+ }
+
+ stage("Publish Report") {
+ steps {
+ archiveArtifacts artifacts: "scan-build-output/**/*",
+ allowEmptyArchive: true
+ }
+ }
+ }
+ }
+
+ /*
+ Run the build and test suite on various distributions...
+ */
+ stage("Build on Multiple Distributions") {
+ matrix {
+ axes {
+ axis {
+ name "DISTRO"
+ values \
+ "almalinux:9", \
+ "archlinux:base-devel", \
+ "debian:trixie", \
+ "debian:bookworm-backports", \
+ "fedora:latest", \
+ "fedora:rawhide", \
+ "ubuntu:24.10", \
+ "ubuntu:24.04"
+ }
+
+ axis {
+ name "COMPILER"
+ values "gcc", "clang"
+ }
+ }
+
+ agent {
+ docker {
+ image "${DISTRO}"
+
+ // Run as root inside the containers to install dependencies
+ args "-u root"
+
+ customWorkspace "${JOB_NAME}/${BUILD_ID}/${env.DISTRO.replace(":", "-")}/${env.COMPILER}"
+ }
+ }
+
+ stages {
+ stage("Install Dependencies") {
+ steps {
+ script {
+ // Arch Linux
+ if (env.DISTRO.contains("archlinux")) {
+ installBuildDepsArchLinux(env.DISTRO, env.COMPILER)
+
+ // Fedora, Alma Linux, etc.
+ } else if (env.DISTRO.contains("fedora") || env.DISTRO.contains("almalinux")) {
+ installBuildDepsRedHat(env.DISTRO, env.COMPILER)
+
+ // Debian & Ubuntu
+ } else if (env.DISTRO.contains("debian") || env.DISTRO.contains("ubuntu")) {
+ installBuildDepsDebian(env.DISTRO, env.COMPILER)
+ }
+ }
+ }
+ }
+
+ stage("Configure") {
+ steps {
+ // Run autogen
+ sh "./autogen.sh"
+
+ // Run ./configure...
+ sh "CC=${env.COMPILER} ./configure --prefix=/usr --enable-debug"
+ }
+
+ post {
+ failure {
+ archiveArtifacts artifacts: "config.log",
+ allowEmptyArchive: true
+
+ echo "config.log has been archived"
+ }
+ }
+ }
+
+ stage("Build") {
+ steps {
+ sh "make"
+ }
+ }
+
+ stage("Check") {
+ steps {
+ script {
+ try {
+ sh "make check"
+ } catch (Exception e) {
+ unstable("Failed on ${env.DISTRO} with ${env.COMPILER}...")
+ }
+ }
+ }
+
+ post {
+ failure {
+ // Archive the logs only if the stage fails
+ archiveArtifacts artifacts: "tests/*/*.log",
+ fingerprint: true,
+ allowEmptyArchive: true
+
+ echo "The test logs have been archived"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+// Installs everything we need on RHEL/Fedora/etc.
+def installBuildDepsRedHat(distro, compier) {
+ // Install basic development tools
+ if (distro == "fedora:rawhide") {
+ sh "dnf group install -y development-tools"
+ } else {
+ sh "dnf group install -y 'Development Tools'"
+ }
+
+ // Enable CodeReady Builder for Almalinux 9
+ if (distro.contains("almalinux:9")) {
+ sh "dnf config-manager --set-enabled crb"
+ }
+
+ // Install our own build and runtime dependencies
+ sh """
+ dnf install -y \
+ asciidoc \
+ autoconf \
+ automake \
+ bison \
+ flex \
+ intltool \
+ libtool \
+ pkg-config \
+ ${compiler} \
+ \
+ elfutils-devel \
+ file-devel \
+ json-c-devel \
+ krb5-devel \
+ libarchive-devel \
+ libbpf-devel \
+ libcap-devel \
+ libcurl-devel \
+ libnl3-devel \
+ libseccomp-devel \
+ libsolv-devel \
+ libuuid-devel \
+ libzstd-devel \
+ openssl-devel \
+ pcre2-devel \
+ python3-devel \
+ sqlite-devel \
+ systemd-devel \
+ xz-devel
+ """
+}
+
+// Installs everything we need on Arch Linux
+def installBuildDepsArchLinux(distro, compiler) {
+ sh "pacman -Syu --noconfirm"
+ sh """
+ pacman -Sy \
+ --needed \
+ --noconfirm \
+ asciidoc \
+ autoconf \
+ automake \
+ bison \
+ flex \
+ intltool \
+ libtool \
+ pkg-config \
+ ${compiler} \
+ \
+ curl \
+ elfutils \
+ json-c \
+ libarchive \
+ libbpf \
+ libcap \
+ libnl \
+ libseccomp \
+ libsolv \
+ pcre2 \
+ python3 \
+ sqlite3 \
+ systemd \
+ util-linux-libs \
+ xz \
+ zstd
+ """
+}
+
+// Installs everything we need on Debian
+def installBuildDepsDebian(distro, compiler) {
+ sh "apt-get update"
+ sh """
+ apt-get install -y \
+ --no-install-recommends \
+ asciidoc \
+ autoconf \
+ automake \
+ bison \
+ build-essential \
+ flex \
+ intltool \
+ libtool \
+ pkg-config \
+ ${compiler} \
+ \
+ libarchive-dev \
+ libbpf-dev \
+ libcap-dev \
+ libcurl4-openssl-dev \
+ libdw-dev \
+ libelf-dev \
+ libpython3-dev \
+ libjson-c-dev \
+ libkrb5-dev \
+ liblzma-dev \
+ libmagic-dev \
+ libnl-3-dev \
+ libnl-route-3-dev \
+ libssl-dev \
+ libpcre2-dev \
+ libseccomp-dev \
+ libsolv-dev \
+ libsqlite3-dev \
+ libsystemd-dev \
+ libzstd-dev \
+ uuid-dev
+ """
+
+ // On bookworm, install cURL from backports for WebSocket support
+ if (distro.contains("bookworm")) {
+ sh "apt-get install -y libcurl4-openssl-dev/bookworm-backports"
+ }
+}