blob: 496ef9061a947336493a4ea76749944db2226ab4 [file] [log] [blame]
Ales Komarek24097402017-05-22 16:28:10 +02001/**
2 *
Tomáš Kukrál0d00dd22017-07-27 14:28:36 +02003 * Launch stack and work with it
Ales Komarek24097402017-05-22 16:28:10 +02004 *
5 * Expected parameters:
6 * STACK_NAME Infrastructure stack name
Tomáš Kukrál4691f682017-07-27 16:36:12 +02007 * STACK_TEMPLATE File with stack template
8 * STACK_TYPE Deploy OpenStack/AWS [heat/aws], use 'physical' if no stack should be started
Ales Komarek24097402017-05-22 16:28:10 +02009 *
10 * STACK_TEMPLATE_URL URL to git repo with stack templates
11 * STACK_TEMPLATE_CREDENTIALS Credentials to the templates repo
12 * STACK_TEMPLATE_BRANCH Stack templates repo branch
13 *
14 * STACK_DELETE Delete stack when finished (bool)
Tomáš Kukrál4691f682017-07-27 16:36:12 +020015 * STACK_REUSE Reuse existing stack (don't create one, only read outputs)
Ales Komarek24097402017-05-22 16:28:10 +020016 * STACK_INSTALL What should be installed (k8s, openstack, ...)
17 * STACK_TEST Run tests (bool)
18 * STACK_CLEANUP_JOB Name of job for deleting stack
19 *
Tomáš Kukrál74f92862017-06-05 19:18:43 +020020 * STACK_COMPUTE_COUNT Number of compute nodes to launch
Vasyl Saienkoa81e9312018-03-06 01:28:35 +020021 * STACK_CLUSTER_NAME The name of cluster model to use
Jiri Broulik61b3e5d2017-12-19 15:42:30 +010022 * STATIC_MGMT_NETWORK Check if model contains static IP address definitions for all nodes
Tomáš Kukrál74f92862017-06-05 19:18:43 +020023 *
Ales Komarek24097402017-05-22 16:28:10 +020024 * AWS_STACK_REGION CloudFormation AWS region
25 * AWS_API_CREDENTIALS AWS Access key ID with AWS secret access key
Tomáš Kukrál7a8a4fa2017-05-25 14:54:24 +020026 * AWS_SSH_KEY AWS key pair name (used for SSH access)
Ales Komarek24097402017-05-22 16:28:10 +020027 *
28 * HEAT_STACK_ENVIRONMENT Heat stack environmental parameters
29 * HEAT_STACK_ZONE Heat stack availability zone
30 * HEAT_STACK_PUBLIC_NET Heat stack floating IP pool
31 * OPENSTACK_API_URL OpenStack API address
32 * OPENSTACK_API_CREDENTIALS Credentials to the OpenStack API
33 * OPENSTACK_API_PROJECT OpenStack project to connect to
34 * OPENSTACK_API_CLIENT Versions of OpenStack python clients
35 * OPENSTACK_API_VERSION Version of the OpenStack API (2/3)
Oleh Hryhorov9630a762017-10-24 14:33:25 +030036 * SLAVE_NODE Lable or node name where the job will be run
Tomáš Kukrál5c2ec132017-07-26 09:57:27 +020037
Ales Komarek24097402017-05-22 16:28:10 +020038 * SALT_MASTER_CREDENTIALS Credentials to the Salt API
Tomáš Kukrál4691f682017-07-27 16:36:12 +020039 * required for STACK_TYPE=physical
Ales Komarek24097402017-05-22 16:28:10 +020040 * SALT_MASTER_URL URL of Salt master
Tomáš Kukrál5c2ec132017-07-26 09:57:27 +020041
Oleg Iurchenko9a8c3d72017-12-21 14:55:38 +020042 * BOOTSTRAP_EXTRA_REPO_PARAMS optional parameter to define a list of extra repos with parameters
43 * which have to be added during bootstrap.
44 * Format: repo 1, repo priority 1, repo pin 1; repo 2, repo priority 2, repo pin 2;
45
Oleh Hryhorov825b5be2018-06-13 13:01:53 +030046 * SALT_VERSION Version of Salt which is going to be installed i.e. 'stable 2016.3' or 'stable 2017.7' etc.
47 *
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +030048 * EXTRA_TARGET The value will be added to target nodes
49 *
Tomáš Kukrál5c2ec132017-07-26 09:57:27 +020050 * Test settings:
51 * TEST_K8S_API_SERVER Kubernetes API address
52 * TEST_K8S_CONFORMANCE_IMAGE Path to docker image with conformance e2e tests
Ales Komarek24097402017-05-22 16:28:10 +020053 *
Tomáš Kukrál5c2ec132017-07-26 09:57:27 +020054 * TEST_DOCKER_INSTALL Install docker on the target if true
55 * TEST_TEMPEST_IMAGE Tempest image link
56 * TEST_TEMPEST_PATTERN If not false, run tests matched to pattern only
57 * TEST_TEMPEST_TARGET Salt target for tempest node
ibumarskov637a2152018-01-16 10:39:57 +040058 * TESTRAIL_REPORT Whether upload results to testrail or not
59 * TESTRAIL_REPORTER_IMAGE Docker image for testrail reporter
60 * TESTRAIL_QA_CREDENTIALS Credentials for upload to testrail
61 * TESTRAIL_MILESTONE Product version for tests
62 * TESTRAIL_PLAN Testrail test plan
63 * TESTRAIL_GROUP Testrail test group
64 * TESTRAIL_SUITE Testrail test suite
Ales Komarek24097402017-05-22 16:28:10 +020065 *
Tomáš Kukrál5c2ec132017-07-26 09:57:27 +020066 * optional parameters for overwriting soft params
67 * SALT_OVERRIDES YAML with overrides for Salt deployment
Ales Komarek24097402017-05-22 16:28:10 +020068 *
69 */
Tomáš Kukrál3a17dd62017-07-27 18:24:16 +020070
Ales Komarek24097402017-05-22 16:28:10 +020071common = new com.mirantis.mk.Common()
72git = new com.mirantis.mk.Git()
73openstack = new com.mirantis.mk.Openstack()
Tomáš Kukrál7a8a4fa2017-05-25 14:54:24 +020074aws = new com.mirantis.mk.Aws()
Ales Komarek24097402017-05-22 16:28:10 +020075orchestrate = new com.mirantis.mk.Orchestrate()
Mykyta Karpine016d7e2017-10-09 13:35:20 +030076python = new com.mirantis.mk.Python()
Ales Komarek24097402017-05-22 16:28:10 +020077salt = new com.mirantis.mk.Salt()
78test = new com.mirantis.mk.Test()
79
80_MAX_PERMITTED_STACKS = 2
81overwriteFile = "/srv/salt/reclass/classes/cluster/override.yml"
82
Tomáš Kukrála1d86b82017-07-10 17:24:01 +020083// Define global variables
Tomáš Kukrála1d86b82017-07-10 17:24:01 +020084def venv
chnyda597fb032017-10-06 13:42:48 +020085def venvPepper
Tomáš Kukrál8e50d8e2017-09-01 17:40:53 +020086def outputs = [:]
Tomáš Kukrálbc4be252017-06-06 11:28:40 +020087
chnydae14058a2017-08-29 15:07:48 +020088def ipRegex = "\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"
89
Tomáš Kukrálb19bdda2017-06-13 17:09:43 +020090if (STACK_TYPE == 'aws') {
Tomáš Kukrála1d86b82017-07-10 17:24:01 +020091 def aws_env_vars
Tomáš Kukrál8427ff52017-08-30 15:46:52 +020092} else if (STACK_TYPE == 'heat') {
93 def envParams
94 def openstackCloud
Tomáš Kukrálb19bdda2017-06-13 17:09:43 +020095}
96
Oleh Hryhorov9630a762017-10-24 14:33:25 +030097def slave_node = 'python'
98
Oleh Hryhorov54460512017-10-26 18:45:36 +030099if (common.validInputParam('SLAVE_NODE')) {
Oleh Hryhorov9630a762017-10-24 14:33:25 +0300100 slave_node = SLAVE_NODE
101}
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300102
103def extra_tgt = ''
Stanislav Riazanovf0302582019-02-04 17:47:06 +0400104def extra_tgt_bckp = ''
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300105if (common.validInputParam('EXTRA_TARGET')) {
106 extra_tgt = "${EXTRA_TARGET}"
107}
108
Jakub Josefa63f9862018-01-11 17:58:38 +0100109timeout(time: 12, unit: 'HOURS') {
110 node(slave_node) {
111 try {
112 // Set build-specific variables
Jakub Josef88aaf832018-01-18 16:18:28 +0100113 def workspace = common.getWorkspace()
114 venv = "${workspace}/venv"
115 venvPepper = "${workspace}/venvPepper"
Jakub Josef052e77a2018-03-05 15:19:03 +0100116 if(common.validInputParam("STACK_DELETE") && STACK_DELETE.toBoolean()){
117 common.warningMsg("You running stack with STACK_DELETE option enabled, deployed stack will be removed at the end!")
118 }
Jakub Josefa63f9862018-01-11 17:58:38 +0100119 //
120 // Prepare machines
121 //
122 stage ('Create infrastructure') {
Tomáš Kukrála1d86b82017-07-10 17:24:01 +0200123
Jakub Josefa63f9862018-01-11 17:58:38 +0100124 outputs.put('stack_type', STACK_TYPE)
Ales Komarek24097402017-05-22 16:28:10 +0200125
Jakub Josefa63f9862018-01-11 17:58:38 +0100126 if (STACK_TYPE == 'heat') {
127 // value defaults
128 envParams = [
129 'cluster_zone': HEAT_STACK_ZONE,
130 'cluster_public_net': HEAT_STACK_PUBLIC_NET
131 ]
Tomáš Kukrál8e50d8e2017-09-01 17:40:53 +0200132
Jakub Josefa63f9862018-01-11 17:58:38 +0100133 if (STACK_REUSE.toBoolean() == true && STACK_NAME == '') {
134 error("If you want to reuse existing stack you need to provide it's name")
Ruslan Kamaldinov65144322017-08-02 15:16:55 +0400135 }
Tomáš Kukrál550364e2017-08-23 11:42:45 +0200136
Jakub Josefa63f9862018-01-11 17:58:38 +0100137 if (STACK_REUSE.toBoolean() == false) {
Vasyl Saienko293fa3f2019-01-22 21:14:37 +0200138 // TODO(vsaienko): remove stack creation from this pipeline to separate job
139 // Allow to set custom stack name but user-id will be added anyway
140 // This will fix issue with cleanup when job is aborted by jenkins and
141 // still guarantee stack count per user.
142 def stackNameSuffix = "${JOB_NAME}-${BUILD_NUMBER}"
143 if (STACK_NAME != ''){
144 stackNameSuffix = STACK_NAME
145 }
Jakub Josefa63f9862018-01-11 17:58:38 +0100146 wrap([$class: 'BuildUser']) {
147 if (env.BUILD_USER_ID) {
Vasyl Saienko293fa3f2019-01-22 21:14:37 +0200148 STACK_NAME = "${env.BUILD_USER_ID}-${stackNameSuffix}"
Jakub Josefa63f9862018-01-11 17:58:38 +0100149 } else {
Vasyl Saienko293fa3f2019-01-22 21:14:37 +0200150 STACK_NAME = "jenkins-${stackNameSuffix}"
Jakub Josefa63f9862018-01-11 17:58:38 +0100151 }
152 currentBuild.description = STACK_NAME
Ales Komarek24097402017-05-22 16:28:10 +0200153 }
Inessa Vasilevskaya7fd23f22018-10-09 10:58:46 +0200154 } else {
155 // In case name was copied with unicode zero-width space chars -
156 // remove them
157 STACK_NAME = STACK_NAME.trim().replaceAll("\\p{C}", "")
Ales Komarek24097402017-05-22 16:28:10 +0200158 }
159
Ruslan Kamaldinov65144322017-08-02 15:16:55 +0400160 // no underscore in STACK_NAME
161 STACK_NAME = STACK_NAME.replaceAll('_', '-')
Jakub Josefa63f9862018-01-11 17:58:38 +0100162 outputs.put('stack_name', STACK_NAME)
Ales Komarek24097402017-05-22 16:28:10 +0200163
Jakub Josefa63f9862018-01-11 17:58:38 +0100164 // set description
165 currentBuild.description = "${STACK_NAME}"
Ruslan Kamaldinov65144322017-08-02 15:16:55 +0400166
Ales Komarek24097402017-05-22 16:28:10 +0200167 // get templates
168 git.checkoutGitRepository('template', STACK_TEMPLATE_URL, STACK_TEMPLATE_BRANCH, STACK_TEMPLATE_CREDENTIALS)
169
Jakub Josefa63f9862018-01-11 17:58:38 +0100170 // create openstack env
171 openstack.setupOpenstackVirtualenv(venv, OPENSTACK_API_CLIENT)
Jakub Josef88aaf832018-01-18 16:18:28 +0100172 openstackCloud = openstack.createOpenstackEnv(venv,
Jakub Josefa63f9862018-01-11 17:58:38 +0100173 OPENSTACK_API_URL, OPENSTACK_API_CREDENTIALS,
174 OPENSTACK_API_PROJECT, OPENSTACK_API_PROJECT_DOMAIN,
175 OPENSTACK_API_PROJECT_ID, OPENSTACK_API_USER_DOMAIN,
176 OPENSTACK_API_VERSION)
177 openstack.getKeystoneToken(openstackCloud, venv)
Ales Komarek24097402017-05-22 16:28:10 +0200178
Jakub Josefa63f9862018-01-11 17:58:38 +0100179 //
180 // Verify possibility of create stack for given user and stack type
181 //
182 wrap([$class: 'BuildUser']) {
183 if (env.BUILD_USER_ID && !env.BUILD_USER_ID.equals("jenkins") && !STACK_REUSE.toBoolean()) {
184 def existingStacks = openstack.getStacksForNameContains(openstackCloud, "${env.BUILD_USER_ID}-${JOB_NAME}".replaceAll('_', '-'), venv)
185 if (existingStacks.size() >= _MAX_PERMITTED_STACKS) {
186 STACK_DELETE = "false"
187 throw new Exception("You cannot create new stack, you already have ${_MAX_PERMITTED_STACKS} stacks of this type (${JOB_NAME}). \nStack names: ${existingStacks}")
188 }
189 }
Tomáš Kukrál8e50d8e2017-09-01 17:40:53 +0200190 }
Jakub Josefa63f9862018-01-11 17:58:38 +0100191 // launch stack
192 if (STACK_REUSE.toBoolean() == false) {
Ruslan Kamaldinov65144322017-08-02 15:16:55 +0400193
Jakub Josefa63f9862018-01-11 17:58:38 +0100194 // set reclass repo in heat env
195 try {
196 envParams.put('cfg_reclass_branch', STACK_RECLASS_BRANCH)
197 envParams.put('cfg_reclass_address', STACK_RECLASS_ADDRESS)
198 } catch (MissingPropertyException e) {
199 common.infoMsg("Property STACK_RECLASS_BRANCH or STACK_RECLASS_ADDRESS not found! Using default values from template.")
Tomáš Kukrálf83409d2017-11-08 20:56:57 +0100200 }
201
sgarbuz489ae3e2019-04-04 10:27:09 +0300202 // put reclass-system repo to branch/tag/ref. If empty will be used reclass pinned commit in AIO model.
203 if (common.validInputParam('RECLASS_SYSTEM_BRANCH')) {
204 common.infoMsg("Setting reclass-system repo to ${RECLASS_SYSTEM_BRANCH} branch/tag/ref")
205 envParams.put('cfg_reclass_system_branch', RECLASS_SYSTEM_BRANCH)
206 }
207
Jakub Josefa63f9862018-01-11 17:58:38 +0100208 // put formulas revision - stable, testing or nightly
209 if (common.validInputParam('FORMULA_PKG_REVISION')) {
210 common.infoMsg("Setting formulas revision to ${FORMULA_PKG_REVISION}")
211 envParams.put('cfg_formula_pkg_revision', FORMULA_PKG_REVISION)
212 }
213
214 // put extra repo definitions
215 if (common.validInputParam('BOOTSTRAP_EXTRA_REPO_PARAMS')) {
216 common.infoMsg("Setting additional repo during bootstrap to ${BOOTSTRAP_EXTRA_REPO_PARAMS}")
217 envParams.put('cfg_bootstrap_extra_repo_params', BOOTSTRAP_EXTRA_REPO_PARAMS)
218 }
219
azvyagintsevb8ddb492018-09-12 14:59:45 +0300220 // put extra salt-formulas # FIXME: looks like some outdated logic. See #PROD-23127
Jakub Josefa63f9862018-01-11 17:58:38 +0100221 if (common.validInputParam('EXTRA_FORMULAS')) {
222 common.infoMsg("Setting extra salt-formulas to ${EXTRA_FORMULAS}")
223 envParams.put('cfg_extra_formulas', EXTRA_FORMULAS)
224 }
225
Vasyl Saienkoa81e9312018-03-06 01:28:35 +0200226 // add cluster name if specified
227 if (common.validInputParam('STACK_CLUSTER_NAME')) {
228 common.infoMsg("Setting cluster_name to ${STACK_CLUSTER_NAME}")
229 envParams.put('cluster_name', STACK_CLUSTER_NAME)
230 }
231
Vasyl Saienko51139fd2018-04-20 12:01:50 +0300232 if (common.validInputParam('STACK_COMPUTE_COUNT')) {
233 if (STACK_COMPUTE_COUNT.toInteger() > 0){
234 common.infoMsg("Setting cluster_node_count to ${STACK_COMPUTE_COUNT}")
235 envParams.put('cluster_node_count', STACK_COMPUTE_COUNT)
236 }
237 }
238
Oleh Hryhorov825b5be2018-06-13 13:01:53 +0300239
240 if (common.validInputParam('SALT_VERSION')) {
241 common.infoMsg("Setting salt version to ${SALT_VERSION}")
242 envParams.put('cfg_saltversion', SALT_VERSION)
243 }
244
Mykyta Karpin35f71332018-07-27 11:54:51 +0300245 // If stack wasn't removed by the same user which has created it,
246 // nova key pair won't be removed, so need to make sure that no
247 // key pair with the same name exists before creating the stack.
248 if (openstack.getKeyPair(openstackCloud, STACK_NAME, venv)){
249 try {
250 openstack.deleteKeyPair(openstackCloud, STACK_NAME, venv)
251 } catch (Exception e) {
252 common.errorMsg("Key pair failed to remove with error ${e.message}")
253 }
254 }
255
Jakub Josefa63f9862018-01-11 17:58:38 +0100256 openstack.createHeatStack(openstackCloud, STACK_NAME, STACK_TEMPLATE, envParams, HEAT_STACK_ENVIRONMENT, venv)
257 }
258
259 // get SALT_MASTER_URL
260 saltMasterHost = openstack.getHeatStackOutputParam(openstackCloud, STACK_NAME, 'salt_master_ip', venv)
261 // check that saltMasterHost is valid
262 if (!saltMasterHost || !saltMasterHost.matches(ipRegex)) {
263 common.errorMsg("saltMasterHost is not a valid ip, value is: ${saltMasterHost}")
264 throw new Exception("saltMasterHost is not a valid ip")
265 }
266
267 currentBuild.description = "${STACK_NAME} ${saltMasterHost}"
268
269 SALT_MASTER_URL = "http://${saltMasterHost}:6969"
270
271 } else if (STACK_TYPE == 'aws') {
272
273 // setup environment
274 aws.setupVirtualEnv(venv)
275
276 // set aws_env_vars
277 aws_env_vars = aws.getEnvVars(AWS_API_CREDENTIALS, AWS_STACK_REGION)
278
279 if (STACK_REUSE.toBoolean() == true && STACK_NAME == '') {
280 error("If you want to reuse existing stack you need to provide it's name")
281 }
282
283 if (STACK_REUSE.toBoolean() == false) {
284 // Don't allow to set custom stack name
285 wrap([$class: 'BuildUser']) {
286 if (env.BUILD_USER_ID) {
287 STACK_NAME = "${env.BUILD_USER_ID}-${JOB_NAME}-${BUILD_NUMBER}"
288 } else {
289 STACK_NAME = "jenkins-${JOB_NAME}-${BUILD_NUMBER}"
290 }
291 }
292
293 // no underscore in STACK_NAME
294 STACK_NAME = STACK_NAME.replaceAll('_', '-')
295 }
296
297 // set description
298 currentBuild.description = STACK_NAME
299 outputs.put('stack_name', STACK_NAME)
300
301 if (STACK_REUSE.toBoolean() == false) {
302 // get templates
303 git.checkoutGitRepository('template', STACK_TEMPLATE_URL, STACK_TEMPLATE_BRANCH, STACK_TEMPLATE_CREDENTIALS)
304
305 // start stack
306 def stack_params = [
307 "ParameterKey=KeyName,ParameterValue=" + AWS_SSH_KEY,
308 "ParameterKey=CmpNodeCount,ParameterValue=" + STACK_COMPUTE_COUNT
309 ]
310 def template_file = 'cfn/' + STACK_TEMPLATE + '.yml'
311 aws.createStack(venv, aws_env_vars, template_file, STACK_NAME, stack_params)
312 }
313
314 // wait for stack to be ready
315 aws.waitForStatus(venv, aws_env_vars, STACK_NAME, 'CREATE_COMPLETE')
316
317 // get outputs
318 saltMasterHost = aws.getOutputs(venv, aws_env_vars, STACK_NAME, 'SaltMasterIP')
319
320 // check that saltMasterHost is valid
321 if (!saltMasterHost || !saltMasterHost.matches(ipRegex)) {
322 common.errorMsg("saltMasterHost is not a valid ip, value is: ${saltMasterHost}")
323 throw new Exception("saltMasterHost is not a valid ip")
324 }
325
326 currentBuild.description = "${STACK_NAME} ${saltMasterHost}"
327 SALT_MASTER_URL = "http://${saltMasterHost}:6969"
328
329 } else if (STACK_TYPE != 'physical') {
330 throw new Exception("STACK_TYPE ${STACK_TYPE} is not supported")
331 }
332
333 outputs.put('salt_api', SALT_MASTER_URL)
334
335 // Setup virtualenv for pepper
336 python.setupPepperVirtualenv(venvPepper, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
337 }
338
339
340 // Set up override params
Oleh Hryhorovc409d1e2019-02-27 16:57:09 +0200341 if (common.validInputParam('SALT_OVERRIDES') && common.validInputParam('STACK_INSTALL')) {
Jakub Josefa63f9862018-01-11 17:58:38 +0100342 stage('Set Salt overrides') {
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300343 salt.setSaltOverrides(venvPepper, SALT_OVERRIDES, '/srv/salt/reclass', extra_tgt)
Jakub Josefa63f9862018-01-11 17:58:38 +0100344 }
345 }
346
347 //
348 // Install
349 //
350
Martin Polreich65cfeda2019-03-28 12:50:57 +0100351 // Check if all minions are reachable and ready
352 salt.checkTargetMinionsReady(['saltId': venvPepper, 'target': '*'])
353
Jakub Josefa63f9862018-01-11 17:58:38 +0100354 if (common.checkContains('STACK_INSTALL', 'core')) {
355 stage('Install core infrastructure') {
356 def staticMgmtNetwork = false
357 if (common.validInputParam('STATIC_MGMT_NETWORK')) {
358 staticMgmtNetwork = STATIC_MGMT_NETWORK.toBoolean()
359 }
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300360 orchestrate.installFoundationInfra(venvPepper, staticMgmtNetwork, extra_tgt)
Jakub Josefa63f9862018-01-11 17:58:38 +0100361
362 if (common.checkContains('STACK_INSTALL', 'kvm')) {
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300363 orchestrate.installInfraKvm(venvPepper, extra_tgt)
Dzmitry Stremkouski16fb74f2018-07-10 02:01:34 +0200364 orchestrate.installFoundationInfra(venvPepper, staticMgmtNetwork, extra_tgt)
Jakub Josefa63f9862018-01-11 17:58:38 +0100365 }
366
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300367 orchestrate.validateFoundationInfra(venvPepper, extra_tgt)
Jakub Josefa63f9862018-01-11 17:58:38 +0100368 }
369 }
370
Oleksii Grudevd3d5fad2018-06-29 16:25:35 +0300371 stage('Install infra') {
Stanislav Riazanovf0302582019-02-04 17:47:06 +0400372 if (common.checkContains('STACK_INSTALL', 'core') ||
Oleksii Zhurba3235eb92019-03-27 15:26:14 -0500373 common.checkContains('STACK_INSTALL', 'openstack')) {
Stanislav Riazanovf0302582019-02-04 17:47:06 +0400374 orchestrate.installInfra(venvPepper, extra_tgt)
375 }
Oleksii Grudevd3d5fad2018-06-29 16:25:35 +0300376 }
377
Oleh Hryhorovc409d1e2019-02-27 16:57:09 +0200378 if (common.validInputParam('STACK_INSTALL')) {
379 stage('Install Orchestrated Apps'){
380 orchestrate.OrchestrateApplications(venvPepper, "I@salt:master ${extra_tgt}", "orchestration.deploy.applications")
381 }
Vasyl Saienko4c78fe12018-08-06 10:17:28 +0300382 }
383
Jakub Josefa63f9862018-01-11 17:58:38 +0100384 // install k8s
385 if (common.checkContains('STACK_INSTALL', 'k8s')) {
Stanislav Riazanovf0302582019-02-04 17:47:06 +0400386 extra_tgt_bckp = extra_tgt
Denis Egorenkoe983d452019-08-23 14:29:34 +0400387 extra_tgt = 'and not kdt* and not I@salt:master ' + extra_tgt_bckp
Jakub Josefa63f9862018-01-11 17:58:38 +0100388 stage('Install Kubernetes infra') {
389 if (STACK_TYPE == 'aws') {
390 // configure kubernetes_control_address - save loadbalancer
391 def awsOutputs = aws.getOutputs(venv, aws_env_vars, STACK_NAME)
392 common.prettyPrint(awsOutputs)
393 if (awsOutputs.containsKey('ControlLoadBalancer')) {
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300394 salt.runSaltProcessStep(venvPepper, "I@salt:master ${extra_tgt}", 'reclass.cluster_meta_set', ['kubernetes_control_address', awsOutputs['ControlLoadBalancer']], null, true)
Jakub Josefa63f9862018-01-11 17:58:38 +0100395 outputs.put('kubernetes_apiserver', 'https://' + awsOutputs['ControlLoadBalancer'])
396 }
397 }
398
399 // ensure certificates are generated properly
Andrey Shestakovf23ed002018-08-21 12:09:51 +0300400 salt.runSaltProcessStep(venvPepper, "I@kubernetes:* ${extra_tgt}", 'saltutil.refresh_pillar', [], null, true)
401 salt.enforceState(venvPepper, "I@kubernetes:* ${extra_tgt}", ['salt.minion.cert'], true)
Jakub Josefa63f9862018-01-11 17:58:38 +0100402 }
403
404 if (common.checkContains('STACK_INSTALL', 'contrail')) {
Svimbaa554ea02018-06-06 18:45:23 +0200405 stage('Install Contrail control') {
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300406 orchestrate.installContrailNetwork(venvPepper, extra_tgt)
Tomáš Kukrál39c96cd2017-07-11 10:14:13 +0200407 }
Ales Komarek24097402017-05-22 16:28:10 +0200408 }
Tomáš Kukrálf83409d2017-11-08 20:56:57 +0100409
Jakub Josefa63f9862018-01-11 17:58:38 +0100410 stage('Install Kubernetes control') {
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300411 orchestrate.installKubernetesControl(venvPepper, extra_tgt)
Anton Samoylovf8a65aa2019-01-23 20:22:26 +0400412 if (common.checkContains('STACK_INSTALL', 'contrail')) {
413 orchestrate.checkContrailApiReadiness(venvPepper, extra_tgt)
414 }
Ruslan Kamaldinov65144322017-08-02 15:16:55 +0400415
Jakub Josefa63f9862018-01-11 17:58:38 +0100416 // collect artifacts (kubeconfig)
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300417 writeFile(file: 'kubeconfig', text: salt.getFileContent(venvPepper, "I@kubernetes:master and *01* ${extra_tgt}", '/etc/kubernetes/admin-kube-config'))
Jakub Josefa63f9862018-01-11 17:58:38 +0100418 archiveArtifacts(artifacts: 'kubeconfig')
vrovachev7be1e962017-07-05 13:28:26 +0400419 }
420
Svimbaa554ea02018-06-06 18:45:23 +0200421 if (common.checkContains('STACK_INSTALL', 'contrail')) {
422 stage('Install Contrail compute') {
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300423 orchestrate.installContrailCompute(venvPepper, extra_tgt)
Svimbaa554ea02018-06-06 18:45:23 +0200424 }
425 }
426
Jakub Josefa63f9862018-01-11 17:58:38 +0100427 stage('Install Kubernetes computes') {
428 if (common.validInputParam('STACK_COMPUTE_COUNT')) {
429 if (STACK_COMPUTE_COUNT > 0) {
430 if (STACK_TYPE == 'aws') {
431 // get stack info
432 def scaling_group = aws.getOutputs(venv, aws_env_vars, STACK_NAME, 'ComputesScalingGroup')
433
434 //update autoscaling group
435 aws.updateAutoscalingGroup(venv, aws_env_vars, scaling_group, ["--desired-capacity " + STACK_COMPUTE_COUNT])
436
437 // wait for computes to boot up
438 aws.waitForAutoscalingInstances(venv, aws_env_vars, scaling_group)
439 sleep(60)
440
441 } else if (STACK_TYPE == 'heat') {
442 envParams.put('cluster_node_count', STACK_COMPUTE_COUNT)
443
444 openstack.createHeatStack(openstackCloud, STACK_NAME, STACK_TEMPLATE, envParams, HEAT_STACK_ENVIRONMENT, venv, "update")
445 sleep(60)
446 }
447
448 }
449 }
450
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300451 orchestrate.installKubernetesCompute(venvPepper, extra_tgt)
Svimbaa979f8f2018-09-26 11:24:49 +0200452 // Setup kubernetes addons for opencontrail. More info in the definition of the func.
453 orchestrate.setupKubeAddonForContrail(venvPepper, extra_tgt)
Jakub Josefa63f9862018-01-11 17:58:38 +0100454 }
Vasyl Saienkob8494f22019-03-05 10:56:29 +0200455 orchestrate.installKubernetesClient(venvPepper, extra_tgt)
Stanislav Riazanovf0302582019-02-04 17:47:06 +0400456 extra_tgt = extra_tgt_bckp
457 }
458
459 // install kdt (drivetrain on k8s) cluster
460 if (common.checkContains('STACK_INSTALL', 'kdt')){
461 extra_tgt_bckp = extra_tgt
462 extra_tgt = 'and kdt* ' + extra_tgt_bckp
463 stage('Install Kubernetes infra for kdt') {
464 // ensure certificates are generated properly
465 salt.runSaltProcessStep(venvPepper, "I@kubernetes:* ${extra_tgt}", 'saltutil.refresh_pillar', [], null, true)
466 salt.enforceState(venvPepper, "I@kubernetes:* ${extra_tgt}", ['salt.minion.cert'], true)
467 }
468
469 stage('Install Kubernetes control for kdt') {
Stanislav Riazanovba650f52019-03-15 22:02:56 +0400470 salt.enforceStateWithTest([saltId: venvPepper, target: "I@kubernetes:master ${extra_tgt}", state: 'kubernetes.pool.images'])
Stanislav Riazanovf0302582019-02-04 17:47:06 +0400471 orchestrate.installKubernetesControl(venvPepper, extra_tgt)
472
Stanislav Riazanovba650f52019-03-15 22:02:56 +0400473 salt.enforceStateWithTest([saltId: venvPepper, target: "I@kubernetes:master ${extra_tgt}", state: 'nginx.server'])
Stanislav Riazanovf0302582019-02-04 17:47:06 +0400474 // collect artifacts (kubeconfig)
475 writeFile(file: 'kubeconfig-kdt', text: salt.getFileContent(venvPepper, "I@kubernetes:master and *01* ${extra_tgt}", '/etc/kubernetes/admin-kube-config'))
476 archiveArtifacts(artifacts: 'kubeconfig-kdt')
477 }
Vasyl Saienkob8494f22019-03-05 10:56:29 +0200478 orchestrate.installKubernetesClient(venvPepper, extra_tgt)
Stanislav Riazanovf0302582019-02-04 17:47:06 +0400479 extra_tgt = extra_tgt_bckp
Ruslan Kamaldinov65144322017-08-02 15:16:55 +0400480 }
Ales Komarek24097402017-05-22 16:28:10 +0200481
Mykyta Karpin5b7c2602018-09-11 17:47:20 +0300482 // install ceph
483 if (common.checkContains('STACK_INSTALL', 'ceph')) {
484 stage('Install Ceph MONs') {
485 orchestrate.installCephMon(venvPepper, "I@ceph:mon ${extra_tgt}", extra_tgt)
486 }
487
488 stage('Install Ceph OSDs') {
489 orchestrate.installCephOsd(venvPepper, "I@ceph:osd ${extra_tgt}", true, extra_tgt)
490 }
491
492 stage('Install Ceph clients') {
493 orchestrate.installCephClient(venvPepper, extra_tgt)
494 }
495 }
496
Vasyl Saienkoc562fc42018-12-15 22:19:28 +0200497 // install docker swarm
Oleh Hryhorovc409d1e2019-02-27 16:57:09 +0200498 if (common.validInputParam('STACK_INSTALL')) {
499 orchestrate.installDockerSwarm(venvPepper, extra_tgt)
500 }
Vasyl Saienkoc562fc42018-12-15 22:19:28 +0200501
Jakub Josefa63f9862018-01-11 17:58:38 +0100502 // install openstack
503 if (common.checkContains('STACK_INSTALL', 'openstack')) {
Oleksii Grudevd3d5fad2018-06-29 16:25:35 +0300504 // install control, tests, ...
Jakub Josefa63f9862018-01-11 17:58:38 +0100505 stage('Install OpenStack control') {
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300506 orchestrate.installOpenstackControl(venvPepper, extra_tgt)
Jakub Josefa63f9862018-01-11 17:58:38 +0100507 }
508
Oleg Iurchenko86f1a842018-02-13 22:18:28 +0200509 // Workaround for PROD-17765 issue to prevent crashes of keystone.role_present state.
510 // More details: https://mirantis.jira.com/browse/PROD-17765
Ivan Berezovskiy4d6885e2019-08-01 15:23:14 +0400511 salt.restartSaltMinion(venvPepper, "I@keystone:client ${extra_tgt}")
Denis Egorenkoe983d452019-08-23 14:29:34 +0400512 //
513 salt.minionsReachable(venvPepper, 'I@salt:master', 'I@keystone:client ${extra_tgt}', null, 10, 6)
Oleg Iurchenko86f1a842018-02-13 22:18:28 +0200514
Jakub Josefa63f9862018-01-11 17:58:38 +0100515 stage('Install OpenStack network') {
516
517 if (common.checkContains('STACK_INSTALL', 'contrail')) {
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300518 orchestrate.installContrailNetwork(venvPepper, extra_tgt)
Anton Samoylovf8a65aa2019-01-23 20:22:26 +0400519 orchestrate.checkContrailApiReadiness(venvPepper, extra_tgt)
Jakub Josefa63f9862018-01-11 17:58:38 +0100520 } else if (common.checkContains('STACK_INSTALL', 'ovs')) {
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300521 orchestrate.installOpenstackNetwork(venvPepper, extra_tgt)
Jakub Josefa63f9862018-01-11 17:58:38 +0100522 }
523
Petr Jedinýefd668f2018-05-24 14:44:08 +0200524 // Wait for network to come up, 150s should be enough
525 common.retry(10, 15) {
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300526 salt.cmdRun(venvPepper, "I@keystone:server ${extra_tgt}", '. /root/keystonercv3; openstack network list')
Petr Jedinýefd668f2018-05-24 14:44:08 +0200527 }
Jakub Josefa63f9862018-01-11 17:58:38 +0100528 }
529
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300530 if (salt.testTarget(venvPepper, "I@ironic:conductor ${extra_tgt}")){
Jakub Josefa63f9862018-01-11 17:58:38 +0100531 stage('Install OpenStack Ironic conductor') {
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300532 orchestrate.installIronicConductor(venvPepper, extra_tgt)
Jakub Josefa63f9862018-01-11 17:58:38 +0100533 }
534 }
535
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300536 if (salt.testTarget(venvPepper, "I@manila:share ${extra_tgt}")){
Vasyl Saienkob800a0f2018-02-21 18:38:53 +0200537 stage('Install OpenStack Manila data and share') {
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300538 orchestrate.installManilaShare(venvPepper, extra_tgt)
Vasyl Saienkob800a0f2018-02-21 18:38:53 +0200539 }
540 }
Jakub Josefa63f9862018-01-11 17:58:38 +0100541
542 stage('Install OpenStack compute') {
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300543 orchestrate.installOpenstackCompute(venvPepper, extra_tgt)
Jakub Josefa63f9862018-01-11 17:58:38 +0100544
545 if (common.checkContains('STACK_INSTALL', 'contrail')) {
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300546 orchestrate.installContrailCompute(venvPepper, extra_tgt)
Inessa Vasilevskaya30cb7312018-10-08 12:13:03 +0200547 orchestrate.installBackup(venvPepper, 'contrail', extra_tgt)
Jakub Josefa63f9862018-01-11 17:58:38 +0100548 }
549 }
550
551 }
552
Mykyta Karpin5b7c2602018-09-11 17:47:20 +0300553 // connect ceph
Jakub Josefa63f9862018-01-11 17:58:38 +0100554 if (common.checkContains('STACK_INSTALL', 'ceph')) {
Jakub Josefa63f9862018-01-11 17:58:38 +0100555
556 stage('Connect Ceph') {
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300557 orchestrate.connectCeph(venvPepper, extra_tgt)
Jakub Josefa63f9862018-01-11 17:58:38 +0100558 }
559 }
560
Jakub Josefa63f9862018-01-11 17:58:38 +0100561 if (common.checkContains('STACK_INSTALL', 'cicd')) {
562 stage('Install Cicd') {
Stanislav Riazanovf0302582019-02-04 17:47:06 +0400563 extra_tgt_bckp = extra_tgt
Denis Egorenkoe983d452019-08-23 14:29:34 +0400564 extra_tgt = 'and I@_param:drivetrain_role:cicd ' + extra_tgt_bckp
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300565 orchestrate.installInfra(venvPepper, extra_tgt)
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300566 orchestrate.installCicd(venvPepper, extra_tgt)
Stanislav Riazanovf0302582019-02-04 17:47:06 +0400567 extra_tgt = extra_tgt_bckp
568 }
569 }
570
571 if (common.checkContains('STACK_INSTALL', 'kdt')) {
572 stage('Install Cicd on kdt') {
573 extra_tgt_bckp = extra_tgt
574 extra_tgt = 'and kdt* ' + extra_tgt_bckp
Stanislav Riazanovf0302582019-02-04 17:47:06 +0400575 orchestrate.installCicd(venvPepper, extra_tgt)
576 extra_tgt = extra_tgt_bckp
Jakub Josefa63f9862018-01-11 17:58:38 +0100577 }
578 }
579
580 if (common.checkContains('STACK_INSTALL', 'sl-legacy')) {
581 stage('Install StackLight v1') {
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300582 orchestrate.installStacklightv1Control(venvPepper, extra_tgt)
583 orchestrate.installStacklightv1Client(venvPepper, extra_tgt)
Jakub Josefa63f9862018-01-11 17:58:38 +0100584 }
585 }
586
587 if (common.checkContains('STACK_INSTALL', 'stacklight')) {
588 stage('Install StackLight') {
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300589 orchestrate.installStacklight(venvPepper, extra_tgt)
Jakub Josefa63f9862018-01-11 17:58:38 +0100590 }
591 }
592
Jakub Josefa63f9862018-01-11 17:58:38 +0100593 //
594 // Test
595 //
596 def artifacts_dir = '_artifacts/'
597
598 if (common.checkContains('STACK_TEST', 'k8s')) {
599 stage('Run k8s conformance e2e tests') {
600 def image = TEST_K8S_CONFORMANCE_IMAGE
Victor Ryzhenkin723bd062018-12-11 17:09:06 +0400601 def autodetect = AUTODETECT
602 def ctl_target = 'I@kubernetes:master'
603 firstTarget = salt.getFirstMinion(venvPepper, ctl_target)
604 def containerd_enabled = salt.getPillar(
605 venvPepper, firstTarget, "kubernetes:common:containerd:enabled"
606 )["return"][0].values()[0].toBoolean()
607 if (containerd_enabled) {
608 def config = ['master': venvPepper,
609 'target': firstTarget,
610 'junitResults': true,
611 'autodetect': autodetect,
612 'image': image]
613 test.executeConformance(config)
614 } else {
615 def output_file = image.replaceAll('/', '-') + '.output'
Denis Egorenkoe983d452019-08-23 14:29:34 +0400616 def target = "I@keystone:server:role:primary ${extra_tgt}"
Victor Ryzhenkin723bd062018-12-11 17:09:06 +0400617 def conformance_output_file = 'conformance_test.tar'
Jakub Josefa63f9862018-01-11 17:58:38 +0100618
Victor Ryzhenkin723bd062018-12-11 17:09:06 +0400619 // run image
620 test.runConformanceTests(venvPepper, target, TEST_K8S_API_SERVER, image)
Jakub Josefa63f9862018-01-11 17:58:38 +0100621
Victor Ryzhenkin723bd062018-12-11 17:09:06 +0400622 // collect output
623 sh "mkdir -p ${artifacts_dir}"
624 file_content = salt.getFileContent(venvPepper, target, '/tmp/' + output_file)
625 writeFile file: "${artifacts_dir}${output_file}", text: file_content
626 sh "cat ${artifacts_dir}${output_file}"
Jakub Josefa63f9862018-01-11 17:58:38 +0100627
Victor Ryzhenkin723bd062018-12-11 17:09:06 +0400628 // collect artifacts
629 archiveArtifacts artifacts: "${artifacts_dir}${output_file}"
vrovachevff3e72d2018-01-25 16:14:43 +0400630
Victor Ryzhenkin723bd062018-12-11 17:09:06 +0400631 // Copy test results
632 test.CopyConformanceResults(venvPepper, target, artifacts_dir, conformance_output_file)
633 }
Jakub Josefa63f9862018-01-11 17:58:38 +0100634 }
635 }
636
Jakub Josefa63f9862018-01-11 17:58:38 +0100637 if (common.checkContains('STACK_TEST', 'opencontrail')) {
638 stage('Run opencontrail tests') {
639 def opencontrail_tests_dir = "/opt/opencontrail_test/fuel-plugin-contrail/plugin_test/vapor/"
640 def report_dir = "/opt/opencontrail-test-report/"
641 def cmd = ". ${opencontrail_tests_dir}exports.sh && " +
642 "cd ${opencontrail_tests_dir} && " +
643 "py.test --junit-xml=${report_dir}report.xml" +
644 " --html=${report_dir}report.html -v vapor/tests/ -k 'not destructive' "
Ruslan Kamaldinov65144322017-08-02 15:16:55 +0400645
Denis Egorenkoe983d452019-08-23 14:29:34 +0400646 salt.runSaltProcessStep(venvPepper, 'I@salt:master', 'saltutil.refresh_pillar', [], null, true)
Jakub Josefa63f9862018-01-11 17:58:38 +0100647 salt.enforceState(venvPepper, 'I@opencontrail:test' , 'opencontrail.test' , true)
Jiri Broulikd01c42f2018-01-02 11:37:10 +0100648
Jakub Josefa63f9862018-01-11 17:58:38 +0100649 salt.cmdRun(venvPepper, 'I@opencontrail:test', cmd, false)
650
651 writeFile(file: 'report.xml', text: salt.getFileContent(venvPepper,
652 'I@opencontrail:test', "${report_dir}report.xml"))
653 junit(keepLongStdio: true, testResults: 'report.xml')
654 }
Jiri Broulikd01c42f2018-01-02 11:37:10 +0100655 }
656
657
Jakub Josefa63f9862018-01-11 17:58:38 +0100658 stage('Finalize') {
659 if (common.checkContains('STACK_INSTALL', 'finalize')) {
Oleh Hryhorov2a63aa62018-06-22 17:26:41 +0300660 def gluster_compound = "I@glusterfs:server ${extra_tgt}"
661 def salt_ca_compound = "I@salt:minion:ca:salt_master_ca ${extra_tgt}"
Dzmitry Stremkouskifa4c1632018-03-21 17:55:39 +0100662 // Enforce highstate asynchronous only on the nodes which are not glusterfs servers
Dzmitry Stremkouski47a45122018-04-25 17:05:56 +0200663 salt.enforceHighstate(venvPepper, '* and not ' + gluster_compound + ' and not ' + salt_ca_compound)
Dzmitry Stremkouskifa4c1632018-03-21 17:55:39 +0100664 // Iterate over nonempty set of gluster servers and apply highstates one by one
665 // TODO: switch to batch once salt 2017.7+ would be used
Dzmitry Stremkouski47a45122018-04-25 17:05:56 +0200666 def saltcaMinions = salt.getMinionsSorted(venvPepper, salt_ca_compound)
667 if ( !saltcaMinions.isEmpty() ) {
668 for ( target in saltcaMinions ) {
669 salt.enforceHighstate(venvPepper, target)
670 }
671 }
Dzmitry Stremkouskifa4c1632018-03-21 17:55:39 +0100672 def glusterMinions = salt.getMinionsSorted(venvPepper, gluster_compound)
673 if ( !glusterMinions.isEmpty() ) {
674 for ( target in glusterMinions ) {
675 salt.enforceHighstate(venvPepper, target)
676 }
677 }
Jakub Josefa63f9862018-01-11 17:58:38 +0100678 }
679
680 outputsPretty = common.prettify(outputs)
681 print(outputsPretty)
682 writeFile(file: 'outputs.json', text: outputsPretty)
683 archiveArtifacts(artifacts: 'outputs.json')
Jiri Broulikd01c42f2018-01-02 11:37:10 +0100684 }
685
Jakub Josefa63f9862018-01-11 17:58:38 +0100686 } catch (Throwable e) {
687 currentBuild.result = 'FAILURE'
688 throw e
689 } finally {
Jiri Broulikd01c42f2018-01-02 11:37:10 +0100690
Mikhail Ivanov3deb79a2017-12-06 17:44:47 +0400691
Jakub Josefa63f9862018-01-11 17:58:38 +0100692 //
693 // Clean
694 //
Ruslan Kamaldinov65144322017-08-02 15:16:55 +0400695
Jakub Josefa63f9862018-01-11 17:58:38 +0100696 if (common.validInputParam('STACK_NAME')) {
697 // send notification
698 common.sendNotification(currentBuild.result, STACK_NAME, ["slack"])
Ales Komarek24097402017-05-22 16:28:10 +0200699 }
700
Jakub Josefa63f9862018-01-11 17:58:38 +0100701 if (common.validInputParam('STACK_DELETE') && STACK_DELETE.toBoolean() == true) {
702 stage('Trigger cleanup job') {
703 common.errorMsg('Stack cleanup job triggered')
704 build(job: STACK_CLEANUP_JOB, parameters: [
705 [$class: 'StringParameterValue', name: 'STACK_NAME', value: STACK_NAME],
706 [$class: 'StringParameterValue', name: 'STACK_TYPE', value: STACK_TYPE],
707 [$class: 'StringParameterValue', name: 'OPENSTACK_API_URL', value: OPENSTACK_API_URL],
708 [$class: 'StringParameterValue', name: 'OPENSTACK_API_CREDENTIALS', value: OPENSTACK_API_CREDENTIALS],
709 [$class: 'StringParameterValue', name: 'OPENSTACK_API_PROJECT', value: OPENSTACK_API_PROJECT],
710 [$class: 'StringParameterValue', name: 'OPENSTACK_API_PROJECT_DOMAIN', value: OPENSTACK_API_PROJECT_DOMAIN],
711 [$class: 'StringParameterValue', name: 'OPENSTACK_API_PROJECT_ID', value: OPENSTACK_API_PROJECT_ID],
712 [$class: 'StringParameterValue', name: 'OPENSTACK_API_USER_DOMAIN', value: OPENSTACK_API_USER_DOMAIN],
713 [$class: 'StringParameterValue', name: 'OPENSTACK_API_CLIENT', value: OPENSTACK_API_CLIENT],
714 [$class: 'StringParameterValue', name: 'OPENSTACK_API_VERSION', value: OPENSTACK_API_VERSION]
715 ])
716 }
717 } else {
718 if (currentBuild.result == 'FAILURE') {
719 common.errorMsg("Deploy job FAILED and was not deleted. Please fix the problem and delete stack on you own.")
Vasyl Saienkoff24e582017-08-04 10:04:33 +0300720
Jakub Josefa63f9862018-01-11 17:58:38 +0100721 if (common.validInputParam('SALT_MASTER_URL')) {
722 common.errorMsg("Salt master URL: ${SALT_MASTER_URL}")
723 }
Ales Komarek24097402017-05-22 16:28:10 +0200724 }
725 }
726 }
727 }
728}