-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
81 lines (65 loc) · 2.42 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
node(label: 'raspberrypi') {
properties([
disableConcurrentBuilds(),
durabilityHint(hint: 'PERFORMANCE_OPTIMIZED')
])
// --- configuration for an arch-indep package ---
// The distributions we build on
def build_dist_list = [
"bullseye"
]
// The distribution/architecture combinations we test-install on.
def test_dist_arch_list = [
["bullseye", "armhf"]
]
// The list of packages to test-install, in the correct order to install.
def test_package_list = ["piaware-wifi-scan", "piaware-configurator"]
// --- implementation ---
def srcdir = "${WORKSPACE}/src"
stage("Checkout") {
sh "rm -fr ${srcdir}"
sh "mkdir ${srcdir}"
dir(srcdir) {
checkout scm
}
}
def resultdirs = [:]
for (int i = 0; i < build_dist_list.size(); ++i) {
def dist = build_dist_list[i]
String pkgdir = "pkg-${dist}"
stage("Prepare source for ${dist}") {
sh "rm -fr ${pkgdir}"
sh "${srcdir}/prepare-build.sh ${dist} ${pkgdir}"
}
def resultdir = "results-${dist}"
resultdirs[dist] = resultdir
stage("Build for ${dist}") {
sh "rm -fr ${resultdir}"
sh "mkdir -p ${resultdir}"
dir(pkgdir) {
sh "DIST=${dist} BRANCH=${env.BRANCH_NAME} pdebuild --use-pdebuild-internal --debbuildopts -b --buildresult ${WORKSPACE}/${resultdir}"
}
archiveArtifacts artifacts: "${resultdir}/*.deb", fingerprint: true
}
}
for (int i = 0; i < test_dist_arch_list.size(); ++i) {
def dist_and_arch = test_dist_arch_list[i]
def dist = dist_and_arch[0]
def arch = dist_and_arch[1]
def resultdir = resultdirs[dist]
def test_debs = ""
for (int j = 0; j < test_package_list.size(); ++j) {
test_debs += "${resultdir}/${test_package_list[j]}_*.deb "
}
stage("Test install on ${dist} (${arch})") {
sh "BRANCH=${env.BRANCH_NAME} ARCH=${arch} /build/pi-builder/scripts/validate-packages.sh ${dist} ${test_debs}"
}
}
stage("Deploy to internal repository") {
for (int i = 0; i < build_dist_list.size(); ++i) {
def dist = build_dist_list[i]
def resultdir = resultdirs[dist]
sh "/build/pi-builder/scripts/deploy.sh -distribution ${dist} -branch ${env.BRANCH_NAME} ${resultdir}/*.deb"
}
}
}