From 989da6a3b9ab378ca7f4554f05f9f6904e2ee9f1 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com> Date: Wed, 10 Feb 2021 13:21:25 -0500 Subject: [PATCH] ci: Add a Jenkinsfile to build the packages. The pipeline code is modernized to use the declarative pipeline DSL of Jenkins, and the GNU/Linux package builds now all share the same source release archive, which is built from cached contribs tarballs when available. GitLab: https://git.jami.net/savoirfairelinux/jami-packaging/-/issues/55 Change-Id: Id7f37966dd80c36cfa0ebdd461c0ab90505dcd37 --- Jenkinsfile | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..3c22a775 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,93 @@ +// Packaging validation for supported GNU/Linux systems. +// +// Note: To work on this script without having to push a commit each +// time, use the jenkins-cli command (see: +// https://wiki.savoirfairelinux.com/wiki/Jenkins.jami.net#Usage_CLI_de_Jenkins). +pipeline { + agent { + label 'guix' + } + + environment { + TARBALLS = '/opt/ring-contrib' // set the cache directory + } + + options { + ansiColor('xterm') + } + + stages { + stage('Check configuration') { + when { not { expression { fileExists TARBALLS } } } + steps { + error "The ${TARBALLS} directory does not exist. \ +See https://wiki.savoirfairelinux.com/wiki/Jenkins.jami.net#Configuration" + } + } + + stage('Fetch submodules') { + steps { + echo 'Updating relevant submodules to their latest commit' + sh 'git submodule update --init --recursive --remote' + + 'daemon lrc client-gnome client-qt' + } + } + + stage('Generate release tarball') { + steps { + // The bundled tarballs included in the release + // tarball depend on what is available on the host. + // To ensure it can be shared across all different + // GNU/Linux distributions, generate it in a minimal + // container. Wget uses GnuTLS, which looks up its + // certs from /etc/ssl/certs. + sh ''' + #!/usr/bin/env bash + test -f $HOME/.bashrc && . $HOME/.bashrc + guix environment --container --network -E TARBALLS --share=$TARBALLS \ + --expose=$SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt --ad-hoc \ + coreutils \ + gcc-toolchain \ + git-minimal \ + grep \ + gzip \ + make \ + nss-certs \ + pkg-config \ + python \ + sed \ + tar \ + wget \ + xz -- make release-tarball + ''' + } + } + + stage('Build packages') { + environment { + DISABLE_CONTRIB_DOWNLOADS = 'TRUE' + // The following password is used to register with the + // RHEL subscription-manager tool, required to build on RHEL. + PASS = credentials('developers-redhat-com') + } + steps { + script { + def targetsText = sh script: 'make -s list-package-targets', returnStdout: true + def targets = targetsText.split('\n') + def stages = [:] + + targets.each { target -> + // Note: The stage calls are wrapped in closures, to + // delay their execution. + stages["${target}"] = { + stage("stage: ${target}") { + sh "make ${target}" + } + } + } + parallel stages + } + } + } + } +} -- GitLab