Skip to content

Commit ae33d3f

Browse files
committed
build: Add initial Jenkinsfile
For now just compile testing. Signed-off-by: Rob Bradford <[email protected]>
1 parent b22cb0e commit ae33d3f

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

Jenkinsfile

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
pipeline{
2+
agent none
3+
stages {
4+
stage ('Early checks') {
5+
agent { node { label 'master' } }
6+
stages {
7+
stage ('Check for RFC/WIP builds') {
8+
when {
9+
changeRequest comparator: 'REGEXP', title: '.*(rfc|RFC|wip|WIP).*'
10+
beforeAgent true
11+
}
12+
steps {
13+
error("Failing as this is marked as a WIP or RFC PR.")
14+
}
15+
}
16+
stage ('Cancel older builds') {
17+
when { not { branch 'master' } }
18+
steps {
19+
cancelPreviousBuilds()
20+
}
21+
}
22+
}
23+
}
24+
stage ('Worker build') {
25+
agent { node { label 'groovy' } }
26+
stages {
27+
stage ('Checkout') {
28+
steps {
29+
checkout scm
30+
}
31+
}
32+
stage ('Install dependencies') {
33+
steps {
34+
sh "sudo apt update && sudo apt install -y meson ninja-build gcc libxml2-utils xsltproc python3-docutils libglib2.0-dev libgnutls28-dev libxml2-dev libnl-3-dev libnl-route-3-dev libyajl-dev make libcurl4-gnutls-dev"
35+
}
36+
}
37+
stage ('Configure') {
38+
steps {
39+
sh "meson build -D driver_ch=enabled -D driver_qemu=disabled -D driver_openvz=disabled -D driver_esx=disabled -D driver_vmware=disabled -D driver_lxc=disabled -D driver_libxl=disabled -D driver_vbox=disabled"
40+
}
41+
}
42+
stage ('Build') {
43+
steps {
44+
sh "ninja -C build"
45+
}
46+
}
47+
}
48+
49+
}
50+
}
51+
}
52+
53+
def cancelPreviousBuilds() {
54+
// Check for other instances of this particular build, cancel any that are older than the current one
55+
def jobName = env.JOB_NAME
56+
def currentBuildNumber = env.BUILD_NUMBER.toInteger()
57+
def currentJob = Jenkins.instance.getItemByFullName(jobName)
58+
59+
// Loop through all instances of this particular job/branch
60+
for (def build : currentJob.builds) {
61+
if (build.isBuilding() && (build.number.toInteger() < currentBuildNumber)) {
62+
echo "Older build still queued. Sending kill signal to build number: ${build.number}"
63+
build.doStop()
64+
}
65+
}
66+
}

0 commit comments

Comments
 (0)