blob: 65a16ca3e0e74feeac3f0bd6647b443ba83fef13 [file] [log] [blame]
Ales Komarek585bd462017-08-24 09:33:32 +02001/**
2 * Update Jenkins master jobs
3 *
4 * Expected parameters:
5 * SALT_MASTER_CREDENTIALS Credentials to the Salt API.
6 * SALT_MASTER_URL Full Salt API address [https://10.10.10.1:8000].
7 * TARGET_SERVERS Server to update
8 *
9**/
10
11def common = new com.mirantis.mk.Common()
12def salt = new com.mirantis.mk.Salt()
chnyda625f4b42017-10-11 14:10:31 +020013def python = new com.mirantis.mk.Python()
Ales Komarek585bd462017-08-24 09:33:32 +020014
chnyda625f4b42017-10-11 14:10:31 +020015def pepperEnv = "pepperEnv"
Ales Komarek585bd462017-08-24 09:33:32 +020016def target = ['expression': TARGET_SERVERS, 'type': 'compound']
17def result
18
19node("python") {
20 try {
21
chnyda625f4b42017-10-11 14:10:31 +020022 stage('Setup virtualenv for Pepper') {
23 python.setupPepperVirtualenv(venvPepper, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
Ales Komarek585bd462017-08-24 09:33:32 +020024 }
25
26 stage('Update Jenkins jobs') {
chnyda625f4b42017-10-11 14:10:31 +020027 result = salt.runSaltCommand(pepperEnv, 'local', target, 'state.apply', null, 'jenkins.client')
Ales Komarek585bd462017-08-24 09:33:32 +020028 salt.checkResult(result)
29 }
30
31 } catch (Throwable e) {
32 currentBuild.result = 'FAILURE'
33 throw e
34 }
35}