ci: lib: Skip remount if empty limit pattern
Some playbooks apply only to hosts that do not have read-only root filesystems. For these, the `rw_limit` pattern will be empty. The *Remount R/W* and *Remount R/O* stages should be skipped when this is the case.jenkins-master
parent
cbcc0318f6
commit
347b5578c3
|
@ -1,4 +1,5 @@
|
||||||
import groovy.transform.Field
|
import groovy.transform.Field
|
||||||
|
import org.jenkinsci.plugins.pipeline.modeldefinition.Utils
|
||||||
|
|
||||||
@Field
|
@Field
|
||||||
def DOCKER_ARGS = '''\
|
def DOCKER_ARGS = '''\
|
||||||
|
@ -52,15 +53,20 @@ def stageKinit() {
|
||||||
|
|
||||||
|
|
||||||
def stageRemountRW(limit) {
|
def stageRemountRW(limit) {
|
||||||
stage('Remount R/W') {
|
def STAGE_NAME = 'Remount R/W'
|
||||||
ansiblePlaybook \
|
stage(STAGE_NAME) {
|
||||||
playbook: 'remount.yml',
|
if (limit) {
|
||||||
limit: limit,
|
ansiblePlaybook \
|
||||||
become: true,
|
playbook: 'remount.yml',
|
||||||
vaultCredentialsId: 'ansible-vault',
|
limit: limit,
|
||||||
extraVars: [
|
become: true,
|
||||||
remount_state: 'rw',
|
vaultCredentialsId: 'ansible-vault',
|
||||||
]
|
extraVars: [
|
||||||
|
remount_state: 'rw',
|
||||||
|
]
|
||||||
|
} else {
|
||||||
|
Utils.markStageSkippedForConditional(STAGE_NAME)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,13 +86,18 @@ def generateStages(stages) {
|
||||||
}
|
}
|
||||||
|
|
||||||
def stageRemountRO(limit) {
|
def stageRemountRO(limit) {
|
||||||
stage('Remount R/O') {
|
def STAGE_NAME = 'Remount R/W'
|
||||||
ansiblePlaybook \
|
stage(STAGE_NAME) {
|
||||||
playbook: 'remount.yml',
|
if (limit) {
|
||||||
limit: limit + ':!rw-root',
|
ansiblePlaybook \
|
||||||
become: true,
|
playbook: 'remount.yml',
|
||||||
vaultCredentialsId: 'ansible-vault',
|
limit: limit + ':!rw-root',
|
||||||
extras: '--diff'
|
become: true,
|
||||||
|
vaultCredentialsId: 'ansible-vault',
|
||||||
|
extras: '--diff'
|
||||||
|
} else {
|
||||||
|
Utils.markStageSkippedForConditional(STAGE_NAME)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue