65 lines
1.4 KiB
Groovy
65 lines
1.4 KiB
Groovy
def call(rw_pattern, stages) {
|
|
timeout(time: 1, unit: 'HOURS') {
|
|
lock('cfgpol') {
|
|
node {
|
|
checkout scm
|
|
def image = docker.build(
|
|
"configpolicy:${env.BRANCH_NAME}",
|
|
'ci',
|
|
)
|
|
image.inside {
|
|
withEnv(["KRB5CCNAME=${WORKSPACE}/.krb5cc"]) {
|
|
stageKinit()
|
|
try {
|
|
stageRemountRW(rw_pattern)
|
|
generateStages(stages)
|
|
stageRemountRO(rw_pattern)
|
|
} catch (err) {
|
|
postFailure(err)
|
|
} finally {
|
|
postCleanup()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
stageKinit() {
|
|
stage('kinit') {
|
|
echo 'kinit'
|
|
}
|
|
}
|
|
|
|
|
|
stageRemountRW(rw_pattern) {
|
|
stage('Remount R/W') {
|
|
echo 'Remount R/W'
|
|
}
|
|
}
|
|
|
|
generateStages(stages) {
|
|
stages.each { name, playbooks ->
|
|
stage(name) {
|
|
playbooks.each { playbook ->
|
|
echo playbook
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
stageRemountRO(rw_pattern) {
|
|
echo 'Remount R/O'
|
|
}
|
|
|
|
|
|
postCleanup() {
|
|
echo 'Cleanup'
|
|
}
|
|
|
|
postFailure(err) {
|
|
currentBuild.result = 'FAILURE'
|
|
echo "${err}"
|
|
}
|