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
131
132
133
|
#!/usr/bin/env groovy
def RPMSource() {
dir ('source') {
checkout([
$class: 'GitSCM',
branches: [
[ name: '*/master' ]
],
extensions: [
[
$class: 'CloneOption',
timeout: 60
],[
$class: 'SubmoduleOption',
timeout: 60
]
],
userRemoteConfigs: [
[ url: 'git://spunk.home.kraxel.org/coreboot' ]
]])
}
}
def RPMBuild() {
copyArtifacts([
projectName: "seabios",
selector: lastSuccessful(),
target: "seabios/"
])
sh '''
# figure version
commit="$(cd source; git describe --tags --long --match '[0-9]*')"
ghash="${commit##*-}"
commit="${commit%-*}"
gcnt="${commit##*-}"
commit="${commit%-*}"
version="${commit}"
# fresh snapshot tarball
rm -f *.tar.gz
tarball="coreboot-${ghash}.tar.gz"
(cd source; git archive --format=tar --prefix="${tarball%.tar.gz}/" HEAD) \
> "${tarball%.gz}"
(cd source/3rdparty/vboot; git archive --format=tar \
--prefix="${tarball%.tar.gz}/3rdparty/vboot/" \
HEAD) > "vboot.tar"
tar --concatenate --file "${tarball%.gz}" "vboot.tar"
rm "vboot.tar"
gzip "${tarball%.gz}"
# tweak spec file
sed -i.orig \
-e "s/\\(Version:[ \\t]\\+\\)\\(.*\\)/\\1${version}/" \
-e "s/\\(Release:[ \\t]\\+\\)\\(.*\\)/\\1${gcnt}.${BUILD_NUMBER}.${ghash}/" \
-e "s/\\(Source0:[ \\t]\\+\\)\\(.*\\)/\\1${tarball}/" \
-e "s/\\(%setup\\)\\(.*\\)/\\1 -n ${tarball%.tar.gz}/" \
*.spec
diff -u *.spec.orig *.spec || true
# install deps
/usr/local/bin/configure-mirror
find seabios -print
dnf install -y seabios/rpms/*/*coreboot*.rpm
dnf builddep -y *.spec
# build package
rpmbuild \
--define "_specdir ${WORKSPACE}" \
--define "_sourcedir ${WORKSPACE}" \
--define "_rpmdir ${WORKSPACE}/rpms" \
--define "_srcrpmdir ${WORKSPACE}/rpms/src" \
--define "_builddir ${WORKSPACE}/build" \
--define "_buildrootdir ${WORKSPACE}/buildroot" \
-ba *.spec
# revert spec file tweaks
git reset --hard
# drop source rpm
rm -rf "${WORKSPACE}/rpms/src"
# create rpm package repo
createrepo_c rpms
'''
archiveArtifacts 'rpms/*/*'
}
pipeline {
agent {
kubernetes {
yamlFile 'fedora-rpmbuild.yaml'
defaultContainer 'fedora-rpmbuild'
slaveConnectTimeout '3600'
nodeSelector 'kubernetes.io/os=linux,kubernetes.io/arch=amd64'
}
}
options {
buildDiscarder(logRotator(numToKeepStr: '5'))
disableConcurrentBuilds()
}
triggers {
pollSCM('H H(0-3) * * *')
}
stages {
stage ('Prepare') {
steps {
RPMSource();
}
}
stage ("RPM Build") {
steps {
RPMBuild()
}
}
}
post {
failure {
emailext([
to: 'builds@kraxel.org',
subject: "${JOB_NAME} - build #${BUILD_NUMBER} - FAILED!",
body: "${BUILD_URL}\n",
attachLog: true,
])
}
}
}
|