draft: applyConfigPolicy
parent
789afc46c6
commit
1549d74598
|
@ -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}"
|
||||
}
|
Loading…
Reference in New Issue