Commit 543e28c4 authored by Etienne Dysli Metref's avatar Etienne Dysli Metref 🦉
Browse files

Switch to the remotely-loaded Debian packaging pipeline

Hopefully, this saves us from having to keep `Jenkinsfile` up-to-date
in every branch of every packaging repository.

Gbp-Dch: Ignore
(cherry picked from commit b2a42272)
parent 45c587cf
def srcdir = 'package_source'
def vendor = env.BRANCH_NAME.split('/')[1]
def distribution = env.BRANCH_NAME.split('/')[2]
stage('Build packages') {
parallel(
amd64: {
node('debian') {
def architecture = 'amd64'
deleteSourceDirectory(srcdir)
echo("Distribution from branch name: ${distribution}")
checkoutAndBuildPackageInDirectory(srcdir, distribution, architecture, '')
sh 'ls -la'
testPackage(vendor, distribution, architecture)
uploadPackage(architecture)
archiveArtifacts artifacts: "*.dsc,*.debian.tar.?z,*.orig.tar.?z,*_${architecture}.build,*_${architecture}.changes,*_${architecture}.deb,*_all.deb", excludes: null, fingerprint: true
}
},
i386: {
node('debian') {
def architecture = 'i386'
deleteSourceDirectory(srcdir)
echo("Distribution from branch name: ${distribution}")
checkoutAndBuildPackageInDirectory(srcdir, distribution, architecture, '--binary-arch')
sh 'ls -la'
testPackage(vendor, distribution, architecture)
uploadPackage(architecture)
archiveArtifacts artifacts: "*_${architecture}.build,*_${architecture}.changes,*_${architecture}.deb", excludes: null, fingerprint: true
}
})
}
def deleteSourceDirectory(srcdir) {
step([$class: 'WsCleanup', patterns: [[pattern: srcdir, type: 'EXCLUDE']]])
}
def checkoutAndBuildPackageInDirectory(srcdir, distribution, architecture, gitPbuilderOptions) {
def gbpIgnore = '--git-ignore-branch'
dir(srcdir) {
checkout scm
if (updateChangelog()) {
gbpIgnore += ' --git-ignore-new'
}
sh "gbp buildpackage ${gbpIgnore} --git-pbuilder --git-dist=${distribution} --git-arch=${architecture} --git-pbuilder-autoconf --git-pbuilder-options=\"--configfile /data/aai/etc/pbuilder/pbuilderrc.${distribution} ${gitPbuilderOptions}\" -j -sa"
}
}
def updateChangelog() {
def changesDetected = sh(returnStatus: true, script: 'gbp dch --ignore-branch --auto | grep "No changes detected"') == 1
sh 'git checkout -- debian/changelog'
if (changesDetected) {
sh "gbp dch --ignore-branch --auto --snapshot --snapshot-number=${env.BUILD_NUMBER}"
}
changesDetected
}
def testPackage(vendor, distribution, architecture) {
sh "sudo piuparts -b /var/cache/pbuilder/base-${distribution}-${architecture}.tgz --keep-sources-list --distribution=${distribution} --arch=${architecture} --bindmount=/data/aai/debarchiver -I 'data/aai/debarchiver/.*' -D ${vendor} *_${architecture}.changes"
}
def uploadPackage(architecture) {
sh "sudo -g aai dput --config /data/aai/etc/dput.cf *_${architecture}.changes"
//Remotely load the Debian packaging pipeline
@Library('debian-jenkins-pipeline') _
node {
checkout([$class: 'GitSCM', branches: [[name: '*/master']], userRemoteConfigs: [[credentialsId: '6b7322de-8e55-4108-b362-c8261ac4d310', url: 'git@gitlab.switch.ch:etienne.dysli-metref/debian-jenkins-pipeline.git']]])
load 'DebianPackagingPipeline.groovy'
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment