Commit c5970ad1 authored by Guido Gunther's avatar Guido Gunther
Browse files

Initial commit

parents
deb-build-jobs
==============
Jenkins job definitions for building Debian packages. To add new jobs
simple append a new job definition to *jobs.yaml*.
Job definitions
===============
A job definition looks like:
<pkg>:
url: <giturl>
archs: <list of architectures>
branch: <gitbranch>
e.g.
virt-what:
url: https://anonscm.debian.org/git/pkg-libvirt/virt-what.git
archs: ['aarch64', 'armhf']
branch: 'debian/sid'
Only the *url* parameter is mandatory otherwise defaults will be used.
How it works
============
The job definitions are read by a seed job in Jenkins on commit to
update the job definitions for building Debian packages. The seed jobs
reads *jobs.groovy* (using [Jenkins Job DSL][1] which in turn
processes *jobs.yaml* containing the actual job definitions. When jobs
are removed from *jobs.yaml* they get disabled in Jenkins automatically.
Note that if you change the groovy script itself you need to approve these
changes using Jenkins in process script approval
(https://yourjenkins/scriptApproval/).
[1]: https://wiki.jenkins.io/display/JENKINS/Job+DSL+Plugin
@Grab('org.yaml:snakeyaml:1.17')
import org.yaml.snakeyaml.Yaml
// The Operating system we build for. This is the first part
// of the git branch: ${os}/${dist}
def os = 'debian'
// Default distribution to build for
def default_dists = ['buster']
// Default architectures to build for
def default_archs = ['aarch64']
// Options to pass to git-buildpackage
def default_args = '--git-pbuilder --git-ignore-new --git-ignore-branch -nc'
// All jobs will be generated in this folder
def folder = 'debs'
// The build nodes architecture
def native_arch = 'aarch64'
// Load jobs from YAML file
Yaml yaml = new Yaml()
def jobsfile = (new File(__FILE__)).parent + '/jobs.yml'
println("Using jobsfile : ${jobsfile}")
def pkgs = yaml.load(new File(jobsfile).text)
pkgs.each { pkg ->
params = pkg.value
params.get('archs', default_archs).each { arch ->
params.get('dists', default_dists).each { dist ->
name = folder + '/' + 'deb-' + pkg.key + '-' + dist + '-' + arch
branch = params.get('branch', os + '/' + dist)
if (arch != native_arch) {
arch_arg = '--git-arch=' + arch
} else {
arch_arg = ''
}
dist_arg = '--git-dist=' + dist
freeStyleJob(name) {
scm {
git {
remote {
name('origin')
url(params.url)
}
extensions {
relativeTargetDirectory('build')
}
}
}
triggers {
scm('H * * * *')
}
steps {
shell('rm -f *.deb *.changes *.dsc \n' +
'cd build \n' +
'git clean -dfx \n' +
'git checkout -f \n' +
'gbp dch -S -a --ignore-branch \n' +
'gbp buildpackage ' + [arch_arg, dist_arg, default_args].join(' ') + '\n' +
'\n')
}
publishers {
archiveArtifacts {
pattern('*.deb')
onlyIfSuccessful()
}
}
}
}
}
}
---
virt-what:
url: https://anonscm.debian.org/git/pkg-libvirt/virt-what.git
archs: ['aarch64', 'armhf']
branch: 'debian/sid'
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