blob: 2db16088fd6a2d8b89666a2576deda8bcad69182 [file] [log] [blame]
Tomáš Kukrálb9957b32017-02-28 14:49:00 +01001/**
2 *
3 * Launch heat stack with basic k8s
4 * Flow parameters:
Jakub Josef3c7915f2017-05-24 11:23:57 +02005 * STACK_NAME Heat stack name
6 * STACK_TYPE Orchestration engine: heat, ''
7 * STACK_INSTALL What should be installed (k8s, openstack, ...)
8 * STACK_TEST What should be tested (k8s, openstack, ...)
9 *
10 * STACK_TEMPLATE_URL URL to git repo with stack templates
11 * STACK_TEMPLATE_BRANCH Stack templates repo branch
12 * STACK_TEMPLATE_CREDENTIALS Credentials to the stack templates repo
13 * STACK_TEMPLATE Heat stack HOT template
14 * STACK_DELETE Delete stack when finished (bool)
15 * STACK_REUSE Reuse stack (don't create one)
16 * STACK_CLEANUP_JOB Name of job for deleting Heat stack
Tomáš Kukrálb9957b32017-02-28 14:49:00 +010017 *
18 * Expected parameters:
Tomáš Kukrálb9957b32017-02-28 14:49:00 +010019 * required for STACK_TYPE=heat
Tomáš Kukrálb9957b32017-02-28 14:49:00 +010020 * HEAT_STACK_ENVIRONMENT Heat stack environmental parameters
21 * HEAT_STACK_ZONE Heat stack availability zone
22 * HEAT_STACK_PUBLIC_NET Heat stack floating IP pool
Tomáš Kukrálb9957b32017-02-28 14:49:00 +010023 * OPENSTACK_API_URL OpenStack API address
24 * OPENSTACK_API_CREDENTIALS Credentials to the OpenStack API
25 * OPENSTACK_API_PROJECT OpenStack project to connect to
26 * OPENSTACK_API_CLIENT Versions of OpenStack python clients
27 * OPENSTACK_API_VERSION Version of the OpenStack API (2/3)
28 *
29 * SALT_MASTER_CREDENTIALS Credentials to the Salt API
30 *
31 * required for STACK_TYPE=NONE or empty string
32 * SALT_MASTER_URL URL of Salt-API
33
34 * K8S_API_SERVER Kubernetes API address
35 * K8S_CONFORMANCE_IMAGE Path to docker image with conformance e2e tests
36 *
Victor Ryzhenkin5f3b7e62017-03-09 16:02:58 +040037 * TEMPEST_IMAGE_LINK Tempest image link
38 *
Matthew Mosesohna85f24e2017-04-28 13:45:19 +030039 * optional parameters for overwriting soft params
40 * KUBERNETES_HYPERKUBE_IMAGE Docker repository and tag for hyperkube image
Matthew Mosesohnd00a8f52017-05-22 17:07:19 +030041 * CALICO_CNI_IMAGE Docker repository and tag for calico CNI image
42 * CALICO_NODE_IMAGE Docker repository and tag for calico node image
43 * CALICOCTL_IMAGE Docker repository and tag for calicoctl image
Matthew Mosesohna85f24e2017-04-28 13:45:19 +030044 *
Tomáš Kukrálb9957b32017-02-28 14:49:00 +010045 */
46
Tomáš Kukrál1f8b5012017-04-28 21:07:10 +020047common = new com.mirantis.mk.Common()
Tomáš Kukrálb9957b32017-02-28 14:49:00 +010048git = new com.mirantis.mk.Git()
49openstack = new com.mirantis.mk.Openstack()
Tomáš Kukrál1f8b5012017-04-28 21:07:10 +020050orchestrate = new com.mirantis.mk.Orchestrate()
Tomáš Kukrálb9957b32017-02-28 14:49:00 +010051salt = new com.mirantis.mk.Salt()
Ondrej Smola8f35e482017-03-30 14:04:36 +020052test = new com.mirantis.mk.Test()
Tomáš Kukrál1f8b5012017-04-28 21:07:10 +020053
Jakub Josef7f7bc8d2017-05-29 17:27:48 +020054// try to get STACK_INSTALL or fallback to INSTALL if exists
55try {
56 def temporary = STACK_INSTALL
57} catch (MissingPropertyException e) {
58 try {
59 STACK_INSTALL = INSTALL
Jakub Josef0599c402017-05-29 17:35:24 +020060 } catch (MissingPropertyException e2) {
Jakub Josef7f7bc8d2017-05-29 17:27:48 +020061 common.errorMsg("Property STACK_INSTALL or INSTALL not found!")
62 }
63}
64
65
Tomáš Kukrálab2f3702017-05-11 09:17:43 +020066_MAX_PERMITTED_STACKS = 2
Matthew Mosesohna85f24e2017-04-28 13:45:19 +030067overwriteFile = "/srv/salt/reclass/classes/cluster/overwrite.yml"
Tomáš Kukrále80680a2017-03-02 16:34:35 +010068
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +010069timestamps {
70 node {
Tomáš Kukrála18de112017-03-02 13:57:47 +010071 try {
72 //
73 // Prepare machines
74 //
Tomáš Kukrála18de112017-03-02 13:57:47 +010075 stage ('Create infrastructure') {
Tomáš Kukrál6d627d62017-03-23 17:39:07 +010076
Tomáš Kukrála18de112017-03-02 13:57:47 +010077 if (STACK_TYPE == 'heat') {
78 // value defaults
79 def openstackCloud
80 def openstackVersion = OPENSTACK_API_CLIENT ? OPENSTACK_API_CLIENT : 'liberty'
81 def openstackEnv = "${env.WORKSPACE}/venv"
Tomáš Kukrálb9957b32017-02-28 14:49:00 +010082
Jakub Josef3c7915f2017-05-24 11:23:57 +020083 if (STACK_REUSE.toBoolean() == true && STACK_NAME == '') {
Filip Pytloun794ad952017-03-03 10:39:26 +010084 error("If you want to reuse existing stack you need to provide it's name")
85 }
86
Jakub Josef3c7915f2017-05-24 11:23:57 +020087 if (STACK_REUSE.toBoolean() == false) {
Filip Pytloun794ad952017-03-03 10:39:26 +010088 // Don't allow to set custom heat stack name
89 wrap([$class: 'BuildUser']) {
Tomáš Kukrál24d7fe62017-03-03 10:57:11 +010090 if (env.BUILD_USER_ID) {
Jakub Josef3c7915f2017-05-24 11:23:57 +020091 STACK_NAME = "${env.BUILD_USER_ID}-${JOB_NAME}-${BUILD_NUMBER}"
Tomáš Kukrál24d7fe62017-03-03 10:57:11 +010092 } else {
Jakub Josef3c7915f2017-05-24 11:23:57 +020093 STACK_NAME = "jenkins-${JOB_NAME}-${BUILD_NUMBER}"
Tomáš Kukrál24d7fe62017-03-03 10:57:11 +010094 }
Jakub Josef3c7915f2017-05-24 11:23:57 +020095 currentBuild.description = STACK_NAME
Filip Pytloun794ad952017-03-03 10:39:26 +010096 }
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +010097 }
Tomáš Kukrála18de112017-03-02 13:57:47 +010098
Tomáš Kukrálcbabec42017-03-02 16:24:04 +010099 // set description
Jakub Josef3c7915f2017-05-24 11:23:57 +0200100 currentBuild.description = "${STACK_NAME}"
Tomáš Kukrálcbabec42017-03-02 16:24:04 +0100101
Tomáš Kukrála18de112017-03-02 13:57:47 +0100102 // get templates
Jakub Josef3c7915f2017-05-24 11:23:57 +0200103 git.checkoutGitRepository('template', STACK_TEMPLATE_URL, STACK_TEMPLATE_BRANCH, STACK_TEMPLATE_CREDENTIALS)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100104
105 // create openstack env
106 openstack.setupOpenstackVirtualenv(openstackEnv, openstackVersion)
107 openstackCloud = openstack.createOpenstackEnv(OPENSTACK_API_URL, OPENSTACK_API_CREDENTIALS, OPENSTACK_API_PROJECT)
108 openstack.getKeystoneToken(openstackCloud, openstackEnv)
Jakub Josef458913d2017-05-10 15:37:56 +0200109 //
110 // Verify possibility of create stack for given user and stack type
111 //
112 wrap([$class: 'BuildUser']) {
Jakub Josef3c7915f2017-05-24 11:23:57 +0200113 if (env.BUILD_USER_ID && !env.BUILD_USER_ID.equals("jenkins") && !STACK_REUSE.toBoolean()) {
Jakub Josef78c3f8b2017-05-10 15:45:29 +0200114 def existingStacks = openstack.getStacksForNameContains(openstackCloud, "${env.BUILD_USER_ID}-${JOB_NAME}", openstackEnv)
115 if(existingStacks.size() >= _MAX_PERMITTED_STACKS){
Jakub Josef3c7915f2017-05-24 11:23:57 +0200116 STACK_DELETE = "false"
Jakub Josef78c3f8b2017-05-10 15:45:29 +0200117 throw new Exception("You cannot create new stack, you already have ${_MAX_PERMITTED_STACKS} stacks of this type (${JOB_NAME}). \nStack names: ${existingStacks}")
118 }
Jakub Josef458913d2017-05-10 15:37:56 +0200119 }
120 }
Tomáš Kukrála18de112017-03-02 13:57:47 +0100121 // launch stack
Jakub Josef3c7915f2017-05-24 11:23:57 +0200122 if (STACK_REUSE.toBoolean() == false) {
Tomáš Kukrála18de112017-03-02 13:57:47 +0100123 stage('Launch new Heat stack') {
124 // create stack
125 envParams = [
126 'instance_zone': HEAT_STACK_ZONE,
127 'public_net': HEAT_STACK_PUBLIC_NET
128 ]
Jakub Josef3c7915f2017-05-24 11:23:57 +0200129 openstack.createHeatStack(openstackCloud, STACK_NAME, STACK_TEMPLATE, envParams, HEAT_STACK_ENVIRONMENT, openstackEnv)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100130 }
131 }
132
133 // get SALT_MASTER_URL
Jakub Josef3c7915f2017-05-24 11:23:57 +0200134 saltMasterHost = openstack.getHeatStackOutputParam(openstackCloud, STACK_NAME, 'salt_master_ip', openstackEnv)
135 currentBuild.description = "${STACK_NAME}: ${saltMasterHost}"
Tomáš Kukrál615aa9c2017-03-04 15:29:08 +0100136
Ales Komarek47a29f12017-04-26 12:05:47 +0200137 SALT_MASTER_URL = "http://${saltMasterHost}:6969"
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100138 }
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100139 }
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100140
Tomáš Kukrála18de112017-03-02 13:57:47 +0100141 //
142 // Connect to Salt master
143 //
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100144
Tomáš Kukrála18de112017-03-02 13:57:47 +0100145 def saltMaster
146 stage('Connect to Salt API') {
147 saltMaster = salt.connection(SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
148 }
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100149
Tomáš Kukrála18de112017-03-02 13:57:47 +0100150 //
151 // Install
152 //
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100153
Jakub Josef3c7915f2017-05-24 11:23:57 +0200154 if (common.checkContains('STACK_INSTALL', 'core')) {
Tomáš Kukrála18de112017-03-02 13:57:47 +0100155 stage('Install core infrastructure') {
Ales Komarek47a29f12017-04-26 12:05:47 +0200156 orchestrate.installFoundationInfra(saltMaster)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100157
Jakub Josef3c7915f2017-05-24 11:23:57 +0200158 if (common.checkContains('STACK_INSTALL', 'kvm')) {
Ales Komarek47a29f12017-04-26 12:05:47 +0200159 orchestrate.installInfraKvm(saltMaster)
160 orchestrate.installFoundationInfra(saltMaster)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100161 }
162
Ales Komarek47a29f12017-04-26 12:05:47 +0200163 orchestrate.validateFoundationInfra(saltMaster)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100164 }
165 }
166
167 // install k8s
Jakub Josef3c7915f2017-05-24 11:23:57 +0200168 if (common.checkContains('STACK_INSTALL', 'k8s')) {
Tomáš Kukrála18de112017-03-02 13:57:47 +0100169 stage('Install Kubernetes infra') {
Ales Komarek47a29f12017-04-26 12:05:47 +0200170 orchestrate.installKubernetesInfra(saltMaster)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100171 }
172
Tomáš Kukrála18de112017-03-02 13:57:47 +0100173 stage('Install Kubernetes control') {
Tomáš Kukrál06c27a92017-03-01 16:21:46 +0100174
Ales Komarek47a29f12017-04-26 12:05:47 +0200175 // Overwrite Kubernetes vars if specified
176 if (env.getEnvironment().containsKey("KUBERNETES_HYPERKUBE_IMAGE")) {
Tomáš Kukrálfbb98322017-05-02 10:38:05 +0200177 salt.runSaltProcessStep(saltMaster, 'I@salt:master', 'file.append', overwriteFile, " kubernetes_hyperkube_image: ${KUBERNETES_HYPERKUBE_IMAGE}")
Ales Komarek47a29f12017-04-26 12:05:47 +0200178 }
Matthew Mosesohnd00a8f52017-05-22 17:07:19 +0300179 // Overwrite Calico vars if specified
180 if (env.getEnvironment().containsKey("CALICO_CNI_IMAGE")) {
181 salt.runSaltProcessStep(saltmaster, 'I@salt:master', 'file.append', overwriteFile, " kubernetes_calico_cni_image: ${CALICO_CNI_IMAGE}")
182 }
183 if (env.getEnvironment().containsKey("CALICO_NODE_IMAGE")) {
184 salt.runSaltProcessStep(saltmaster, 'I@salt:master', 'file.append', overwriteFile, " kubernetes_calico_node_image: ${CALICO_NODE_IMAGE}")
185 }
186 if (env.getEnvironment().containsKey("CALICOCTL_IMAGE")) {
187 salt.runSaltProcessStep(saltmaster, 'I@salt:master', 'file.append', overwriteFile, " kubernetes_calicoctl_image: ${CALICOCTL_IMAGE}")
188 }
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100189
Ales Komarek47a29f12017-04-26 12:05:47 +0200190 orchestrate.installKubernetesControl(saltMaster)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100191 }
Tomáš Kukrálfeb959e2017-05-18 11:00:41 +0200192
193
Jakub Josef3c7915f2017-05-24 11:23:57 +0200194 if (common.checkContains('STACK_INSTALL', 'contrail')) {
Tomáš Kukrálfeb959e2017-05-18 11:00:41 +0200195 state('Install Contrail for Kubernetes') {
196 orchestrate.installContrailNetwork(saltMaster)
197 orchestrate.installContrailCompute(saltMaster)
198 }
199 }
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100200 }
201
Tomáš Kukrála18de112017-03-02 13:57:47 +0100202 // install openstack
Jakub Josef3c7915f2017-05-24 11:23:57 +0200203 if (common.checkContains('STACK_INSTALL', 'openstack')) {
Tomáš Kukrála18de112017-03-02 13:57:47 +0100204 // install Infra and control, tests, ...
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100205
Tomáš Kukrála18de112017-03-02 13:57:47 +0100206 stage('Install OpenStack infra') {
Ales Komarek47a29f12017-04-26 12:05:47 +0200207 orchestrate.installOpenstackInfra(saltMaster)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100208 }
209
Tomáš Kukrála18de112017-03-02 13:57:47 +0100210 stage('Install OpenStack control') {
Ales Komarek47a29f12017-04-26 12:05:47 +0200211 orchestrate.installOpenstackControl(saltMaster)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100212 }
213
214 stage('Install OpenStack network') {
Tomáš Kukrála18de112017-03-02 13:57:47 +0100215
Jakub Josef3c7915f2017-05-24 11:23:57 +0200216 if (common.checkContains('STACK_INSTALL', 'contrail')) {
Ales Komarek47a29f12017-04-26 12:05:47 +0200217 orchestrate.installContrailNetwork(saltMaster)
Jakub Josef3c7915f2017-05-24 11:23:57 +0200218 } else if (common.checkContains('STACK_INSTALL', 'ovs')) {
Ales Komarek47a29f12017-04-26 12:05:47 +0200219 orchestrate.installOpenstackNetwork(saltMaster)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100220 }
221
Tomáš Kukrálfbb98322017-05-02 10:38:05 +0200222 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; neutron net-list'])
223 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; nova net-list'])
Tomáš Kukrála18de112017-03-02 13:57:47 +0100224 }
225
226 stage('Install OpenStack compute') {
Ales Komarek47a29f12017-04-26 12:05:47 +0200227 orchestrate.installOpenstackCompute(saltMaster)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100228
Jakub Josef3c7915f2017-05-24 11:23:57 +0200229 if (common.checkContains('STACK_INSTALL', 'contrail')) {
Ales Komarek47a29f12017-04-26 12:05:47 +0200230 orchestrate.installContrailCompute(saltMaster)
Tomáš Kukráld5a40af2017-03-07 15:34:58 +0100231 }
Tomáš Kukrála18de112017-03-02 13:57:47 +0100232 }
Tomáš Kukrál2b4c1282017-03-03 17:25:26 +0100233
Tomáš Kukrál00ed1302017-03-03 17:38:40 +0100234 }
Tomáš Kukrál2b4c1282017-03-03 17:25:26 +0100235
Tomáš Kukrál00ed1302017-03-03 17:38:40 +0100236
Jakub Josef3c7915f2017-05-24 11:23:57 +0200237 if (common.checkContains('STACK_INSTALL', 'stacklight')) {
Tomáš Kukrál2b4c1282017-03-03 17:25:26 +0100238 stage('Install StackLight') {
Ales Komarek47a29f12017-04-26 12:05:47 +0200239 orchestrate.installStacklightControl(saltMaster)
240 orchestrate.installStacklightClient(saltMaster)
Tomáš Kukrál2b4c1282017-03-03 17:25:26 +0100241 }
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100242 }
243
Tomáš Kukrála18de112017-03-02 13:57:47 +0100244 //
245 // Test
246 //
Tomáš Kukrál695d6462017-04-21 16:31:52 +0200247 def artifacts_dir = '_artifacts/'
Tomáš Kukrála18de112017-03-02 13:57:47 +0100248
Jakub Josef3c7915f2017-05-24 11:23:57 +0200249 if (common.checkContains('STACK_TEST', 'k8s')) {
Tomáš Kukrála18de112017-03-02 13:57:47 +0100250 stage('Run k8s bootstrap tests') {
Tomáš Kukrál695d6462017-04-21 16:31:52 +0200251 def image = 'tomkukral/k8s-scripts'
Tomáš Kukrál44ca7fe2017-04-21 16:44:19 +0200252 def output_file = image.replaceAll('/', '-') + '.output'
Tomáš Kukrál695d6462017-04-21 16:31:52 +0200253
Tomáš Kukrálb22826d2017-04-21 16:38:00 +0200254 // run image
255 test.runConformanceTests(saltMaster, K8S_API_SERVER, image)
Tomáš Kukrálf56beed2017-04-21 16:21:06 +0200256
257 // collect output
Tomáš Kukrálf56beed2017-04-21 16:21:06 +0200258 sh "mkdir -p ${artifacts_dir}"
Tomáš Kukrálb22826d2017-04-21 16:38:00 +0200259 file_content = salt.getFileContent(saltMaster, 'ctl01*', '/tmp/' + output_file)
Tomáš Kukrálf56beed2017-04-21 16:21:06 +0200260 writeFile file: "${artifacts_dir}${output_file}", text: file_content
Tomáš Kukrálf56beed2017-04-21 16:21:06 +0200261 sh "cat ${artifacts_dir}${output_file}"
262
263 // collect artifacts
264 archiveArtifacts artifacts: "${artifacts_dir}${output_file}"
Tomáš Kukrála18de112017-03-02 13:57:47 +0100265 }
266
Tomáš Kukrálb22826d2017-04-21 16:38:00 +0200267 stage('Run k8s conformance e2e tests') {
268 //test.runConformanceTests(saltMaster, K8S_API_SERVER, K8S_CONFORMANCE_IMAGE)
269
270 def image = K8S_CONFORMANCE_IMAGE
Tomáš Kukrál44ca7fe2017-04-21 16:44:19 +0200271 def output_file = image.replaceAll('/', '-') + '.output'
Tomáš Kukrálb22826d2017-04-21 16:38:00 +0200272
273 // run image
274 test.runConformanceTests(saltMaster, K8S_API_SERVER, image)
275
276 // collect output
277 sh "mkdir -p ${artifacts_dir}"
278 file_content = salt.getFileContent(saltMaster, 'ctl01*', '/tmp/' + output_file)
279 writeFile file: "${artifacts_dir}${output_file}", text: file_content
280 sh "cat ${artifacts_dir}${output_file}"
281
282 // collect artifacts
283 archiveArtifacts artifacts: "${artifacts_dir}${output_file}"
284 }
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100285 }
Tomáš Kukrálb9957b32017-02-28 14:49:00 +0100286
Jakub Josef3c7915f2017-05-24 11:23:57 +0200287 if (common.checkContains('STACK_TEST', 'openstack')) {
Victor Ryzhenkin5f3b7e62017-03-09 16:02:58 +0400288 stage('Run OpenStack tests') {
289 test.runTempestTests(saltMaster, TEMPEST_IMAGE_LINK)
290 }
291
292 stage('Copy Tempest results to config node') {
293 test.copyTempestResults(saltMaster)
294 }
295 }
296
Tomáš Kukrál420d7ff2017-03-21 11:38:33 +0100297 stage('Finalize') {
Jakub Josef3c7915f2017-05-24 11:23:57 +0200298 if (STACK_INSTALL != '') {
Tomáš Kukrál38ab6bb2017-04-21 21:29:31 +0200299 try {
300 salt.runSaltProcessStep(saltMaster, '*', 'state.apply', [], null, true)
301 } catch (Exception e) {
302 common.warningMsg('State apply failed but we should continue to run')
Jakub Josefa6904f12017-05-22 16:37:27 +0200303 throw e
Tomáš Kukrál38ab6bb2017-04-21 21:29:31 +0200304 }
Tomáš Kukrál420d7ff2017-03-21 11:38:33 +0100305 }
306 }
Tomáš Kukrála18de112017-03-02 13:57:47 +0100307 } catch (Throwable e) {
308 currentBuild.result = 'FAILURE'
309 throw e
Tomáš Kukrál65fb5fd2017-03-02 14:56:49 +0100310 } finally {
Tomáš Kukrálb9957b32017-02-28 14:49:00 +0100311
Tomáš Kukrál96b12d52017-03-07 22:43:37 +0100312
Tomáš Kukrála18de112017-03-02 13:57:47 +0100313 //
314 // Clean
315 //
316
Tomáš Kukrálc9a630a2017-03-07 17:28:53 +0100317 if (STACK_TYPE == 'heat') {
Tomáš Kukrál4507c6a2017-03-23 19:00:39 +0100318 // send notification
Jakub Josef3c7915f2017-05-24 11:23:57 +0200319 common.sendNotification(currentBuild.result, STACK_NAME, ["slack"])
Tomáš Kukrál4507c6a2017-03-23 19:00:39 +0100320
Jakub Josef3c7915f2017-05-24 11:23:57 +0200321 if (STACK_DELETE.toBoolean() == true) {
Tomáš Kukrálc9a630a2017-03-07 17:28:53 +0100322 common.errorMsg('Heat job cleanup triggered')
323 stage('Trigger cleanup job') {
Jakub Josef187bbba2017-05-24 18:16:00 +0200324 build job: STACK_CLEANUP_JOB, parameters: [[$class: 'StringParameterValue', name: 'HEAT_STACK_NAME', value: STACK_NAME]]
Tomáš Kukrálc9a630a2017-03-07 17:28:53 +0100325 }
326 } else {
Tomáš Kukrálbcc53ea2017-03-08 08:15:57 +0100327 if (currentBuild.result == 'FAILURE') {
328 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 +0100329
Tomáš Kukrálbcc53ea2017-03-08 08:15:57 +0100330 if (SALT_MASTER_URL) {
331 common.errorMsg("Salt master URL: ${SALT_MASTER_URL}")
332 }
Tomáš Kukrálb908dac2017-03-07 18:58:35 +0100333 }
334
Tomáš Kukrála18de112017-03-02 13:57:47 +0100335 }
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100336 }
Tomáš Kukrálb9957b32017-02-28 14:49:00 +0100337 }
338 }
339}