-
Notifications
You must be signed in to change notification settings - Fork 145
/
Jenkinsfile
130 lines (122 loc) · 5.61 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!groovy
def branch = env.CHANGE_TARGET ?: env.BRANCH_NAME
def pkgs = [
[target: "centos-9", image: "quay.io/centos/centos:stream9", arches: ["amd64", "aarch64"]],
[target: "centos-10", image: "quay.io/centos/centos:stream10", arches: ["amd64", "aarch64"]], // CentOS Stream 10 (EOL: 2030)
[target: "debian-bullseye", image: "debian:bullseye", arches: ["amd64", "aarch64", "armhf"]], // Debian 11 (stable)
[target: "debian-bookworm", image: "debian:bookworm", arches: ["amd64", "aarch64", "armhf"]], // Debian 12 (Next stable)
[target: "fedora-40", image: "fedora:40", arches: ["amd64", "aarch64"]], // EOL: May 13, 2025
[target: "fedora-41", image: "fedora:41", arches: ["amd64", "aarch64"]], // EOL: November, 2025
[target: "raspbian-bullseye", image: "balenalib/rpi-raspbian:bullseye", arches: ["armhf"]], // Debian/Raspbian 11 (stable)
[target: "raspbian-bookworm", image: "balenalib/rpi-raspbian:bookworm", arches: ["armhf"]], // Debian/Raspbian 12 (next stable)
[target: "ubuntu-focal", image: "ubuntu:focal", arches: ["amd64", "aarch64", "armhf"]], // Ubuntu 20.04 LTS (End of support: April, 2025. EOL: April, 2030)
[target: "ubuntu-jammy", image: "ubuntu:jammy", arches: ["amd64", "aarch64", "armhf"]], // Ubuntu 22.04 LTS (End of support: June, 2027. EOL: April, 2032)
[target: "ubuntu-noble", image: "ubuntu:noble", arches: ["amd64", "aarch64", "armhf"]], // Ubuntu 24.04 LTS (End of support: June, 2029. EOL: April, 2034)
[target: "ubuntu-oracular", image: "ubuntu:oracular", arches: ["amd64", "aarch64", "armhf"]], // Ubuntu 24.10 (EOL: July, 2025)
]
def genBuildStep(LinkedHashMap pkg, String arch) {
def nodeLabel = "linux&&${arch}"
def platform = ""
def branch = env.CHANGE_TARGET ?: env.BRANCH_NAME
if (arch == 'armhf') {
// Running armhf builds on EC2 requires --platform parameter
// Otherwise it accidentally pulls armel images which then breaks the verify step
platform = "--platform=linux/${arch}"
nodeLabel = "${nodeLabel}&&ubuntu"
} else {
nodeLabel = "${nodeLabel}&&ubuntu-2004"
}
return { ->
wrappedNode(label: nodeLabel, cleanWorkspace: true) {
stage("${pkg.target}-${arch}") {
// This is just a "dummy" stage to make the distro/arch visible
// in Jenkins' BlueOcean view, which truncates names....
sh 'echo starting...'
}
stage("info") {
sh 'docker version'
sh 'docker info'
}
stage("build") {
checkout scm
sh "make clean"
sh "make REF=$branch ARCH=${arch} ${pkg.target}"
}
stage("verify") {
sh "make IMAGE=${pkg.image} ARCH=${arch} verify"
}
}
}
}
def build_package_steps = [
'static-linux': { ->
wrappedNode(label: 'ubuntu-2004 && x86_64', cleanWorkspace: true) {
stage("static-linux") {
// This is just a "dummy" stage to make the distro/arch visible
// in Jenkins' BlueOcean view, which truncates names....
sh 'echo starting...'
}
stage("info") {
sh 'docker version'
sh 'docker info'
}
stage("build") {
try {
checkout scm
sh "make REF=$branch DOCKER_BUILD_PKGS='static-linux' static"
} finally {
sh "make clean"
}
}
}
},
'cross-mac': { ->
wrappedNode(label: 'ubuntu-2004 && x86_64', cleanWorkspace: true) {
stage("cross-mac") {
// This is just a "dummy" stage to make the distro/arch visible
// in Jenkins' BlueOcean view, which truncates names....
sh 'echo starting...'
}
stage("info") {
sh 'docker version'
sh 'docker info'
}
stage("build") {
try {
checkout scm
sh "make REF=$branch DOCKER_BUILD_PKGS='cross-mac' static"
} finally {
sh "make clean"
}
}
}
},
'cross-win': { ->
wrappedNode(label: 'ubuntu-2004 && x86_64', cleanWorkspace: true) {
stage("cross-win") {
// This is just a "dummy" stage to make the distro/arch visible
// in Jenkins' BlueOcean view, which truncates names....
sh 'echo starting...'
}
stage("info") {
sh 'docker version'
sh 'docker info'
}
stage("build") {
try {
checkout scm
sh "make REF=$branch DOCKER_BUILD_PKGS='cross-win' static"
} finally {
sh "make clean"
}
}
}
},
]
def genPackageSteps(opts) {
return opts.arches.collectEntries {
["${opts.image}-${it}": genBuildStep(opts, it)]
}
}
build_package_steps << pkgs.collectEntries { genPackageSteps(it) }
parallel(build_package_steps)