blob: 1b0d54932cea8541dc30871e428623c8fd44475c [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
Jakub Josefa63f9862018-01-11 17:58:38 +010018timeout(time: 12, unit: 'HOURS') {
19 node("python") {
20 try {
Ales Komarek585bd462017-08-24 09:33:32 +020021
Jakub Josefa63f9862018-01-11 17:58:38 +010022 stage('Setup virtualenv for Pepper') {
23 python.setupPepperVirtualenv(pepperEnv, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
24 }
Ales Komarek585bd462017-08-24 09:33:32 +020025
Jakub Josefa63f9862018-01-11 17:58:38 +010026 stage('Update Jenkins jobs') {
27 result = salt.runSaltCommand(pepperEnv, 'local', target, 'state.apply', null, 'jenkins.client')
28 salt.checkResult(result)
29 }
30
31 } catch (Throwable e) {
32 currentBuild.result = 'FAILURE'
33 throw e
Ales Komarek585bd462017-08-24 09:33:32 +020034 }
Ales Komarek585bd462017-08-24 09:33:32 +020035 }
36}