]> git.ipfire.org Git - pakfire.git/commitdiff
jenkins: Group the package mastering stages together
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 26 Oct 2024 13:48:05 +0000 (13:48 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 26 Oct 2024 13:50:06 +0000 (13:50 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Jenkinsfile

index 90b8adca24998b3c164766cbd8223c3b0571dad5..d96eb74a2c5c33af59d1c935661fed2bb20ccdfc 100644 (file)
@@ -131,7 +131,7 @@ pipeline {
                /*
                        Run the build and test suite on various distributions...
                */
-               stage("Build on Multiple Distributions") {
+               stage("Run Tests on Multiple Distributions") {
                        matrix {
                                axes {
                                        axis {
@@ -238,140 +238,141 @@ pipeline {
                        }
                }
 
-               /*
-                       Debian Packages
-               */
-               stage("Build Debian Packages") {
-                       matrix {
-                               axes {
-                                       axis {
-                                               name "IMAGE"
-                                               values "debian:trixie", "debian:bookworm-backports"
-                                       }
-
-                                       axis {
-                                               name "ARCH"
-                                               values "amd64", "arm64"
-                                       }
-                               }
+               stage("Debian Packages") {
+                       stages {
+                               stage("Build Debian Packages") {
+                                       matrix {
+                                               axes {
+                                                       axis {
+                                                               name "IMAGE"
+                                                               values "debian:trixie", "debian:bookworm-backports"
+                                                       }
 
-                               agent {
-                                       docker {
-                                               image "${IMAGE}"
+                                                       axis {
+                                                               name "ARCH"
+                                                               values "amd64", "arm64"
+                                                       }
+                                               }
 
-                                               // Run as root inside the containers to install dependencies
-                                               args "-u root"
+                                               agent {
+                                                       docker {
+                                                               image "${IMAGE}"
 
-                                               customWorkspace "${JOB_NAME}/${BUILD_ID}/${IMAGE.replace(":", "-")}/${ARCH}"
-                                       }
-                               }
+                                                               // Run as root inside the containers to install dependencies
+                                                               args "-u root"
 
-                               stages {
-                                       stage("Setup Build Environment") {
-                                               steps {
-                                                       // Add the architecture
-                                                       sh "dpkg --add-architecture ${env.ARCH}"
-                                                       sh "apt-get update"
-
-                                                       // Install required packages
-                                                       sh """
-                                                               apt-get install -y \
-                                                                       build-essential \
-                                                                       crossbuild-essential-${env.ARCH} \
-                                                                       devscripts \
-                                                                       qemu-user-static
-                                                       """
+                                                               customWorkspace "${JOB_NAME}/${BUILD_ID}/${IMAGE.replace(":", "-")}/${ARCH}"
+                                                       }
                                                }
-                                       }
 
-                                       stage("Install Build Dependencies") {
-                                               steps {
-                                                       // Install all build dependencies
-                                                       sh "apt-get build-dep -y -a${env.ARCH} ."
-                                               }
-                                       }
+                                               stages {
+                                                       stage("Setup Build Environment") {
+                                                               steps {
+                                                                       // Add the architecture
+                                                                       sh "dpkg --add-architecture ${env.ARCH}"
+                                                                       sh "apt-get update"
+
+                                                                       // Install required packages
+                                                                       sh """
+                                                                               apt-get install -y \
+                                                                                       build-essential \
+                                                                                       crossbuild-essential-${env.ARCH} \
+                                                                                       devscripts \
+                                                                                       qemu-user-static
+                                                                       """
+                                                               }
+                                                       }
 
-                                       stage("Tag") {
-                                               steps {
-                                                       sh "dch -m \"Jenkins Build ${BUILD_ID}\" -l .build-${BUILD_ID}."
-                                               }
-                                       }
+                                                       stage("Install Build Dependencies") {
+                                                               steps {
+                                                                       // Install all build dependencies
+                                                                       sh "apt-get build-dep -y -a${env.ARCH} ."
+                                                               }
+                                                       }
 
-                                       stage("Build") {
-                                               steps {
-                                                       sh """
-                                                               dpkg-buildpackage \
-                                                                       --host-arch ${env.ARCH} \
-                                                                       --build=any
-
-                                                               # Move the packages
-                                                               mkdir -pv uploads
-                                                               mv -v ../*.deb uploads/
-                                                       """
-                                               }
-                                       }
+                                                       stage("Tag") {
+                                                               steps {
+                                                                       sh "dch -m \"Jenkins Build ${BUILD_ID}\" -l .build-${BUILD_ID}."
+                                                               }
+                                                       }
 
-                                       stage("Upload Packages") {
-                                               steps {
-                                                       archiveArtifacts artifacts: "uploads/**"
-                                               }
-                                       }
+                                                       stage("Build") {
+                                                               steps {
+                                                                       sh """
+                                                                               dpkg-buildpackage \
+                                                                                       --host-arch ${env.ARCH} \
+                                                                                       --build=any
+
+                                                                               # Move the packages
+                                                                               mkdir -pv uploads
+                                                                               mv -v ../*.deb uploads/
+                                                                       """
+                                                               }
+                                                       }
 
-                                       stage("Create Repository") {
-                                               environment {
-                                                       DISTRO = "${IMAGE.replace("debian:", "").replace("-backports", "")}"
-                                               }
+                                                       stage("Upload Packages") {
+                                                               steps {
+                                                                       archiveArtifacts artifacts: "uploads/**"
+                                                               }
+                                                       }
 
-                                               steps {
-                                                       // Create a repository and generate Packages
-                                                       sh """
-                                                               mkdir -pv \
-                                                                       dists/${DISTRO}/main/binary-${ARCH} \
-                                                                       pool/${DISTRO}/main/${ARCH}
-
-                                                               # Copy all packages
-                                                               cp -v uploads/*.deb pool/${DISTRO}/main/${ARCH}
-
-                                                               # Generate Packages.gz
-                                                               dpkg-scanpackages pool/${DISTRO}/main/${ARCH} \
-                                                                       | gzip -9 > dists/${DISTRO}/main/binary-${ARCH}/Packages.gz
-                                                       """
-
-                                                       // Stash the packages
-                                                       stash includes: "dists/**/*, pool/**/*",
-                                                               name: "${DISTRO}-${ARCH}"
+                                                       stage("Create Repository") {
+                                                               environment {
+                                                                       DISTRO = "${IMAGE.replace("debian:", "").replace("-backports", "")}"
+                                                               }
+
+                                                               steps {
+                                                                       // Create a repository and generate Packages
+                                                                       sh """
+                                                                               mkdir -pv \
+                                                                                       dists/${DISTRO}/main/binary-${ARCH} \
+                                                                                       pool/${DISTRO}/main/${ARCH}
+
+                                                                               # Copy all packages
+                                                                               cp -v uploads/*.deb pool/${DISTRO}/main/${ARCH}
+
+                                                                               # Generate Packages.gz
+                                                                               dpkg-scanpackages pool/${DISTRO}/main/${ARCH} \
+                                                                                       | gzip -9 > dists/${DISTRO}/main/binary-${ARCH}/Packages.gz
+                                                                       """
+
+                                                                       // Stash the packages
+                                                                       stash includes: "dists/**/*, pool/**/*",
+                                                                               name: "${DISTRO}-${ARCH}"
+                                                               }
+                                                       }
                                                }
                                        }
                                }
-                       }
-               }
 
-               stage("Update Debian Repository") {
-                       agent {
-                               docker {
-                                       image "debian:trixie"
-
-                                       // Run as root inside the containers to install dependencies
-                                       args "-u root"
+                               stage("Update Debian Repository") {
+                                       agent {
+                                               docker {
+                                                       image "debian:trixie"
 
-                                       customWorkspace "${JOB_NAME}/${BUILD_ID}/update-debian-repo"
-                               }
-                       }
+                                                       // Run as root inside the containers to install dependencies
+                                                       args "-u root"
 
-                       steps {
-                               // Unstash all stashed packages from the matrix build
-                               script {
-                                       for (distro in ["trixie", "bookworm"]) {
-                                               for (arch in ["amd64", "arm64"]) {
-                                                       unstash "${distro}-${arch}"
+                                                       customWorkspace "${JOB_NAME}/${BUILD_ID}/update-debian-repo"
                                                }
                                        }
-                               }
 
-                               // Upload everything again
-                               archiveArtifacts artifacts: "dists/**/*, pool/**/*"
+                                       steps {
+                                               // Unstash all stashed packages from the matrix build
+                                               script {
+                                                       for (distro in ["trixie", "bookworm"]) {
+                                                               for (arch in ["amd64", "arm64"]) {
+                                                                       unstash "${distro}-${arch}"
+                                                               }
+                                                       }
+                                               }
+
+                                               // Upload everything again
+                                               archiveArtifacts artifacts: "dists/**/*, pool/**/*"
 
-                               // XXX This needs to be published on a mirror server somewhere
+                                               // XXX This needs to be published on a mirror server somewhere
+                                       }
+                               }
                        }
                }
        }