blob: 1b0d54932cea8541dc30871e428623c8fd44475c [file] [log] [blame]
/**
* Update Jenkins master jobs
*
* Expected parameters:
* SALT_MASTER_CREDENTIALS Credentials to the Salt API.
* SALT_MASTER_URL Full Salt API address [https://10.10.10.1:8000].
* TARGET_SERVERS Server to update
*
**/
def common = new com.mirantis.mk.Common()
def salt = new com.mirantis.mk.Salt()
def python = new com.mirantis.mk.Python()
def pepperEnv = "pepperEnv"
def target = ['expression': TARGET_SERVERS, 'type': 'compound']
def result
timeout(time: 12, unit: 'HOURS') {
node("python") {
try {
stage('Setup virtualenv for Pepper') {
python.setupPepperVirtualenv(pepperEnv, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
}
stage('Update Jenkins jobs') {
result = salt.runSaltCommand(pepperEnv, 'local', target, 'state.apply', null, 'jenkins.client')
salt.checkResult(result)
}
} catch (Throwable e) {
currentBuild.result = 'FAILURE'
throw e
}
}
}