draft: applyConfigPolicy

Dustin 2020-03-16 21:04:25 -05:00
parent 789afc46c6
commit 1549d74598
1 changed files with 64 additions and 0 deletions

View File

@ -0,0 +1,64 @@
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}"
}