airplaypi/ci/Jenkinsfile

116 lines
3.8 KiB
Groovy

pipeline {
parameters {
booleanParam 'CLEAN_BUILD'
string 'CUSTOM_TARGET'
}
options {
disableConcurrentBuilds()
}
agent {
kubernetes {
yamlFile 'ci/podTemplate.yaml'
workspaceVolume persistentVolumeClaimWorkspaceVolume(
claimName: 'buildroot-airplaypi'
)
defaultContainer 'build'
}
}
environment {
BR2_CCACHE_DIR = "${env.JENKINS_AGENT_WORKDIR}/br2-ccache"
}
stages {
stage('Clean') {
when {
expression {
return params.CLEAN_BUILD
}
}
steps {
sh 'git clean -fdx'
}
}
stage('Prepare') {
steps {
checkout(
poll: false,
scm: scmGit(
branches: [[name: 'refs/tags/2025.05.1']],
browser: gitLab('https://gitlab.com/buildroot.org/buildroot/'),
extensions: [
[
$class: 'RelativeTargetDirectory',
relativeTargetDir: 'buildroot',
],
cloneOption(
shallow: true,
depth: 1,
),
],
userRemoteConfigs: [[
url: 'https://gitlab.com/buildroot.org/buildroot.git',
]],
)
)
checkout(
poll: false,
scm: scmGit(
branches: [[name: 'refs/heads/master']],
browser: [
$class: 'GiteaBrowser',
repoUrl: 'https://git.pyrocufflink.net/AimeeOS/aimee-os'
],
extensions: [
[
$class: 'RelativeTargetDirectory',
relativeTargetDir: 'aimee-os',
],
cloneOption(
shallow: true,
depth: 1,
),
],
userRemoteConfigs: [[
url: 'https://git.pyrocufflink.net/AimeeOS/aimee-os.git,
]],
)
)
}
}
stage('Build') {
steps {
sh '{ cat airplaypi_defconfig.in ; grep BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION buildroot/configs/raspberrypi3_defconfig; } > airplaypi_defconfig'
sh 'make -C buildroot O="${PWD}"/_build BR2_EXTERNAL="${PWD}/aimee-os" defconfig BR2_DEFCONFIG="${PWD}"/airplaypi_defconfig'
script {
if (params.CUSTOM_TARGET) {
sh "make -C _build '${CUSTOM_TARGET}'"
}
}
sh 'make -C _build'
}
post {
success {
dir('_build') {
archiveArtifacts('.config')
}
dir('_build/images') {
sh 'zstd -f firmware.img'
sh 'zstd -f sdcard.img'
archiveArtifacts([
'firmware.img.zst',
'rootfs.squashfs',
'sdcard.img.zst',
'update.tar.zstd',
].join(','))
}
}
}
}
}
}