Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 1 | /** |
| 2 | * |
Tomáš Kukrál | 0d00dd2 | 2017-07-27 14:28:36 +0200 | [diff] [blame] | 3 | * Launch stack and work with it |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 4 | * |
| 5 | * Expected parameters: |
| 6 | * STACK_NAME Infrastructure stack name |
Tomáš Kukrál | 4691f68 | 2017-07-27 16:36:12 +0200 | [diff] [blame] | 7 | * STACK_TEMPLATE File with stack template |
| 8 | * STACK_TYPE Deploy OpenStack/AWS [heat/aws], use 'physical' if no stack should be started |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 9 | * |
| 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ál | 4691f68 | 2017-07-27 16:36:12 +0200 | [diff] [blame] | 15 | * STACK_REUSE Reuse existing stack (don't create one, only read outputs) |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 16 | * 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ál | 74f9286 | 2017-06-05 19:18:43 +0200 | [diff] [blame] | 20 | * STACK_COMPUTE_COUNT Number of compute nodes to launch |
| 21 | * |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 22 | * AWS_STACK_REGION CloudFormation AWS region |
| 23 | * AWS_API_CREDENTIALS AWS Access key ID with AWS secret access key |
Tomáš Kukrál | 7a8a4fa | 2017-05-25 14:54:24 +0200 | [diff] [blame] | 24 | * AWS_SSH_KEY AWS key pair name (used for SSH access) |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 25 | * |
| 26 | * HEAT_STACK_ENVIRONMENT Heat stack environmental parameters |
| 27 | * HEAT_STACK_ZONE Heat stack availability zone |
| 28 | * HEAT_STACK_PUBLIC_NET Heat stack floating IP pool |
| 29 | * OPENSTACK_API_URL OpenStack API address |
| 30 | * OPENSTACK_API_CREDENTIALS Credentials to the OpenStack API |
| 31 | * OPENSTACK_API_PROJECT OpenStack project to connect to |
| 32 | * OPENSTACK_API_CLIENT Versions of OpenStack python clients |
| 33 | * OPENSTACK_API_VERSION Version of the OpenStack API (2/3) |
Tomáš Kukrál | 5c2ec13 | 2017-07-26 09:57:27 +0200 | [diff] [blame] | 34 | |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 35 | * SALT_MASTER_CREDENTIALS Credentials to the Salt API |
Tomáš Kukrál | 4691f68 | 2017-07-27 16:36:12 +0200 | [diff] [blame] | 36 | * required for STACK_TYPE=physical |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 37 | * SALT_MASTER_URL URL of Salt master |
Tomáš Kukrál | 5c2ec13 | 2017-07-26 09:57:27 +0200 | [diff] [blame] | 38 | |
| 39 | * Test settings: |
| 40 | * TEST_K8S_API_SERVER Kubernetes API address |
| 41 | * TEST_K8S_CONFORMANCE_IMAGE Path to docker image with conformance e2e tests |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 42 | * |
Tomáš Kukrál | 5c2ec13 | 2017-07-26 09:57:27 +0200 | [diff] [blame] | 43 | * TEST_DOCKER_INSTALL Install docker on the target if true |
| 44 | * TEST_TEMPEST_IMAGE Tempest image link |
| 45 | * TEST_TEMPEST_PATTERN If not false, run tests matched to pattern only |
| 46 | * TEST_TEMPEST_TARGET Salt target for tempest node |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 47 | * |
Tomáš Kukrál | 5c2ec13 | 2017-07-26 09:57:27 +0200 | [diff] [blame] | 48 | * optional parameters for overwriting soft params |
| 49 | * SALT_OVERRIDES YAML with overrides for Salt deployment |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 50 | * |
| 51 | */ |
Tomáš Kukrál | 3a17dd6 | 2017-07-27 18:24:16 +0200 | [diff] [blame] | 52 | |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 53 | common = new com.mirantis.mk.Common() |
| 54 | git = new com.mirantis.mk.Git() |
| 55 | openstack = new com.mirantis.mk.Openstack() |
Tomáš Kukrál | 7a8a4fa | 2017-05-25 14:54:24 +0200 | [diff] [blame] | 56 | aws = new com.mirantis.mk.Aws() |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 57 | orchestrate = new com.mirantis.mk.Orchestrate() |
Mykyta Karpin | e016d7e | 2017-10-09 13:35:20 +0300 | [diff] [blame] | 58 | python = new com.mirantis.mk.Python() |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 59 | salt = new com.mirantis.mk.Salt() |
| 60 | test = new com.mirantis.mk.Test() |
| 61 | |
| 62 | _MAX_PERMITTED_STACKS = 2 |
| 63 | overwriteFile = "/srv/salt/reclass/classes/cluster/override.yml" |
| 64 | |
Tomáš Kukrál | a1d86b8 | 2017-07-10 17:24:01 +0200 | [diff] [blame] | 65 | // Define global variables |
Tomáš Kukrál | a1d86b8 | 2017-07-10 17:24:01 +0200 | [diff] [blame] | 66 | def venv |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 67 | def venvPepper |
Tomáš Kukrál | 8e50d8e | 2017-09-01 17:40:53 +0200 | [diff] [blame] | 68 | def outputs = [:] |
Tomáš Kukrál | bc4be25 | 2017-06-06 11:28:40 +0200 | [diff] [blame] | 69 | |
chnyda | e14058a | 2017-08-29 15:07:48 +0200 | [diff] [blame] | 70 | def ipRegex = "\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}" |
| 71 | |
Tomáš Kukrál | b19bdda | 2017-06-13 17:09:43 +0200 | [diff] [blame] | 72 | if (STACK_TYPE == 'aws') { |
Tomáš Kukrál | a1d86b8 | 2017-07-10 17:24:01 +0200 | [diff] [blame] | 73 | def aws_env_vars |
Tomáš Kukrál | 8427ff5 | 2017-08-30 15:46:52 +0200 | [diff] [blame] | 74 | } else if (STACK_TYPE == 'heat') { |
| 75 | def envParams |
| 76 | def openstackCloud |
Tomáš Kukrál | b19bdda | 2017-06-13 17:09:43 +0200 | [diff] [blame] | 77 | } |
| 78 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 79 | node("python") { |
| 80 | try { |
| 81 | // Set build-specific variables |
| 82 | venv = "${env.WORKSPACE}/venv" |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 83 | venvPepper = "${env.WORKSPACE}/venvPepper" |
Tomáš Kukrál | a1d86b8 | 2017-07-10 17:24:01 +0200 | [diff] [blame] | 84 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 85 | // |
| 86 | // Prepare machines |
| 87 | // |
| 88 | stage ('Create infrastructure') { |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 89 | |
Tomáš Kukrál | 8e50d8e | 2017-09-01 17:40:53 +0200 | [diff] [blame] | 90 | outputs.put('stack_type', STACK_TYPE) |
| 91 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 92 | if (STACK_TYPE == 'heat') { |
| 93 | // value defaults |
Tomáš Kukrál | 8427ff5 | 2017-08-30 15:46:52 +0200 | [diff] [blame] | 94 | envParams = [ |
| 95 | 'cluster_zone': HEAT_STACK_ZONE, |
| 96 | 'cluster_public_net': HEAT_STACK_PUBLIC_NET |
| 97 | ] |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 98 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 99 | if (STACK_REUSE.toBoolean() == true && STACK_NAME == '') { |
| 100 | error("If you want to reuse existing stack you need to provide it's name") |
| 101 | } |
| 102 | |
| 103 | if (STACK_REUSE.toBoolean() == false) { |
| 104 | // Don't allow to set custom heat stack name |
| 105 | wrap([$class: 'BuildUser']) { |
| 106 | if (env.BUILD_USER_ID) { |
| 107 | STACK_NAME = "${env.BUILD_USER_ID}-${JOB_NAME}-${BUILD_NUMBER}" |
| 108 | } else { |
| 109 | STACK_NAME = "jenkins-${JOB_NAME}-${BUILD_NUMBER}" |
| 110 | } |
| 111 | currentBuild.description = STACK_NAME |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 112 | } |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 113 | } |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 114 | |
Tomáš Kukrál | 86b9ab2 | 2017-09-05 16:55:58 +0200 | [diff] [blame] | 115 | // no underscore in STACK_NAME |
| 116 | STACK_NAME = STACK_NAME.replaceAll('_', '-') |
Tomáš Kukrál | 77b1b5a | 2017-09-24 18:56:49 +0200 | [diff] [blame] | 117 | outputs.put('stack_name', STACK_NAME) |
Tomáš Kukrál | 86b9ab2 | 2017-09-05 16:55:58 +0200 | [diff] [blame] | 118 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 119 | // set description |
| 120 | currentBuild.description = "${STACK_NAME}" |
| 121 | |
| 122 | // get templates |
| 123 | git.checkoutGitRepository('template', STACK_TEMPLATE_URL, STACK_TEMPLATE_BRANCH, STACK_TEMPLATE_CREDENTIALS) |
| 124 | |
| 125 | // create openstack env |
| 126 | openstack.setupOpenstackVirtualenv(venv, OPENSTACK_API_CLIENT) |
| 127 | openstackCloud = openstack.createOpenstackEnv( |
| 128 | OPENSTACK_API_URL, OPENSTACK_API_CREDENTIALS, |
| 129 | OPENSTACK_API_PROJECT, OPENSTACK_API_PROJECT_DOMAIN, |
| 130 | OPENSTACK_API_PROJECT_ID, OPENSTACK_API_USER_DOMAIN, |
| 131 | OPENSTACK_API_VERSION) |
| 132 | openstack.getKeystoneToken(openstackCloud, venv) |
Tomáš Kukrál | 8427ff5 | 2017-08-30 15:46:52 +0200 | [diff] [blame] | 133 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 134 | // |
| 135 | // Verify possibility of create stack for given user and stack type |
| 136 | // |
| 137 | wrap([$class: 'BuildUser']) { |
| 138 | if (env.BUILD_USER_ID && !env.BUILD_USER_ID.equals("jenkins") && !STACK_REUSE.toBoolean()) { |
Oleh Hryhorov | 8e320ca | 2017-09-22 13:23:44 +0300 | [diff] [blame] | 139 | def existingStacks = openstack.getStacksForNameContains(openstackCloud, "${env.BUILD_USER_ID}-${JOB_NAME}".replaceAll('_', '-'), venv) |
Tomáš Kukrál | 8427ff5 | 2017-08-30 15:46:52 +0200 | [diff] [blame] | 140 | if (existingStacks.size() >= _MAX_PERMITTED_STACKS) { |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 141 | STACK_DELETE = "false" |
| 142 | throw new Exception("You cannot create new stack, you already have ${_MAX_PERMITTED_STACKS} stacks of this type (${JOB_NAME}). \nStack names: ${existingStacks}") |
| 143 | } |
| 144 | } |
| 145 | } |
| 146 | // launch stack |
| 147 | if (STACK_REUSE.toBoolean() == false) { |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 148 | |
Tomáš Kukrál | 550364e | 2017-08-23 11:42:45 +0200 | [diff] [blame] | 149 | // set reclass repo in heat env |
| 150 | try { |
| 151 | envParams.put('cfg_reclass_branch', STACK_RECLASS_BRANCH) |
| 152 | envParams.put('cfg_reclass_address', STACK_RECLASS_ADDRESS) |
| 153 | } catch (MissingPropertyException e) { |
| 154 | common.infoMsg("Property STACK_RECLASS_BRANCH or STACK_RECLASS_ADDRESS not found! Using default values from template.") |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 155 | } |
Tomáš Kukrál | 550364e | 2017-08-23 11:42:45 +0200 | [diff] [blame] | 156 | |
Mykyta Karpin | 8f96113 | 2017-09-22 12:06:44 +0300 | [diff] [blame] | 157 | // put formulas revision - stable, testing or nightly |
| 158 | if (common.validInputParam('FORMULA_PKG_REVISION')) { |
| 159 | common.infoMsg("Setting formulas revision to ${FORMULA_PKG_REVISION}") |
| 160 | envParams.put('cfg_formula_pkg_revision', FORMULA_PKG_REVISION) |
| 161 | } |
| 162 | |
Mykyta Karpin | 0aa35d5 | 2017-08-28 11:44:42 +0300 | [diff] [blame] | 163 | openstack.createHeatStack(openstackCloud, STACK_NAME, STACK_TEMPLATE, envParams, HEAT_STACK_ENVIRONMENT, venv) |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | // get SALT_MASTER_URL |
| 167 | saltMasterHost = openstack.getHeatStackOutputParam(openstackCloud, STACK_NAME, 'salt_master_ip', venv) |
chnyda | e14058a | 2017-08-29 15:07:48 +0200 | [diff] [blame] | 168 | // check that saltMasterHost is valid |
| 169 | if (!saltMasterHost || !saltMasterHost.matches(ipRegex)) { |
| 170 | common.errorMsg("saltMasterHost is not a valid ip, value is: ${saltMasterHost}") |
| 171 | throw new Exception("saltMasterHost is not a valid ip") |
| 172 | } |
| 173 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 174 | currentBuild.description = "${STACK_NAME} ${saltMasterHost}" |
| 175 | |
| 176 | SALT_MASTER_URL = "http://${saltMasterHost}:6969" |
| 177 | |
| 178 | } else if (STACK_TYPE == 'aws') { |
| 179 | |
| 180 | // setup environment |
| 181 | aws.setupVirtualEnv(venv) |
| 182 | |
| 183 | // set aws_env_vars |
| 184 | aws_env_vars = aws.getEnvVars(AWS_API_CREDENTIALS, AWS_STACK_REGION) |
| 185 | |
| 186 | if (STACK_REUSE.toBoolean() == true && STACK_NAME == '') { |
| 187 | error("If you want to reuse existing stack you need to provide it's name") |
| 188 | } |
| 189 | |
| 190 | if (STACK_REUSE.toBoolean() == false) { |
| 191 | // Don't allow to set custom stack name |
| 192 | wrap([$class: 'BuildUser']) { |
| 193 | if (env.BUILD_USER_ID) { |
| 194 | STACK_NAME = "${env.BUILD_USER_ID}-${JOB_NAME}-${BUILD_NUMBER}" |
| 195 | } else { |
| 196 | STACK_NAME = "jenkins-${JOB_NAME}-${BUILD_NUMBER}" |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 197 | } |
| 198 | } |
| 199 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 200 | // no underscore in STACK_NAME |
| 201 | STACK_NAME = STACK_NAME.replaceAll('_', '-') |
| 202 | } |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 203 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 204 | // set description |
| 205 | currentBuild.description = STACK_NAME |
Tomáš Kukrál | 77b1b5a | 2017-09-24 18:56:49 +0200 | [diff] [blame] | 206 | outputs.put('stack_name', STACK_NAME) |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 207 | |
| 208 | if (STACK_REUSE.toBoolean() == false) { |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 209 | // get templates |
| 210 | git.checkoutGitRepository('template', STACK_TEMPLATE_URL, STACK_TEMPLATE_BRANCH, STACK_TEMPLATE_CREDENTIALS) |
| 211 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 212 | // start stack |
| 213 | def stack_params = [ |
| 214 | "ParameterKey=KeyName,ParameterValue=" + AWS_SSH_KEY, |
| 215 | "ParameterKey=CmpNodeCount,ParameterValue=" + STACK_COMPUTE_COUNT |
| 216 | ] |
| 217 | def template_file = 'cfn/' + STACK_TEMPLATE + '.yml' |
| 218 | aws.createStack(venv, aws_env_vars, template_file, STACK_NAME, stack_params) |
Tomáš Kukrál | 7a8a4fa | 2017-05-25 14:54:24 +0200 | [diff] [blame] | 219 | } |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 220 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 221 | // wait for stack to be ready |
| 222 | aws.waitForStatus(venv, aws_env_vars, STACK_NAME, 'CREATE_COMPLETE') |
| 223 | |
| 224 | // get outputs |
| 225 | saltMasterHost = aws.getOutputs(venv, aws_env_vars, STACK_NAME, 'SaltMasterIP') |
Tomáš Kukrál | 8e50d8e | 2017-09-01 17:40:53 +0200 | [diff] [blame] | 226 | |
chnyda | e14058a | 2017-08-29 15:07:48 +0200 | [diff] [blame] | 227 | // check that saltMasterHost is valid |
| 228 | if (!saltMasterHost || !saltMasterHost.matches(ipRegex)) { |
| 229 | common.errorMsg("saltMasterHost is not a valid ip, value is: ${saltMasterHost}") |
| 230 | throw new Exception("saltMasterHost is not a valid ip") |
| 231 | } |
| 232 | |
Tomáš Kukrál | 8e50d8e | 2017-09-01 17:40:53 +0200 | [diff] [blame] | 233 | currentBuild.description = "${STACK_NAME} ${saltMasterHost}" |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 234 | SALT_MASTER_URL = "http://${saltMasterHost}:6969" |
| 235 | |
| 236 | } else if (STACK_TYPE != 'physical') { |
| 237 | throw new Exception("STACK_TYPE ${STACK_TYPE} is not supported") |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 238 | } |
| 239 | |
Tomáš Kukrál | 8e50d8e | 2017-09-01 17:40:53 +0200 | [diff] [blame] | 240 | outputs.put('salt_api', SALT_MASTER_URL) |
| 241 | |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 242 | // Setup virtualenv for pepper |
| 243 | python.setupPepperVirtualenv(venvPepper, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS) |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 244 | } |
Tomáš Kukrál | 4691f68 | 2017-07-27 16:36:12 +0200 | [diff] [blame] | 245 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 246 | |
| 247 | // Set up override params |
Jakub Josef | eb15f0b | 2017-08-03 18:22:06 +0200 | [diff] [blame] | 248 | if (common.validInputParam('SALT_OVERRIDES')) { |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 249 | stage('Set Salt overrides') { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 250 | salt.setSaltOverrides(venvPepper, SALT_OVERRIDES) |
Tomáš Kukrál | 4691f68 | 2017-07-27 16:36:12 +0200 | [diff] [blame] | 251 | } |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 252 | } |
Tomáš Kukrál | 4691f68 | 2017-07-27 16:36:12 +0200 | [diff] [blame] | 253 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 254 | // |
| 255 | // Install |
| 256 | // |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 257 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 258 | if (common.checkContains('STACK_INSTALL', 'core')) { |
| 259 | stage('Install core infrastructure') { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 260 | orchestrate.installFoundationInfra(venvPepper) |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 261 | |
| 262 | if (common.checkContains('STACK_INSTALL', 'kvm')) { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 263 | orchestrate.installInfraKvm(venvPepper) |
| 264 | orchestrate.installFoundationInfra(venvPepper) |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 265 | } |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 266 | |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 267 | orchestrate.validateFoundationInfra(venvPepper) |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 268 | } |
| 269 | } |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 270 | |
Tomáš Kukrál | b6777fa | 2017-08-11 10:36:30 +0200 | [diff] [blame] | 271 | // install ceph |
| 272 | if (common.checkContains('STACK_INSTALL', 'ceph')) { |
Tomáš Kukrál | 7b949ea | 2017-08-19 10:08:39 +0200 | [diff] [blame] | 273 | stage('Install Ceph MONs') { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 274 | orchestrate.installCephMon(venvPepper) |
Tomáš Kukrál | 7b949ea | 2017-08-19 10:08:39 +0200 | [diff] [blame] | 275 | } |
| 276 | |
| 277 | stage('Install Ceph OSDs') { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 278 | orchestrate.installCephOsd(venvPepper) |
Tomáš Kukrál | 7b949ea | 2017-08-19 10:08:39 +0200 | [diff] [blame] | 279 | } |
Tomáš Kukrál | a77caa9 | 2017-08-25 18:19:52 +0200 | [diff] [blame] | 280 | |
Tomáš Kukrál | 0cc0109 | 2017-08-28 18:25:00 +0200 | [diff] [blame] | 281 | |
| 282 | stage('Install Ceph clients') { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 283 | orchestrate.installCephClient(venvPepper) |
Tomáš Kukrál | a77caa9 | 2017-08-25 18:19:52 +0200 | [diff] [blame] | 284 | } |
Jiri Broulik | 8c38003 | 2017-10-06 13:36:03 +0200 | [diff] [blame] | 285 | |
| 286 | stage('Connect Ceph') { |
chnyda | 625f4b4 | 2017-10-11 14:10:31 +0200 | [diff] [blame] | 287 | orchestrate.connectCeph(venvPepper) |
Jiri Broulik | 8c38003 | 2017-10-06 13:36:03 +0200 | [diff] [blame] | 288 | } |
Tomáš Kukrál | b6777fa | 2017-08-11 10:36:30 +0200 | [diff] [blame] | 289 | } |
| 290 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 291 | // install k8s |
| 292 | if (common.checkContains('STACK_INSTALL', 'k8s')) { |
| 293 | |
| 294 | stage('Install Kubernetes infra') { |
| 295 | if (STACK_TYPE == 'aws') { |
| 296 | // configure kubernetes_control_address - save loadbalancer |
Tomáš Kukrál | 8e50d8e | 2017-09-01 17:40:53 +0200 | [diff] [blame] | 297 | def awsOutputs = aws.getOutputs(venv, aws_env_vars, STACK_NAME) |
Tomáš Kukrál | 685f3b8 | 2017-09-03 10:14:40 +0200 | [diff] [blame] | 298 | common.prettyPrint(awsOutputs) |
Tomáš Kukrál | 8e50d8e | 2017-09-01 17:40:53 +0200 | [diff] [blame] | 299 | if (awsOutputs.containsKey('ControlLoadBalancer')) { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 300 | salt.runSaltProcessStep(venvPepper, 'I@salt:master', 'reclass.cluster_meta_set', ['kubernetes_control_address', awsOutputs['ControlLoadBalancer']], null, true) |
Tomáš Kukrál | 8e50d8e | 2017-09-01 17:40:53 +0200 | [diff] [blame] | 301 | outputs.put('kubernetes_apiserver', 'https://' + awsOutputs['ControlLoadBalancer']) |
| 302 | } |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 303 | } |
| 304 | |
| 305 | // ensure certificates are generated properly |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 306 | salt.runSaltProcessStep(venvPepper, '*', 'saltutil.refresh_pillar', [], null, true) |
| 307 | salt.enforceState(venvPepper, '*', ['salt.minion.cert'], true) |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 308 | |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 309 | orchestrate.installKubernetesInfra(venvPepper) |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 310 | } |
| 311 | |
| 312 | if (common.checkContains('STACK_INSTALL', 'contrail')) { |
| 313 | stage('Install Contrail for Kubernetes') { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 314 | orchestrate.installContrailNetwork(venvPepper) |
| 315 | orchestrate.installContrailCompute(venvPepper) |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 316 | } |
| 317 | } |
| 318 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 319 | stage('Install Kubernetes control') { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 320 | orchestrate.installKubernetesControl(venvPepper) |
Tomáš Kukrál | 7e48706 | 2017-08-31 11:20:08 +0200 | [diff] [blame] | 321 | |
| 322 | // collect artifacts (kubeconfig) |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 323 | writeFile(file: 'kubeconfig', text: salt.getFileContent(venvPepper, 'I@kubernetes:master and *01*', '/etc/kubernetes/admin-kube-config')) |
Tomáš Kukrál | 7e48706 | 2017-08-31 11:20:08 +0200 | [diff] [blame] | 324 | archiveArtifacts(artifacts: 'kubeconfig') |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 325 | } |
| 326 | |
| 327 | stage('Scale Kubernetes computes') { |
| 328 | if (STACK_COMPUTE_COUNT > 0) { |
Tomáš Kukrál | 39c96cd | 2017-07-11 10:14:13 +0200 | [diff] [blame] | 329 | if (STACK_TYPE == 'aws') { |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 330 | // get stack info |
| 331 | def scaling_group = aws.getOutputs(venv, aws_env_vars, STACK_NAME, 'ComputesScalingGroup') |
| 332 | |
| 333 | //update autoscaling group |
| 334 | aws.updateAutoscalingGroup(venv, aws_env_vars, scaling_group, ["--desired-capacity " + STACK_COMPUTE_COUNT]) |
| 335 | |
| 336 | // wait for computes to boot up |
| 337 | aws.waitForAutoscalingInstances(venv, aws_env_vars, scaling_group) |
| 338 | sleep(60) |
Tomáš Kukrál | 8427ff5 | 2017-08-30 15:46:52 +0200 | [diff] [blame] | 339 | |
| 340 | } else if (STACK_TYPE == 'heat') { |
| 341 | envParams.put('cluster_node_count', STACK_COMPUTE_COUNT) |
| 342 | |
| 343 | openstack.createHeatStack(openstackCloud, STACK_NAME, STACK_TEMPLATE, envParams, HEAT_STACK_ENVIRONMENT, venv, "update") |
| 344 | sleep(60) |
Tomáš Kukrál | 39c96cd | 2017-07-11 10:14:13 +0200 | [diff] [blame] | 345 | } |
Tomáš Kukrál | 4691f68 | 2017-07-27 16:36:12 +0200 | [diff] [blame] | 346 | |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 347 | orchestrate.installKubernetesCompute(venvPepper) |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 348 | } |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 349 | } |
| 350 | } |
| 351 | |
| 352 | // install openstack |
| 353 | if (common.checkContains('STACK_INSTALL', 'openstack')) { |
| 354 | // install Infra and control, tests, ... |
| 355 | |
| 356 | stage('Install OpenStack infra') { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 357 | orchestrate.installOpenstackInfra(venvPepper) |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 358 | } |
| 359 | |
| 360 | stage('Install OpenStack control') { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 361 | orchestrate.installOpenstackControl(venvPepper) |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 362 | } |
| 363 | |
| 364 | stage('Install OpenStack network') { |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 365 | |
vrovachev | 7be1e96 | 2017-07-05 13:28:26 +0400 | [diff] [blame] | 366 | if (common.checkContains('STACK_INSTALL', 'contrail')) { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 367 | orchestrate.installContrailNetwork(venvPepper) |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 368 | } else if (common.checkContains('STACK_INSTALL', 'ovs')) { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 369 | orchestrate.installOpenstackNetwork(venvPepper) |
vrovachev | 7be1e96 | 2017-07-05 13:28:26 +0400 | [diff] [blame] | 370 | } |
| 371 | |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 372 | salt.runSaltProcessStep(venvPepper, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; neutron net-list']) |
| 373 | salt.runSaltProcessStep(venvPepper, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; nova net-list']) |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 374 | } |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 375 | |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 376 | if (salt.testTarget(venvPepper, 'I@ironic:conductor')){ |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 377 | stage('Install OpenStack Ironic conductor') { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 378 | orchestrate.installIronicConductor(venvPepper) |
Tomáš Kukrál | 74f9286 | 2017-06-05 19:18:43 +0200 | [diff] [blame] | 379 | } |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 380 | } |
| 381 | |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 382 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 383 | stage('Install OpenStack compute') { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 384 | orchestrate.installOpenstackCompute(venvPepper) |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 385 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 386 | if (common.checkContains('STACK_INSTALL', 'contrail')) { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 387 | orchestrate.installContrailCompute(venvPepper) |
Martin Polreich | 4697110 | 2017-07-11 12:56:40 +0200 | [diff] [blame] | 388 | } |
| 389 | } |
| 390 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 391 | } |
| 392 | |
Jiri Broulik | b27b483 | 2017-09-05 16:41:03 +0200 | [diff] [blame] | 393 | if (common.checkContains('STACK_INSTALL', 'cicd')) { |
| 394 | stage('Install Cicd') { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 395 | orchestrate.installDockerSwarm(venvPepper) |
| 396 | orchestrate.installCicd(venvPepper) |
Jiri Broulik | b27b483 | 2017-09-05 16:41:03 +0200 | [diff] [blame] | 397 | } |
| 398 | } |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 399 | |
| 400 | if (common.checkContains('STACK_INSTALL', 'sl-legacy')) { |
| 401 | stage('Install StackLight v1') { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 402 | orchestrate.installStacklightv1Control(venvPepper) |
| 403 | orchestrate.installStacklightv1Client(venvPepper) |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 404 | } |
| 405 | } |
| 406 | |
| 407 | if (common.checkContains('STACK_INSTALL', 'stacklight')) { |
| 408 | stage('Install StackLight') { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 409 | orchestrate.installDockerSwarm(venvPepper) |
| 410 | orchestrate.installStacklight(venvPepper) |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 411 | } |
| 412 | } |
| 413 | |
| 414 | // |
| 415 | // Test |
| 416 | // |
| 417 | def artifacts_dir = '_artifacts/' |
| 418 | |
| 419 | if (common.checkContains('STACK_TEST', 'k8s')) { |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 420 | stage('Run k8s conformance e2e tests') { |
Anna Babich | 12dd5b1 | 2017-08-21 18:01:35 +0300 | [diff] [blame] | 421 | def image = TEST_K8S_CONFORMANCE_IMAGE |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 422 | def output_file = image.replaceAll('/', '-') + '.output' |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 423 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 424 | // run image |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 425 | test.runConformanceTests(venvPepper, 'ctl01*', TEST_K8S_API_SERVER, image) |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 426 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 427 | // collect output |
| 428 | sh "mkdir -p ${artifacts_dir}" |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 429 | file_content = salt.getFileContent(venvPepper, 'ctl01*', '/tmp/' + output_file) |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 430 | writeFile file: "${artifacts_dir}${output_file}", text: file_content |
| 431 | sh "cat ${artifacts_dir}${output_file}" |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 432 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 433 | // collect artifacts |
| 434 | archiveArtifacts artifacts: "${artifacts_dir}${output_file}" |
| 435 | } |
| 436 | } |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 437 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 438 | if (common.checkContains('STACK_TEST', 'openstack')) { |
| 439 | if (common.checkContains('TEST_DOCKER_INSTALL', 'true')) { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 440 | test.install_docker(venvPepper, TEST_TEMPEST_TARGET) |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 441 | } |
| 442 | stage('Run OpenStack tests') { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 443 | test.runTempestTests(venvPepper, TEST_TEMPEST_IMAGE, TEST_TEMPEST_TARGET, TEST_TEMPEST_PATTERN) |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 444 | } |
| 445 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 446 | stage('Copy Tempest results to config node') { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 447 | test.copyTempestResults(venvPepper, TEST_TEMPEST_TARGET) |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 448 | } |
Vasyl Saienko | ff24e58 | 2017-08-04 10:04:33 +0300 | [diff] [blame] | 449 | |
| 450 | stage('Archive rally artifacts') { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 451 | test.archiveRallyArtifacts(venvPepper, TEST_TEMPEST_TARGET) |
Vasyl Saienko | ff24e58 | 2017-08-04 10:04:33 +0300 | [diff] [blame] | 452 | } |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 453 | } |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 454 | |
Tomáš Kukrál | 4b6b4d3 | 2017-08-21 20:29:21 +0200 | [diff] [blame] | 455 | |
| 456 | if (common.checkContains('STACK_TEST', 'ceph')) { |
Tomáš Kukrál | f579808 | 2017-08-21 22:37:41 +0200 | [diff] [blame] | 457 | stage('Run infra tests') { |
Tomáš Kukrál | 36d4397 | 2017-08-30 12:43:17 +0200 | [diff] [blame] | 458 | sleep(120) |
Tomáš Kukrál | 07ad0c9 | 2017-08-21 23:19:40 +0200 | [diff] [blame] | 459 | def cmd = "apt-get install -y python-pip && pip install -r /usr/share/salt-formulas/env/ceph/files/testinfra/requirements.txt && python -m pytest --junitxml=/root/report.xml /usr/share/salt-formulas/env/ceph/files/testinfra/" |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 460 | salt.cmdRun(venvPepper, 'I@salt:master', cmd, false) |
| 461 | writeFile(file: 'report.xml', text: salt.getFileContent(venvPepper, 'I@salt:master', '/root/report.xml')) |
Tomáš Kukrál | c48456a | 2017-08-21 23:03:37 +0200 | [diff] [blame] | 462 | junit(keepLongStdio: true, testResults: 'report.xml') |
Tomáš Kukrál | 4b6b4d3 | 2017-08-21 20:29:21 +0200 | [diff] [blame] | 463 | } |
| 464 | } |
| 465 | |
| 466 | |
Tomáš Kukrál | 8e50d8e | 2017-09-01 17:40:53 +0200 | [diff] [blame] | 467 | stage('Finalize') { |
| 468 | if (common.checkContains('STACK_INSTALL', 'finalize')) { |
chnyda | 597fb03 | 2017-10-06 13:42:48 +0200 | [diff] [blame] | 469 | salt.runSaltProcessStep(venvPepper, '*', 'state.apply', [], null, true) |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 470 | } |
Tomáš Kukrál | 8e50d8e | 2017-09-01 17:40:53 +0200 | [diff] [blame] | 471 | |
| 472 | outputsPretty = common.prettify(outputs) |
| 473 | print(outputsPretty) |
| 474 | writeFile(file: 'outputs.json', text: outputsPretty) |
| 475 | archiveArtifacts(artifacts: 'outputs.json') |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 476 | } |
Tomáš Kukrál | 53224c2 | 2017-07-26 10:53:20 +0200 | [diff] [blame] | 477 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 478 | } catch (Throwable e) { |
| 479 | currentBuild.result = 'FAILURE' |
| 480 | throw e |
| 481 | } finally { |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 482 | |
| 483 | |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 484 | // |
| 485 | // Clean |
| 486 | // |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 487 | |
Jakub Josef | eb15f0b | 2017-08-03 18:22:06 +0200 | [diff] [blame] | 488 | if (common.validInputParam('STACK_NAME')) { |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 489 | // send notification |
| 490 | common.sendNotification(currentBuild.result, STACK_NAME, ["slack"]) |
| 491 | } |
| 492 | |
Jakub Josef | eb15f0b | 2017-08-03 18:22:06 +0200 | [diff] [blame] | 493 | if (common.validInputParam('STACK_DELETE') && STACK_DELETE.toBoolean() == true) { |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 494 | stage('Trigger cleanup job') { |
| 495 | common.errorMsg('Stack cleanup job triggered') |
| 496 | build(job: STACK_CLEANUP_JOB, parameters: [ |
| 497 | [$class: 'StringParameterValue', name: 'STACK_NAME', value: STACK_NAME], |
| 498 | [$class: 'StringParameterValue', name: 'STACK_TYPE', value: STACK_TYPE], |
| 499 | [$class: 'StringParameterValue', name: 'OPENSTACK_API_URL', value: OPENSTACK_API_URL], |
| 500 | [$class: 'StringParameterValue', name: 'OPENSTACK_API_CREDENTIALS', value: OPENSTACK_API_CREDENTIALS], |
| 501 | [$class: 'StringParameterValue', name: 'OPENSTACK_API_PROJECT', value: OPENSTACK_API_PROJECT], |
| 502 | [$class: 'StringParameterValue', name: 'OPENSTACK_API_PROJECT_DOMAIN', value: OPENSTACK_API_PROJECT_DOMAIN], |
| 503 | [$class: 'StringParameterValue', name: 'OPENSTACK_API_PROJECT_ID', value: OPENSTACK_API_PROJECT_ID], |
| 504 | [$class: 'StringParameterValue', name: 'OPENSTACK_API_USER_DOMAIN', value: OPENSTACK_API_USER_DOMAIN], |
| 505 | [$class: 'StringParameterValue', name: 'OPENSTACK_API_CLIENT', value: OPENSTACK_API_CLIENT], |
| 506 | [$class: 'StringParameterValue', name: 'OPENSTACK_API_VERSION', value: OPENSTACK_API_VERSION] |
| 507 | ]) |
Tomáš Kukrál | 439c62e | 2017-06-02 11:42:36 +0200 | [diff] [blame] | 508 | } |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 509 | } else { |
| 510 | if (currentBuild.result == 'FAILURE') { |
| 511 | common.errorMsg("Deploy job FAILED and was not deleted. Please fix the problem and delete stack on you own.") |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 512 | |
Jakub Josef | eb15f0b | 2017-08-03 18:22:06 +0200 | [diff] [blame] | 513 | if (common.validInputParam('SALT_MASTER_URL')) { |
Ruslan Kamaldinov | 6514432 | 2017-08-02 15:16:55 +0400 | [diff] [blame] | 514 | common.errorMsg("Salt master URL: ${SALT_MASTER_URL}") |
Ales Komarek | 2409740 | 2017-05-22 16:28:10 +0200 | [diff] [blame] | 515 | } |
| 516 | } |
| 517 | } |
| 518 | } |
| 519 | } |