blob: 23d344337a313606dbd269dce9eff112309d2bf4 [file] [log] [blame]
Tomáš Kukrálb9957b32017-02-28 14:49:00 +01001/**
2 *
3 * Launch heat stack with basic k8s
4 * Flow parameters:
5 * STACK_TYPE Orchestration engine: heat, ''
6 * INSTALL What should be installed (k8s, openstack, ...)
Tomáš Kukrál55357d02017-02-28 22:56:45 +01007 * TEST What should be tested (k8s, openstack, ...)
Tomáš Kukrálb9957b32017-02-28 14:49:00 +01008 *
9 * Expected parameters:
10 *
11 * required for STACK_TYPE=heat
12 * HEAT_TEMPLATE_URL URL to git repo with Heat templates
13 * HEAT_TEMPLATE_CREDENTIALS Credentials to the Heat templates repo
14 * HEAT_TEMPLATE_BRANCH Heat templates repo branch
15 * HEAT_STACK_TEMPLATE Heat stack HOT template
16 * HEAT_STACK_ENVIRONMENT Heat stack environmental parameters
17 * HEAT_STACK_ZONE Heat stack availability zone
18 * HEAT_STACK_PUBLIC_NET Heat stack floating IP pool
19 * HEAT_STACK_DELETE Delete Heat stack when finished (bool)
20 * HEAT_STACK_CLEANUP_JOB Name of job for deleting Heat stack
21 * HEAT_STACK_REUSE Reuse Heat stack (don't create one)
22 * OPENSTACK_API_URL OpenStack API address
23 * OPENSTACK_API_CREDENTIALS Credentials to the OpenStack API
24 * OPENSTACK_API_PROJECT OpenStack project to connect to
25 * OPENSTACK_API_CLIENT Versions of OpenStack python clients
26 * OPENSTACK_API_VERSION Version of the OpenStack API (2/3)
27 *
28 * SALT_MASTER_CREDENTIALS Credentials to the Salt API
29 *
30 * required for STACK_TYPE=NONE or empty string
31 * SALT_MASTER_URL URL of Salt-API
32
33 * K8S_API_SERVER Kubernetes API address
34 * K8S_CONFORMANCE_IMAGE Path to docker image with conformance e2e tests
35 *
Victor Ryzhenkin5f3b7e62017-03-09 16:02:58 +040036 * TEMPEST_IMAGE_LINK Tempest image link
37 *
Matthew Mosesohna85f24e2017-04-28 13:45:19 +030038 * optional parameters for overwriting soft params
39 * KUBERNETES_HYPERKUBE_IMAGE Docker repository and tag for hyperkube image
40 *
Tomáš Kukrálb9957b32017-02-28 14:49:00 +010041 */
42
43git = new com.mirantis.mk.Git()
44openstack = new com.mirantis.mk.Openstack()
45salt = new com.mirantis.mk.Salt()
Tomáš Kukrál3e4029d2017-03-07 09:59:40 +010046common = new com.mirantis.mk.Common()
Ondrej Smola8f35e482017-03-30 14:04:36 +020047test = new com.mirantis.mk.Test()
Matthew Mosesohna85f24e2017-04-28 13:45:19 +030048overwriteFile = "/srv/salt/reclass/classes/cluster/overwrite.yml"
Tomáš Kukrále80680a2017-03-02 16:34:35 +010049
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +010050timestamps {
51 node {
Tomáš Kukrála18de112017-03-02 13:57:47 +010052 try {
53 //
54 // Prepare machines
55 //
Tomáš Kukrála18de112017-03-02 13:57:47 +010056 stage ('Create infrastructure') {
Tomáš Kukrál6d627d62017-03-23 17:39:07 +010057
Tomáš Kukrála18de112017-03-02 13:57:47 +010058 if (STACK_TYPE == 'heat') {
59 // value defaults
60 def openstackCloud
61 def openstackVersion = OPENSTACK_API_CLIENT ? OPENSTACK_API_CLIENT : 'liberty'
62 def openstackEnv = "${env.WORKSPACE}/venv"
Tomáš Kukrálb9957b32017-02-28 14:49:00 +010063
Filip Pytloun794ad952017-03-03 10:39:26 +010064 if (HEAT_STACK_REUSE.toBoolean() == true && HEAT_STACK_NAME == '') {
65 error("If you want to reuse existing stack you need to provide it's name")
66 }
67
68 if (HEAT_STACK_REUSE.toBoolean() == false) {
69 // Don't allow to set custom heat stack name
70 wrap([$class: 'BuildUser']) {
Tomáš Kukrál24d7fe62017-03-03 10:57:11 +010071 if (env.BUILD_USER_ID) {
72 HEAT_STACK_NAME = "${env.BUILD_USER_ID}-${JOB_NAME}-${BUILD_NUMBER}"
73 } else {
74 HEAT_STACK_NAME = "jenkins-${JOB_NAME}-${BUILD_NUMBER}"
75 }
Filip Pytloun794ad952017-03-03 10:39:26 +010076 currentBuild.description = HEAT_STACK_NAME
77 }
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +010078 }
Tomáš Kukrála18de112017-03-02 13:57:47 +010079
Tomáš Kukrálcbabec42017-03-02 16:24:04 +010080 // set description
Tomáš Kukrálaeb5c922017-03-02 17:00:48 +010081 currentBuild.description = "${HEAT_STACK_NAME}"
Tomáš Kukrálcbabec42017-03-02 16:24:04 +010082
Tomáš Kukrála18de112017-03-02 13:57:47 +010083 // get templates
84 git.checkoutGitRepository('template', HEAT_TEMPLATE_URL, HEAT_TEMPLATE_BRANCH, HEAT_TEMPLATE_CREDENTIALS)
85
86 // create openstack env
87 openstack.setupOpenstackVirtualenv(openstackEnv, openstackVersion)
88 openstackCloud = openstack.createOpenstackEnv(OPENSTACK_API_URL, OPENSTACK_API_CREDENTIALS, OPENSTACK_API_PROJECT)
89 openstack.getKeystoneToken(openstackCloud, openstackEnv)
90
91 // launch stack
Filip Pytloun794ad952017-03-03 10:39:26 +010092 if (HEAT_STACK_REUSE.toBoolean() == false) {
Tomáš Kukrála18de112017-03-02 13:57:47 +010093 stage('Launch new Heat stack') {
94 // create stack
95 envParams = [
96 'instance_zone': HEAT_STACK_ZONE,
97 'public_net': HEAT_STACK_PUBLIC_NET
98 ]
99 openstack.createHeatStack(openstackCloud, HEAT_STACK_NAME, HEAT_STACK_TEMPLATE, envParams, HEAT_STACK_ENVIRONMENT, openstackEnv)
100 }
101 }
102
103 // get SALT_MASTER_URL
104 saltMasterHost = openstack.getHeatStackOutputParam(openstackCloud, HEAT_STACK_NAME, 'salt_master_ip', openstackEnv)
Tomáš Kukrálaeb5c922017-03-02 17:00:48 +0100105 currentBuild.description = "${HEAT_STACK_NAME}: ${saltMasterHost}"
Tomáš Kukrál615aa9c2017-03-04 15:29:08 +0100106
Tomáš Kukrál6d627d62017-03-23 17:39:07 +0100107 if (common.checkContains('INSTALL', 'kvm')) {
Marek Celoud5e442a32017-03-16 10:15:53 +0100108 saltPort = 6969
Tomáš Kukrál615aa9c2017-03-04 15:29:08 +0100109 } else {
Marek Celoud5e442a32017-03-16 10:15:53 +0100110 saltPort = 6969
Tomáš Kukrál615aa9c2017-03-04 15:29:08 +0100111 }
112
Tomáš Kukrál61509292017-03-04 16:27:07 +0100113 SALT_MASTER_URL = "http://${saltMasterHost}:${saltPort}"
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100114 }
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100115 }
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100116
Tomáš Kukrála18de112017-03-02 13:57:47 +0100117 //
118 // Connect to Salt master
119 //
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100120
Tomáš Kukrála18de112017-03-02 13:57:47 +0100121 def saltMaster
122 stage('Connect to Salt API') {
123 saltMaster = salt.connection(SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
124 }
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100125
Tomáš Kukrála18de112017-03-02 13:57:47 +0100126 //
127 // Install
128 //
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100129
Tomáš Kukrál6d627d62017-03-23 17:39:07 +0100130 if (common.checkContains('INSTALL', 'core')) {
Tomáš Kukrála18de112017-03-02 13:57:47 +0100131 stage('Install core infrastructure') {
132 // salt.master, reclass
133 // refresh_pillar
134 // sync_all
135 // linux,openssh,salt.minion.ntp
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100136
Tomáš Kukrála18de112017-03-02 13:57:47 +0100137 //orchestrate.installFoundationInfra(saltMaster)
Tomáš Kukrálcbdb1d02017-03-02 16:08:51 +0100138 salt.enforceState(saltMaster, 'I@salt:master', ['salt.master', 'reclass'], true)
Marek Celoud53292462017-03-23 23:34:18 +0100139 salt.enforceState(saltMaster, '*', ['linux.system'], true)
Marek Celoud1c1ecd12017-03-23 20:41:22 +0100140 salt.enforceState(saltMaster, '*', ['salt.minion'], true)
Tomáš Kukrál01f284a2017-03-02 23:14:20 +0100141 salt.runSaltProcessStep(saltMaster, 'I@linux:system', 'saltutil.refresh_pillar', [], null, true)
142 salt.runSaltProcessStep(saltMaster, 'I@linux:system', 'saltutil.sync_all', [], null, true)
Tomáš Kukrálcbdb1d02017-03-02 16:08:51 +0100143 salt.enforceState(saltMaster, 'I@linux:system', ['linux', 'openssh', 'salt.minion', 'ntp'], true)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100144
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100145
Tomáš Kukrál6d627d62017-03-23 17:39:07 +0100146 if (common.checkContains('INSTALL', 'kvm')) {
Tomáš Kukrála18de112017-03-02 13:57:47 +0100147 //orchestrate.installInfraKvm(saltMaster)
Marek Celoud1c1ecd12017-03-23 20:41:22 +0100148 //salt.runSaltProcessStep(saltMaster, 'I@linux:system', 'saltutil.refresh_pillar', [], null, true)
149 //salt.runSaltProcessStep(saltMaster, 'I@linux:system', 'saltutil.sync_all', [], null, true)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100150
Marek Celoud1c1ecd12017-03-23 20:41:22 +0100151 //salt.enforceState(saltMaster, 'I@salt:control', ['salt.minion', 'linux.system', 'linux.network', 'ntp'], true)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100152 salt.enforceState(saltMaster, 'I@salt:control', 'libvirt', true)
153 salt.enforceState(saltMaster, 'I@salt:control', 'salt.control', true)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100154
Tomáš Kukrál3e5c5bf2017-03-09 16:45:54 +0100155 sleep(600)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100156
Tomáš Kukrál01f284a2017-03-02 23:14:20 +0100157 salt.runSaltProcessStep(saltMaster, '* and not kvm*', 'saltutil.refresh_pillar', [], null, true)
158 salt.runSaltProcessStep(saltMaster, '* and not kvm*', 'saltutil.sync_all', [], null, true)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100159
160 // workaround - install apt-transport-https
Tomáš Kukrálbe9dfa52017-03-08 13:54:03 +0100161 //salt.runSaltProcessStep(saltMaster, '* and not kvm*', 'cmd.run', ['apt-get update -y && apt-get install -y apt-transport-https'], null, true)
162 //salt.runSaltProcessStep(saltMaster, '* and not kvm*', 'pkg.install', ['apt-transport-https', 'refresh=True'], null, true)
Marek Celoudce2a28b2017-03-13 17:11:30 +0100163 salt.enforceState(saltMaster, 'I@linux:system', ['linux', 'salt.minion'], true, false)
164 salt.enforceState(saltMaster, 'I@linux:system', ['openssh', 'salt.minion', 'ntp'], true, false)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100165 }
166
167 //orchestrate.validateFoundationInfra(saltMaster)
Tomáš Kukrálcbdb1d02017-03-02 16:08:51 +0100168 salt.runSaltProcessStep(saltMaster, 'I@salt:master', 'cmd.run', ['salt-key'], null, true)
Tomáš Kukrál01f284a2017-03-02 23:14:20 +0100169 salt.runSaltProcessStep(saltMaster, 'I@salt:minion', 'test.version', [], null, true)
Tomáš Kukrálcbdb1d02017-03-02 16:08:51 +0100170 salt.runSaltProcessStep(saltMaster, 'I@salt:master', 'cmd.run', ['reclass-salt --top'], null, true)
Tomáš Kukrál01f284a2017-03-02 23:14:20 +0100171 salt.runSaltProcessStep(saltMaster, 'I@reclass:storage', 'reclass.inventory', [], null, true)
172 salt.runSaltProcessStep(saltMaster, 'I@salt:minion', 'state.show_top', [], null, true)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100173 }
174 }
175
176 // install k8s
Tomáš Kukrál6d627d62017-03-23 17:39:07 +0100177 if (common.checkContains('INSTALL', 'k8s')) {
Tomáš Kukrála18de112017-03-02 13:57:47 +0100178 stage('Install Kubernetes infra') {
179 //orchestrate.installOpenstackMcpInfra(saltMaster)
180
Matthew Mosesohna85f24e2017-04-28 13:45:19 +0300181 // Overwrite Kubernetes vars if specified
182 if (env.getEnvironment().containsKey("KUBERNETES_HYPERKUBE_IMAGE")) {
183 salt.runSaltProcessStep(master, 'I@salt:master', 'file.append', overwriteFile, " kubernetes_hyperkube_image: ${KUBERNETES_HYPERKUBE_IMAGE}")
184 }
185
Tomáš Kukrála18de112017-03-02 13:57:47 +0100186 // Install glusterfs
187 salt.runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'state.sls', ['glusterfs.server.service'])
188
189 // Install keepalived
Marek Celoudfeb67062017-03-13 11:01:43 +0100190 salt.runSaltProcessStep(saltMaster, 'I@keepalived:cluster and *01*', 'state.sls', ['keepalived'])
Tomáš Kukrála18de112017-03-02 13:57:47 +0100191 salt.runSaltProcessStep(saltMaster, 'I@keepalived:cluster', 'state.sls', ['keepalived'])
192
Tomáš Kukrála18de112017-03-02 13:57:47 +0100193 // Setup glusterfs
Marek Celoudfeb67062017-03-13 11:01:43 +0100194 salt.runSaltProcessStep(saltMaster, 'I@glusterfs:server and *01*', 'state.sls', ['glusterfs.server.setup'])
Tomáš Kukrála18de112017-03-02 13:57:47 +0100195 salt.runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'cmd.run', ['gluster peer status'])
196 salt.runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'cmd.run', ['gluster volume status'])
197
198 // Install haproxy
199 salt.runSaltProcessStep(saltMaster, 'I@haproxy:proxy', 'state.sls', ['haproxy'])
200 salt.runSaltProcessStep(saltMaster, 'I@haproxy:proxy', 'service.status', ['haproxy'])
201
202 // Install docker
203 salt.runSaltProcessStep(saltMaster, 'I@docker:host', 'state.sls', ['docker.host'])
204 salt.runSaltProcessStep(saltMaster, 'I@docker:host', 'cmd.run', ['docker ps'])
205
Tomáš Kukrála18de112017-03-02 13:57:47 +0100206 // Install etcd
207 salt.runSaltProcessStep(saltMaster, 'I@etcd:server', 'state.sls', ['etcd.server.service'])
Tomáš Kukrál67878f52017-04-20 10:33:11 +0200208 salt.runSaltProcessStep(saltMaster, 'I@etcd:server', 'cmd.run', ['./var/lib/etcd/configenv && etcdctl cluster-health'])
Tomáš Kukrála18de112017-03-02 13:57:47 +0100209
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100210 }
211
Tomáš Kukrála18de112017-03-02 13:57:47 +0100212 stage('Install Kubernetes control') {
213 //orchestrate.installOpenstackMcpControl(saltMaster)
Tomáš Kukrál06c27a92017-03-01 16:21:46 +0100214
Tomáš Kukrála18de112017-03-02 13:57:47 +0100215 // Install Kubernetes pool and Calico
Tomáš Kukrál67878f52017-04-20 10:33:11 +0200216 salt.runSaltProcessStep(saltMaster, 'I@kubernetes:master', 'state.sls', ['kubernetes.master.kube-addons'])
Tomáš Kukrála18de112017-03-02 13:57:47 +0100217 salt.runSaltProcessStep(saltMaster, 'I@kubernetes:pool', 'state.sls', ['kubernetes.pool'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100218
Tomáš Kukrála18de112017-03-02 13:57:47 +0100219 // Setup etcd server
Tomáš Kukrál67878f52017-04-20 10:33:11 +0200220 salt.runSaltProcessStep(saltMaster, 'I@kubernetes:master and *01*', 'state.sls', ['etcd.server.setup'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100221
Tomáš Kukrála18de112017-03-02 13:57:47 +0100222 // Run k8s without master.setup
223 salt.runSaltProcessStep(saltMaster, 'I@kubernetes:master', 'state.sls', ['kubernetes', 'exclude=kubernetes.master.setup'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100224
Tomáš Kukrála18de112017-03-02 13:57:47 +0100225 // Run k8s master setup
Marek Celoudfeb67062017-03-13 11:01:43 +0100226 salt.runSaltProcessStep(saltMaster, 'I@kubernetes:master and *01*', 'state.sls', ['kubernetes.master.setup'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100227
Tomáš Kukrála18de112017-03-02 13:57:47 +0100228 // Restart kubelet
229 salt.runSaltProcessStep(saltMaster, 'I@kubernetes:pool', 'service.restart', ['kubelet'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100230 }
231
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100232 }
233
Tomáš Kukrála18de112017-03-02 13:57:47 +0100234 // install openstack
Tomáš Kukrál6d627d62017-03-23 17:39:07 +0100235 if (common.checkContains('INSTALL', 'openstack')) {
Tomáš Kukrála18de112017-03-02 13:57:47 +0100236 // install Infra and control, tests, ...
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100237
Tomáš Kukrála18de112017-03-02 13:57:47 +0100238 stage('Install OpenStack infra') {
239 //orchestrate.installOpenstackMkInfra(saltMaster, physical)
240
Marek Celoud8db985f2017-03-14 17:41:19 +0100241 // Install glusterfs
242 salt.enforceState(saltMaster, 'I@glusterfs:server', 'glusterfs.server.service', true)
243
Tomáš Kukrála18de112017-03-02 13:57:47 +0100244 // Install keepaliveds
245 //runSaltProcessStep(master, 'I@keepalived:cluster', 'state.sls', ['keepalived'], 1)
Marek Celoudfeb67062017-03-13 11:01:43 +0100246 salt.enforceState(saltMaster, 'I@keepalived:cluster and *01*', 'keepalived', true)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100247 salt.enforceState(saltMaster, 'I@keepalived:cluster', 'keepalived', true)
248
249 // Check the keepalived VIPs
250 salt.runSaltProcessStep(saltMaster, 'I@keepalived:cluster', 'cmd.run', ['ip a | grep 172.16.10.2'])
251
Marek Celoudfeb67062017-03-13 11:01:43 +0100252 salt.enforceState(saltMaster, 'I@glusterfs:server and *01*', 'glusterfs.server.setup', true)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100253
Tomáš Kukrálcbdb1d02017-03-02 16:08:51 +0100254 salt.runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'cmd.run', ['gluster peer status'], null, true)
255 salt.runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'cmd.run', ['gluster volume status'], null, true)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100256
257 // Install rabbitmq
Marek Celoud88a79a22017-03-27 15:51:41 +0200258 withEnv(['ASK_ON_ERROR=false']){
259 retry(2) {
260 salt.enforceState(saltMaster, 'I@rabbitmq:server', 'rabbitmq', true)
261 }
262 }
Tomáš Kukrála18de112017-03-02 13:57:47 +0100263 // Check the rabbitmq status
Ales Komarek96ff9ed2017-03-02 18:37:51 +0100264 salt.runSaltProcessStep(saltMaster, 'I@rabbitmq:server', 'cmd.run', ['rabbitmqctl cluster_status'])
Tomáš Kukrála18de112017-03-02 13:57:47 +0100265
266 // Install galera
Marek Celoud88a79a22017-03-27 15:51:41 +0200267 withEnv(['ASK_ON_ERROR=false']){
268 retry(2) {
269 salt.enforceState(saltMaster, 'I@galera:master', 'galera', true)
270 }
Marek Celoud7c84ef72017-03-15 17:32:32 +0100271 }
Tomáš Kukrála18de112017-03-02 13:57:47 +0100272 salt.enforceState(saltMaster, 'I@galera:slave', 'galera', true)
273
274 // Check galera status
Ales Komarek96ff9ed2017-03-02 18:37:51 +0100275 salt.runSaltProcessStep(saltMaster, 'I@galera:master', 'mysql.status')
276 salt.runSaltProcessStep(saltMaster, 'I@galera:slave', 'mysql.status')
Tomáš Kukrála18de112017-03-02 13:57:47 +0100277
Marek Celoudcabe5642017-03-15 18:16:38 +0100278 // // Setup mysql client
279 // salt.enforceState(saltMaster, 'I@mysql:client', 'mysql.client', true)
Tomáš Kukrálaa8f5532017-03-07 13:34:39 +0100280
Tomáš Kukrála18de112017-03-02 13:57:47 +0100281 // Install haproxy
282 salt.enforceState(saltMaster, 'I@haproxy:proxy', 'haproxy', true)
Ales Komarek96ff9ed2017-03-02 18:37:51 +0100283 salt.runSaltProcessStep(saltMaster, 'I@haproxy:proxy', 'service.status', ['haproxy'])
284 salt.runSaltProcessStep(saltMaster, 'I@haproxy:proxy', 'service.restart', ['rsyslog'])
Tomáš Kukrála18de112017-03-02 13:57:47 +0100285
286 // Install memcached
287 salt.enforceState(saltMaster, 'I@memcached:server', 'memcached', true)
288
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100289 }
290
Tomáš Kukrála18de112017-03-02 13:57:47 +0100291 stage('Install OpenStack control') {
292 //orchestrate.installOpenstackMkControl(saltMaster)
Tomáš Kukrálb9957b32017-02-28 14:49:00 +0100293
Marek Celoud36d24b62017-03-21 15:07:07 +0100294 // Install horizon dashboard
295 salt.enforceState(saltMaster, 'I@horizon:server', 'horizon', true)
296 salt.enforceState(saltMaster, 'I@nginx:server', 'nginx', true)
297
Tomáš Kukrála18de112017-03-02 13:57:47 +0100298 // setup keystone service
299 //runSaltProcessStep(saltMaster, 'I@keystone:server', 'state.sls', ['keystone.server'], 1)
Marek Celoudfeb67062017-03-13 11:01:43 +0100300 salt.enforceState(saltMaster, 'I@keystone:server and *01*', 'keystone.server', true)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100301 salt.enforceState(saltMaster, 'I@keystone:server', 'keystone.server', true)
302 // populate keystone services/tenants/roles/users
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100303
Tomáš Kukrála18de112017-03-02 13:57:47 +0100304 // keystone:client must be called locally
Marek Celoud9bf666c2017-04-12 18:28:48 +0200305 //salt.runSaltProcessStep(saltMaster, 'I@keystone:client', 'cmd.run', ['salt-call state.sls keystone.client'], null, true)
306 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'service.restart', ['apache2'])
Marek Celoud771b6512017-04-24 15:56:32 +0200307 sleep(30)
Marek Celoud9bf666c2017-04-12 18:28:48 +0200308 salt.enforceState(saltMaster, 'I@keystone:client', 'keystone.client', true)
309 salt.enforceState(saltMaster, 'I@keystone:client', 'keystone.client', true)
Tatyana Leontovich6467d242017-04-21 14:14:05 +0300310 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonercv3; openstack service list'], null, true)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100311
312 // Install glance and ensure glusterfs clusters
313 //runSaltProcessStep(saltMaster, 'I@glance:server', 'state.sls', ['glance.server'], 1)
Marek Celoudfeb67062017-03-13 11:01:43 +0100314 salt.enforceState(saltMaster, 'I@glance:server and *01*', 'glance.server', true)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100315 salt.enforceState(saltMaster, 'I@glance:server', 'glance.server', true)
316 salt.enforceState(saltMaster, 'I@glance:server', 'glusterfs.client', true)
317
318 // Update fernet tokens before doing request on keystone server
319 salt.enforceState(saltMaster, 'I@keystone:server', 'keystone.server', true)
320
321 // Check glance service
Tomáš Kukrálcbdb1d02017-03-02 16:08:51 +0100322 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; glance image-list'], null, true)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100323
324 // Install and check nova service
325 //runSaltProcessStep(saltMaster, 'I@nova:controller', 'state.sls', ['nova'], 1)
Marek Celoud396ba542017-03-21 11:02:50 +0100326 salt.enforceState(saltMaster, 'I@nova:controller and *01*', 'nova.controller', true)
327 salt.enforceState(saltMaster, 'I@nova:controller', 'nova.controller', true)
Tomáš Kukrálcbdb1d02017-03-02 16:08:51 +0100328 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; nova service-list'], null, true)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100329
330 // Install and check cinder service
331 //runSaltProcessStep(saltMaster, 'I@cinder:controller', 'state.sls', ['cinder'], 1)
Marek Celoudfeb67062017-03-13 11:01:43 +0100332 salt.enforceState(saltMaster, 'I@cinder:controller and *01*', 'cinder', true)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100333 salt.enforceState(saltMaster, 'I@cinder:controller', 'cinder', true)
Tomáš Kukrálcbdb1d02017-03-02 16:08:51 +0100334 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; cinder list'], null, true)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100335
336 // Install neutron service
337 //runSaltProcessStep(saltMaster, 'I@neutron:server', 'state.sls', ['neutron'], 1)
Tomáš Kukrál575e38a2017-03-02 17:12:45 +0100338
Marek Celoud396ba542017-03-21 11:02:50 +0100339 salt.enforceState(saltMaster, 'I@neutron:server and *01*', 'neutron.server', true)
340 salt.enforceState(saltMaster, 'I@neutron:server', 'neutron.server', true)
Tomáš Kukrálcbdb1d02017-03-02 16:08:51 +0100341 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; neutron agent-list'], null, true)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100342
343 // Install heat service
344 //runSaltProcessStep(saltMaster, 'I@heat:server', 'state.sls', ['heat'], 1)
Marek Celoudfeb67062017-03-13 11:01:43 +0100345 salt.enforceState(saltMaster, 'I@heat:server and *01*', 'heat', true)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100346 salt.enforceState(saltMaster, 'I@heat:server', 'heat', true)
Tomáš Kukrálcbdb1d02017-03-02 16:08:51 +0100347 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; heat resource-type-list'], null, true)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100348
Marek Celoudec7c0a92017-03-23 11:01:35 +0100349 // Restart nova api
350 salt.runSaltProcessStep(saltMaster, 'I@nova:controller', 'service.restart', ['nova-api'])
351
Tomáš Kukrála18de112017-03-02 13:57:47 +0100352 }
353
354 stage('Install OpenStack network') {
355 //orchestrate.installOpenstackMkNetwork(saltMaster, physical)
356
Tomáš Kukrál6d627d62017-03-23 17:39:07 +0100357 if (common.checkContains('INSTALL', 'contrail')) {
Tomáš Kukráld5a40af2017-03-07 15:34:58 +0100358 // Install opencontrail database services
359 //runSaltProcessStep(saltMaster, 'I@opencontrail:database', 'state.sls', ['opencontrail.database'], 1)
Tomáš Kukrálf8ac03b2017-03-10 15:08:22 +0100360 try {
Marek Celoudfeb67062017-03-13 11:01:43 +0100361 salt.enforceState(saltMaster, 'I@opencontrail:database and *01*', 'opencontrail.database', true)
Tomáš Kukrál0dccc892017-03-10 15:42:44 +0100362 } catch (Exception e) {
Jakub Josefc7190602017-03-14 10:43:56 +0100363 common.warningMsg('Exception in state opencontrail.database on I@opencontrail:database and *01*')
Tomáš Kukrálf8ac03b2017-03-10 15:08:22 +0100364 }
365
366 try {
367 salt.enforceState(saltMaster, 'I@opencontrail:database', 'opencontrail.database', true)
Tomáš Kukrál0dccc892017-03-10 15:42:44 +0100368 } catch (Exception e) {
Jakub Josefc7190602017-03-14 10:43:56 +0100369 common.warningMsg('Exception in state opencontrail.database on I@opencontrail:database')
Tomáš Kukrálf8ac03b2017-03-10 15:08:22 +0100370 }
Tomáš Kukrála18de112017-03-02 13:57:47 +0100371
Tomáš Kukráld5a40af2017-03-07 15:34:58 +0100372 // Install opencontrail control services
373 //runSaltProcessStep(saltMaster, 'I@opencontrail:control', 'state.sls', ['opencontrail'], 1)
Marek Celoud1a489a62017-03-14 13:46:41 +0100374 salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control and *01*', 'state.sls', ['opencontrail', 'exclude=opencontrail.client'])
Marek Celoud1465b542017-03-14 12:28:38 +0100375 salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control', 'state.sls', ['opencontrail', 'exclude=opencontrail.client'])
376 salt.runSaltProcessStep(saltMaster, 'I@opencontrail:collector', 'state.sls', ['opencontrail', 'exclude=opencontrail.client'])
Tomáš Kukrála18de112017-03-02 13:57:47 +0100377
Tomáš Kukráld5a40af2017-03-07 15:34:58 +0100378 // Test opencontrail
379 salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control', 'cmd.run', ['contrail-status'], null, true)
Tomáš Kukrál6d627d62017-03-23 17:39:07 +0100380 } else if (common.checkContains('INSTALL', 'ovs')) {
Tomáš Kukráld5a40af2017-03-07 15:34:58 +0100381 // Apply gateway
382 salt.runSaltProcessStep(saltMaster, 'I@neutron:gateway', 'state.apply', [], null, true)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100383 }
384
Tomáš Kukráld5a40af2017-03-07 15:34:58 +0100385 // Pring information
Tomáš Kukrálcbdb1d02017-03-02 16:08:51 +0100386 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; neutron net-list'], null, true)
387 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; nova net-list'], null, true)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100388 }
389
390 stage('Install OpenStack compute') {
391 //orchestrate.installOpenstackMkCompute(saltMaster, physical)
392 // Configure compute nodes
Tomáš Kukrálda26d902017-03-02 22:19:00 +0100393 retry(2) {
Tomáš Kukrál02cda9f2017-03-02 22:32:57 +0100394 salt.runSaltProcessStep(saltMaster, 'I@nova:compute', 'state.apply', [], null, true)
Tomáš Kukrálda26d902017-03-02 22:19:00 +0100395 }
Tomáš Kukrála18de112017-03-02 13:57:47 +0100396
Tomáš Kukrál6d627d62017-03-23 17:39:07 +0100397 if (common.checkContains('INSTALL', 'contrail')) {
Marek Celoudfeb67062017-03-13 11:01:43 +0100398 // Provision opencontrail control services
399 salt.enforceState(saltMaster, 'I@opencontrail:database:id:1', 'opencontrail.client', true)
Tomáš Kukráld5a40af2017-03-07 15:34:58 +0100400 // Provision opencontrail virtual routers
Marek Celoudfeb67062017-03-13 11:01:43 +0100401 salt.enforceState(saltMaster, 'I@opencontrail:compute', 'opencontrail.client', true)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100402
Tomáš Kukráld5a40af2017-03-07 15:34:58 +0100403 salt.runSaltProcessStep(saltMaster, 'I@nova:compute', 'cmd.run', ['exec 0>&-; exec 1>&-; exec 2>&-; nohup bash -c "ip link | grep vhost && echo no_reboot || sleep 5 && reboot & "'], null, true)
404 sleep(300)
405 }
Tomáš Kukrála18de112017-03-02 13:57:47 +0100406 }
Tomáš Kukrál2b4c1282017-03-03 17:25:26 +0100407
Tomáš Kukrál00ed1302017-03-03 17:38:40 +0100408 }
Tomáš Kukrál2b4c1282017-03-03 17:25:26 +0100409
Tomáš Kukrál00ed1302017-03-03 17:38:40 +0100410
Tomáš Kukrál6d627d62017-03-23 17:39:07 +0100411 if (common.checkContains('INSTALL', 'stacklight')) {
Tomáš Kukrál2b4c1282017-03-03 17:25:26 +0100412 stage('Install StackLight') {
413 // infra install
414 // Install the StackLight backends
415 salt.enforceState(saltMaster, '*01* and I@elasticsearch:server', 'elasticsearch.server', true)
416 salt.enforceState(saltMaster, 'I@elasticsearch:server', 'elasticsearch.server', true)
417
418 salt.enforceState(saltMaster, '*01* and I@influxdb:server', 'influxdb', true)
419 salt.enforceState(saltMaster, 'I@influxdb:server', 'influxdb', true)
420
421 salt.enforceState(saltMaster, '*01* and I@kibana:server', 'kibana.server', true)
422 salt.enforceState(saltMaster, 'I@kibana:server', 'kibana.server', true)
423
424 salt.enforceState(saltMaster, '*01* and I@grafana:server','grafana.server', true)
425 salt.enforceState(saltMaster, 'I@grafana:server','grafana.server', true)
426
427 salt.enforceState(saltMaster, 'I@nagios:server', 'nagios.server', true)
428 salt.enforceState(saltMaster, 'I@elasticsearch:client', 'elasticsearch.client.service', true)
429 salt.enforceState(saltMaster, 'I@kibana:client', 'kibana.client.service', true)
430 // nw salt.enforceState('I@kibana:client or I@elasticsearch:client' --async service.restart salt-minion
431
432 sleep(10)
Tomáš Kukrál2b4c1282017-03-03 17:25:26 +0100433
Marek Celoud3fd4ea92017-03-10 11:36:01 +0100434 salt.runSaltProcessStep(saltMaster, 'I@elasticsearch.client', 'cmd.run', ['salt-call state.sls elasticsearch.client'], null, true)
435 // salt.enforceState(saltMaster, 'I@elasticsearch:client', 'elasticsearch.client', true)
Marek Celoud481bc422017-03-10 12:13:19 +0100436 salt.runSaltProcessStep(saltMaster, 'I@kibana.client', 'cmd.run', ['salt-call state.sls kibana.client'], null, true)
437 // salt.enforceState(saltMaster, 'I@kibana:client', 'kibana.client', true)
Tomáš Kukrál2b4c1282017-03-03 17:25:26 +0100438
439 // install monitor
440 // Restart salt-minion to make sure that it uses the latest Jinja library
441 // no way: salt '*' --async service.restart salt-minion; sleep 15
442
443 // Start by flusing Salt Mine to make sure it is clean
444 // Also clean-up the grains files to make sure that we start from a clean state
445 // nw salt "*" mine.flush
446 // nw salt "*" file.remove /etc/salt/grains.d/collectd
447 // nw salt "*" file.remove /etc/salt/grains.d/grafana
448 // nw salt "*" file.remove /etc/salt/grains.d/heka
449 // nw salt "*" file.remove /etc/salt/grains.d/sensu
450 // nw salt "*" file.remove /etc/salt/grains
451
452 // Install collectd, heka and sensu services on the nodes, this will also
453 // generate the metadata that goes into the grains and eventually into Salt Mine
Tomáš Kukrál2aa3c472017-03-03 17:47:08 +0100454 salt.enforceState(saltMaster, '*', 'collectd', true)
Marek Celoudd6303412017-03-09 23:14:32 +0100455 salt.enforceState(saltMaster, '*', 'salt.minion', true)
Tomáš Kukrál2b4c1282017-03-03 17:25:26 +0100456 salt.enforceState(saltMaster, '*', 'heka', true)
Tomáš Kukrál2b4c1282017-03-03 17:25:26 +0100457
458 // Gather the Grafana metadata as grains
459 salt.enforceState(saltMaster, 'I@grafana:collector', 'grafana.collector', true)
460
461 // Update Salt Mine
462 salt.enforceState(saltMaster, '*', 'salt.minion.grains', true)
463 salt.runSaltProcessStep(saltMaster, '*', 'saltutil.refresh_modules', [], null, true)
464 salt.runSaltProcessStep(saltMaster, '*', 'mine.update', [], null, true)
465
466 sleep(5)
467
468 // Update Heka
469 salt.enforceState(saltMaster, 'I@heka:aggregator:enabled:True or I@heka:remote_collector:enabled:True', 'heka', true)
470
471 // Update collectd
472 salt.enforceState(saltMaster, 'I@collectd:remote_client:enabled:True', 'collectd', true)
473
474 // Update Nagios
475 salt.enforceState(saltMaster, 'I@nagios:server', 'nagios', true)
476 // Stop the Nagios service because the package starts it by default and it will
477 // started later only on the node holding the VIP address
478 salt.runSaltProcessStep(saltMaster, 'I@nagios:server', 'service.stop', ['nagios3'], null, true)
479
480 // Update Sensu
Tomáš Kukrál1ef3da72017-03-06 14:44:00 +0100481 // TODO for stacklight team, should be fixed in model
482 //salt.enforceState(saltMaster, 'I@sensu:server', 'sensu', true)
Tomáš Kukrál2b4c1282017-03-03 17:25:26 +0100483
484 // Finalize the configuration of Grafana (add the dashboards...)
485 salt.enforceState(saltMaster, 'I@grafana:client', 'grafana.client.service', true)
486 // nw salt -C 'I@grafana:client' --async service.restart salt-minion; sleep 10
Marek Celouda613ed02017-03-10 15:39:55 +0100487
488 salt.runSaltProcessStep(saltMaster, 'I@grafana.client and *01*', 'cmd.run', ['salt-call state.sls grafana.client'], null, true)
489 // salt.enforceState(saltMaster, 'I@grafana:client and *01*', 'grafana.client', true)
Tomáš Kukrál2b4c1282017-03-03 17:25:26 +0100490
491 // Get the StackLight monitoring VIP addres
Tomáš Kukrál2b4c1282017-03-03 17:25:26 +0100492 //vip=$(salt-call pillar.data _param:stacklight_monitor_address --out key|grep _param: |awk '{print $2}')
493 //vip=${vip:=172.16.10.253}
Tomáš Kukráledbb24c2017-03-10 16:10:29 +0100494 def pillar = salt.getPillar(saltMaster, 'ctl01*', '_param:stacklight_monitor_address')
Jakub Joseffafd6592017-03-27 18:53:17 +0200495 print(common.prettyPrint(pillar))
Tomáš Kukrálaae889a2017-03-22 13:37:34 +0100496 def stacklight_vip = pillar['return'][0].values()[0]
Tomáš Kukrál2b4c1282017-03-03 17:25:26 +0100497
Tomáš Kukrálaae889a2017-03-22 13:37:34 +0100498 if (stacklight_vip) {
Tomáš Kukrál6412a8c2017-03-07 14:03:47 +0100499 // (re)Start manually the services that are bound to the monitoring VIP
Tomáš Kukrálaae889a2017-03-22 13:37:34 +0100500 common.infoMsg("restart services on node with IP: ${stacklight_vip}")
Tomáš Kukrál1b08c8c2017-03-07 16:51:49 +0100501 salt.runSaltProcessStep(saltMaster, "G@ipv4:${stacklight_vip}", 'service.restart', ['remote_collectd'], null, true)
502 salt.runSaltProcessStep(saltMaster, "G@ipv4:${stacklight_vip}", 'service.restart', ['remote_collector'], null, true)
503 salt.runSaltProcessStep(saltMaster, "G@ipv4:${stacklight_vip}", 'service.restart', ['aggregator'], null, true)
504 salt.runSaltProcessStep(saltMaster, "G@ipv4:${stacklight_vip}", 'service.restart', ['nagios3'], null, true)
Tomáš Kukrálaae889a2017-03-22 13:37:34 +0100505 } else {
506 throw new Exception("Missing stacklight_vip")
Tomáš Kukrál6412a8c2017-03-07 14:03:47 +0100507 }
Tomáš Kukrál2b4c1282017-03-03 17:25:26 +0100508 }
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100509 }
510
Tomáš Kukrála18de112017-03-02 13:57:47 +0100511 //
512 // Test
513 //
Tomáš Kukrál695d6462017-04-21 16:31:52 +0200514 def artifacts_dir = '_artifacts/'
Tomáš Kukrála18de112017-03-02 13:57:47 +0100515
Tomáš Kukrál6d627d62017-03-23 17:39:07 +0100516 if (common.checkContains('TEST', 'k8s')) {
Tomáš Kukrála18de112017-03-02 13:57:47 +0100517 stage('Run k8s bootstrap tests') {
Tomáš Kukrál695d6462017-04-21 16:31:52 +0200518 def image = 'tomkukral/k8s-scripts'
Tomáš Kukrál44ca7fe2017-04-21 16:44:19 +0200519 def output_file = image.replaceAll('/', '-') + '.output'
Tomáš Kukrál695d6462017-04-21 16:31:52 +0200520
Tomáš Kukrálb22826d2017-04-21 16:38:00 +0200521 // run image
522 test.runConformanceTests(saltMaster, K8S_API_SERVER, image)
Tomáš Kukrálf56beed2017-04-21 16:21:06 +0200523
524 // collect output
Tomáš Kukrálf56beed2017-04-21 16:21:06 +0200525 sh "mkdir -p ${artifacts_dir}"
Tomáš Kukrálb22826d2017-04-21 16:38:00 +0200526 file_content = salt.getFileContent(saltMaster, 'ctl01*', '/tmp/' + output_file)
Tomáš Kukrálf56beed2017-04-21 16:21:06 +0200527 writeFile file: "${artifacts_dir}${output_file}", text: file_content
Tomáš Kukrálf56beed2017-04-21 16:21:06 +0200528 sh "cat ${artifacts_dir}${output_file}"
529
530 // collect artifacts
531 archiveArtifacts artifacts: "${artifacts_dir}${output_file}"
Tomáš Kukrála18de112017-03-02 13:57:47 +0100532 }
533
Tomáš Kukrálb22826d2017-04-21 16:38:00 +0200534 stage('Run k8s conformance e2e tests') {
535 //test.runConformanceTests(saltMaster, K8S_API_SERVER, K8S_CONFORMANCE_IMAGE)
536
537 def image = K8S_CONFORMANCE_IMAGE
Tomáš Kukrál44ca7fe2017-04-21 16:44:19 +0200538 def output_file = image.replaceAll('/', '-') + '.output'
Tomáš Kukrálb22826d2017-04-21 16:38:00 +0200539
540 // run image
541 test.runConformanceTests(saltMaster, K8S_API_SERVER, image)
542
543 // collect output
544 sh "mkdir -p ${artifacts_dir}"
545 file_content = salt.getFileContent(saltMaster, 'ctl01*', '/tmp/' + output_file)
546 writeFile file: "${artifacts_dir}${output_file}", text: file_content
547 sh "cat ${artifacts_dir}${output_file}"
548
549 // collect artifacts
550 archiveArtifacts artifacts: "${artifacts_dir}${output_file}"
551 }
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100552 }
Tomáš Kukrálb9957b32017-02-28 14:49:00 +0100553
Tomáš Kukrál6d627d62017-03-23 17:39:07 +0100554 if (common.checkContains('TEST', 'openstack')) {
Victor Ryzhenkin5f3b7e62017-03-09 16:02:58 +0400555 stage('Run OpenStack tests') {
556 test.runTempestTests(saltMaster, TEMPEST_IMAGE_LINK)
557 }
558
559 stage('Copy Tempest results to config node') {
560 test.copyTempestResults(saltMaster)
561 }
562 }
563
Tomáš Kukrál420d7ff2017-03-21 11:38:33 +0100564 stage('Finalize') {
Tomáš Kukrál38ab6bb2017-04-21 21:29:31 +0200565 if (INSTALL != '') {
566 try {
567 salt.runSaltProcessStep(saltMaster, '*', 'state.apply', [], null, true)
568 } catch (Exception e) {
569 common.warningMsg('State apply failed but we should continue to run')
570 }
Tomáš Kukrál420d7ff2017-03-21 11:38:33 +0100571 }
572 }
Tomáš Kukrála18de112017-03-02 13:57:47 +0100573 } catch (Throwable e) {
574 currentBuild.result = 'FAILURE'
575 throw e
Tomáš Kukrál65fb5fd2017-03-02 14:56:49 +0100576 } finally {
Tomáš Kukrálb9957b32017-02-28 14:49:00 +0100577
Tomáš Kukrál96b12d52017-03-07 22:43:37 +0100578
Tomáš Kukrála18de112017-03-02 13:57:47 +0100579 //
580 // Clean
581 //
582
Tomáš Kukrálc9a630a2017-03-07 17:28:53 +0100583 if (STACK_TYPE == 'heat') {
Tomáš Kukrál4507c6a2017-03-23 19:00:39 +0100584 // send notification
585 common.sendNotification(currentBuild.result, HEAT_STACK_NAME, ["slack"])
586
Tomáš Kukrálc9a630a2017-03-07 17:28:53 +0100587 if (HEAT_STACK_DELETE.toBoolean() == true) {
588 common.errorMsg('Heat job cleanup triggered')
589 stage('Trigger cleanup job') {
590 build job: 'deploy-heat-cleanup', parameters: [[$class: 'StringParameterValue', name: 'HEAT_STACK_NAME', value: HEAT_STACK_NAME]]
591 }
592 } else {
Tomáš Kukrálbcc53ea2017-03-08 08:15:57 +0100593 if (currentBuild.result == 'FAILURE') {
594 common.errorMsg("Deploy job FAILED and was not deleted. Please fix the problem and delete stack on you own.")
Tomáš Kukrálc9a630a2017-03-07 17:28:53 +0100595
Tomáš Kukrálbcc53ea2017-03-08 08:15:57 +0100596 if (SALT_MASTER_URL) {
597 common.errorMsg("Salt master URL: ${SALT_MASTER_URL}")
598 }
Tomáš Kukrálb908dac2017-03-07 18:58:35 +0100599 }
600
Tomáš Kukrála18de112017-03-02 13:57:47 +0100601 }
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100602 }
Tomáš Kukrálb9957b32017-02-28 14:49:00 +0100603 }
604 }
605}