1
0
Fork 0
pythonctnr/ci/Jenkinsfile

81 lines
2.0 KiB
Groovy

// vim: set ft=groovy sw=4 ts=4 sts=4 et :
def IS_TRIGGERED_BY_TIMER = currentBuild.getBuildCauses(
'hudson.triggers.TimerTrigger$TimerTriggerCause'
).size() > 0
pipeline {
agent {
kubernetes {
yamlFile 'ci/podTemplate.yaml'
defaultContainer 'buildroot'
workspaceVolume persistentVolumeClaimWorkspaceVolume(
claimName: 'jenkins-ws-pythonctnr'
)
}
}
options {
buildDiscarder logRotator(numToKeepStr: '5')
disableConcurrentBuilds()
}
triggers {
cron 'TZ=America/Chicago\n20 10 31 10 *'
}
parameters {
booleanParam \
name: 'Clean',
defaultValue: IS_TRIGGERED_BY_TIMER,
description: 'Clean the workspace and perform a full rebuild'
}
stages {
stage('Prepare') {
steps {
script {
if (params.Clean) {
sh 'rm -rf _build'
}
}
checkout poll: false, scm: [
$class: 'GitSCM',
branches: [[name: '2022.05.x']],
doGenerateSubmoduleConfigurations: false,
userRemoteConfigs: [[url: 'git://git.buildroot.net/buildroot']],
extensions: [
[
$class: 'RelativeTargetDirectory',
relativeTargetDir: 'buildroot',
],
],
]
}
}
stage('Build') {
steps {
sh '. ci/build.sh'
}
}
stage('Build Container') {
steps {
container('buildah') {
sh '. ci/build-container.sh'
}
}
}
stage('Publish Container') {
steps {
container('buildah') {
sh '. ci/publish-container.sh'
}
}
}
}
}