Dennis Dmitriev | 4c38347 | 2019-04-12 13:58:06 +0300 | [diff] [blame] | 1 | /** |
| 2 | * |
| 3 | * Create fuel-devops environment, generate a model for it |
| 4 | * and bootstrap a salt cluster on the environment nodes |
| 5 | * |
| 6 | * Expected parameters: |
| 7 | |
| 8 | * PARENT_NODE_NAME Name of the jenkins slave to create the environment |
| 9 | * PARENT_WORKSPACE Path to the workspace of the parent job to use tcp-qa repo |
| 10 | * LAB_CONFIG_NAME Name of the tcp-qa deployment template |
| 11 | * ENV_NAME Fuel-devops environment name |
| 12 | * MCP_VERSION MCP version, like 2018.4 or proposed |
| 13 | * MCP_IMAGE_PATH1604 Local path to the image http://ci.mcp.mirantis.net:8085/images/ubuntu-16-04-x64-mcpproposed.qcow2 |
| 14 | * IMAGE_PATH_CFG01_DAY01 Local path to the image http://ci.mcp.mirantis.net:8085/images/cfg01-day01-proposed.qcow2 |
| 15 | * CFG01_CONFIG_IMAGE_NAME Name for the creating config drive image, like cfg01.${LAB_CONFIG_NAME}-config-drive.iso |
Hanna Arhipova | 5173aad | 2019-11-11 12:42:31 +0200 | [diff] [blame] | 16 | * TCP_QA_REFS Reference to the tcp-qa change on Gerrit, like refs/changes/46/418546/41 |
Dennis Dmitriev | 4c38347 | 2019-04-12 13:58:06 +0300 | [diff] [blame] | 17 | * PIPELINE_LIBRARY_REF Reference to the pipeline-library change |
| 18 | * MK_PIPELINES_REF Reference to the mk-pipelines change |
| 19 | * COOKIECUTTER_TEMPLATE_COMMIT Commit/tag/branch for cookiecutter-templates repository. If empty, then takes ${MCP_VERSION} value |
| 20 | * SALT_MODELS_SYSTEM_COMMIT Commit/tag/branch for reclass-system repository. If empty, then takes ${MCP_VERSION} value |
| 21 | * SHUTDOWN_ENV_ON_TEARDOWN optional, shutdown fuel-devops environment at the end of the job |
| 22 | * MCP_SALT_REPO_URL Base URL for MCP repositories required to bootstrap cfg01 node. Leave blank to use default |
| 23 | * (http://mirror.mirantis.com/ from mcp-common-scripts) |
| 24 | * MCP_SALT_REPO_KEY URL of the key file. Leave blank to use default |
| 25 | * (${MCP_SALT_REPO_URL}/${MCP_VERSION}/salt-formulas/xenial/archive-salt-formulas.key from mcp-common-scripts) |
| 26 | * OS_AUTH_URL OpenStack keystone catalog URL |
| 27 | * OS_PROJECT_NAME OpenStack project (tenant) name |
| 28 | * OS_USER_DOMAIN_NAME OpenStack user domain name |
| 29 | * OS_CREDENTIALS OpenStack username and password credentials ID in Jenkins |
Tatyana Leontovich | 8ac26d7 | 2019-05-15 23:33:38 +0300 | [diff] [blame] | 30 | * JENKINS_PIPELINE_BRANCH Should be set in release/proposed/2019.2.0 when we test non-released version |
Tatyana Leontovich | 4718bdf | 2019-05-24 12:37:06 +0300 | [diff] [blame] | 31 | * UPDATE_VERSION Version of update to deploy |
Dennis Dmitriev | 4c38347 | 2019-04-12 13:58:06 +0300 | [diff] [blame] | 32 | * LAB_PARAM_DEFAULTS Filename placed in tcp_tests/templates/_heat_environments, with default parameters for the heat template |
| 33 | * |
Dennis Dmitriev | 0244741 | 2019-04-17 18:02:46 +0300 | [diff] [blame] | 34 | * CREATE_JENKINS_NODE_CREDENTIALS Jenkins username and password with rights to add/delete Jenkins agents |
Dennis Dmitriev | 4c38347 | 2019-04-12 13:58:06 +0300 | [diff] [blame] | 35 | */ |
| 36 | |
| 37 | @Library('tcp-qa')_ |
| 38 | |
| 39 | import groovy.xml.XmlUtil |
| 40 | |
| 41 | common = new com.mirantis.mk.Common() |
| 42 | shared = new com.mirantis.system_qa.SharedPipeline() |
| 43 | |
| 44 | if (! env.PARENT_NODE_NAME) { |
| 45 | error "'PARENT_NODE_NAME' must be set from the parent deployment job!" |
| 46 | } |
| 47 | |
| 48 | currentBuild.description = "${PARENT_NODE_NAME}:${ENV_NAME}" |
Hanna Arhipova | c2965a4 | 2020-01-21 12:27:33 +0200 | [diff] [blame] | 49 | def cfg01_day01_image_name = "cfg01-day01-2019.2.0" |
| 50 | def ubuntu_vcp_image_name = "ubuntu-vcp-2019.2.0" |
| 51 | def ubuntu_foundation_image_name = "ubuntu-16.04-foundation-2019.2.0" |
Dennis Dmitriev | 4c38347 | 2019-04-12 13:58:06 +0300 | [diff] [blame] | 52 | |
Dennis Dmitriev | 1f08b0c | 2019-05-27 17:03:53 +0300 | [diff] [blame] | 53 | timeout(time: 2, unit: 'HOURS') { |
Hanna Arhipova | 6736dab | 2020-05-07 14:33:35 +0300 | [diff] [blame^] | 54 | timestamps { |
| 55 | node ("${PARENT_NODE_NAME}") { |
| 56 | if (! fileExists("${PARENT_WORKSPACE}")) { |
| 57 | error "'PARENT_WORKSPACE' contains path to non-existing directory ${PARENT_WORKSPACE} on the node '${PARENT_NODE_NAME}'." |
Dennis Dmitriev | 4c38347 | 2019-04-12 13:58:06 +0300 | [diff] [blame] | 58 | } |
Hanna Arhipova | 6736dab | 2020-05-07 14:33:35 +0300 | [diff] [blame^] | 59 | dir("${PARENT_WORKSPACE}") { |
Dennis Dmitriev | 4c38347 | 2019-04-12 13:58:06 +0300 | [diff] [blame] | 60 | |
Hanna Arhipova | 6736dab | 2020-05-07 14:33:35 +0300 | [diff] [blame^] | 61 | if (env.TCP_QA_REFS) { |
| 62 | stage("Update working dir to patch ${TCP_QA_REFS}") { |
| 63 | shared.update_working_dir() |
Dmitry Tyzhnenko | 819f5bf | 2019-05-29 14:45:09 +0300 | [diff] [blame] | 64 | } |
| 65 | } |
Dennis Dmitriev | 2700732 | 2019-05-03 19:21:44 +0300 | [diff] [blame] | 66 | |
Hanna Arhipova | 6736dab | 2020-05-07 14:33:35 +0300 | [diff] [blame^] | 67 | withCredentials([ |
| 68 | [$class : 'UsernamePasswordMultiBinding', |
| 69 | credentialsId : env.OS_CREDENTIALS, |
| 70 | passwordVariable: 'OS_PASSWORD', |
| 71 | usernameVariable: 'OS_USERNAME'] |
| 72 | ]) { |
| 73 | env.OS_IDENTITY_API_VERSION = 3 |
Dennis Dmitriev | 4c38347 | 2019-04-12 13:58:06 +0300 | [diff] [blame] | 74 | |
Hanna Arhipova | 6736dab | 2020-05-07 14:33:35 +0300 | [diff] [blame^] | 75 | stage("Cleanup: erase ${ENV_NAME} and remove config drive") { |
Dennis Dmitriev | 4c38347 | 2019-04-12 13:58:06 +0300 | [diff] [blame] | 76 | |
Hanna Arhipova | 6736dab | 2020-05-07 14:33:35 +0300 | [diff] [blame^] | 77 | // delete heat stack |
| 78 | println "Remove heat stack '${ENV_NAME}'" |
| 79 | shared.run_cmd("""\ |
| 80 | # export OS_IDENTITY_API_VERSION=3 |
| 81 | # export OS_AUTH_URL=${OS_AUTH_URL} |
| 82 | # export OS_USERNAME=${OS_USERNAME} |
| 83 | # export OS_PASSWORD=${OS_PASSWORD} |
| 84 | # export OS_PROJECT_NAME=${OS_PROJECT_NAME} |
| 85 | openstack --insecure stack delete -y ${ENV_NAME} || true |
| 86 | timeout 20m /bin/bash -c "while openstack --insecure stack show ${ENV_NAME} -f value -c stack_status; do sleep 10; done" |
| 87 | """) |
Dennis Dmitriev | 2700732 | 2019-05-03 19:21:44 +0300 | [diff] [blame] | 88 | |
Hanna Arhipova | 6736dab | 2020-05-07 14:33:35 +0300 | [diff] [blame^] | 89 | println "Remove config drive ISO" |
| 90 | shared.run_cmd("""\ |
| 91 | rm /home/jenkins/images/${CFG01_CONFIG_IMAGE_NAME} || true |
| 92 | """) |
| 93 | } |
| 94 | |
| 95 | stage("Generate the model") { |
| 96 | def IPV4_NET_ADMIN=shared.run_cmd_stdout("./tcp_tests/utils/get_param_heat_template.py management_subnet_cidr").trim().split().last() |
| 97 | def IPV4_NET_CONTROL=shared.run_cmd_stdout("./tcp_tests/utils/get_param_heat_template.py control_subnet_cidr").trim().split().last() |
| 98 | def IPV4_NET_TENANT=shared.run_cmd_stdout("./tcp_tests/utils/get_param_heat_template.py tenant_subnet_cidr").trim().split().last() |
| 99 | def IPV4_NET_EXTERNAL=shared.run_cmd_stdout("./tcp_tests/utils/get_param_heat_template.py external_subnet_cidr").trim().split().last() |
| 100 | shared.generate_cookied_model(IPV4_NET_ADMIN, IPV4_NET_CONTROL, IPV4_NET_TENANT, IPV4_NET_EXTERNAL) |
| 101 | } |
| 102 | |
| 103 | stage("Generate config drive ISO") { |
| 104 | SALT_MASTER_IP=shared.run_cmd_stdout("./tcp_tests/utils/get_param_heat_template.py management_subnet_cfg01_ip").trim().split().last() |
| 105 | def ADMIN_NETWORK_GW=shared.run_cmd_stdout("./tcp_tests/utils/get_param_heat_template.py management_subnet_gateway_ip").trim().split().last() |
| 106 | shared.generate_configdrive_iso(SALT_MASTER_IP, ADMIN_NETWORK_GW) |
| 107 | } |
| 108 | |
| 109 | stage("Upload Ubuntu image for foundation node") { |
| 110 | shared.run_cmd("""\ |
| 111 | if ! openstack --insecure image show ${ubuntu_foundation_image_name} -f value -c name; then |
| 112 | wget -O ./${ubuntu_foundation_image_name} https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img |
| 113 | openstack --insecure image create ${ubuntu_foundation_image_name} --file ./${ubuntu_foundation_image_name} --disk-format qcow2 --container-format bare |
| 114 | rm ./${ubuntu_foundation_image_name} |
| 115 | else |
| 116 | echo Image ${ubuntu_foundation_image_name} already exists |
| 117 | fi |
| 118 | """) |
| 119 | } |
| 120 | |
| 121 | stage("Upload cfg01-day01 and VCP images") { |
| 122 | shared.run_cmd("""\ |
| 123 | # export OS_IDENTITY_API_VERSION=3 |
| 124 | # export OS_AUTH_URL=${OS_AUTH_URL} |
| 125 | # export OS_USERNAME=${OS_USERNAME} |
| 126 | # export OS_PASSWORD=${OS_PASSWORD} |
| 127 | # export OS_PROJECT_NAME=${OS_PROJECT_NAME} |
| 128 | |
| 129 | openstack --insecure image show ${cfg01_day01_image_name} -f value -c name || openstack --insecure image create ${cfg01_day01_image_name} --file ${IMAGE_PATH_CFG01_DAY01} --disk-format qcow2 --container-format bare |
| 130 | openstack --insecure image show ${ubuntu_vcp_image_name} -f value -c name || openstack --insecure image create ${ubuntu_vcp_image_name} --file ${MCP_IMAGE_PATH1604} --disk-format qcow2 --container-format bare |
| 131 | """) |
| 132 | } |
| 133 | |
| 134 | stage("Upload generated config drive ISO into volume on cfg01 node") { |
| 135 | shared.run_cmd("""\ |
| 136 | # export OS_IDENTITY_API_VERSION=3 |
| 137 | # export OS_AUTH_URL=${OS_AUTH_URL} |
| 138 | # export OS_USERNAME=${OS_USERNAME} |
| 139 | # export OS_PASSWORD=${OS_PASSWORD} |
| 140 | # export OS_PROJECT_NAME=${OS_PROJECT_NAME} |
| 141 | |
| 142 | openstack --insecure image delete cfg01.${ENV_NAME}-config-drive.iso || true |
| 143 | sleep 3 |
| 144 | openstack --insecure image create cfg01.${ENV_NAME}-config-drive.iso --file /home/jenkins/images/${CFG01_CONFIG_IMAGE_NAME} --disk-format iso --container-format bare |
| 145 | """) |
| 146 | } |
| 147 | |
| 148 | stage("Create Heat stack '${ENV_NAME}'") { |
| 149 | // Create stack and wait for CREATE_COMPLETED status, manual analog: |
| 150 | // openstack --insecure stack create ${ENV_NAME} \ |
| 151 | // --template ./tcp_tests/templates/${LAB_CONFIG_NAME}/underlay.hot \ |
| 152 | // --environment ./tcp_tests/templates/_heat_environments/${LAB_PARAM_DEFAULTS} \ |
| 153 | // --parameter env_name=${ENV_NAME} --parameter mcp_version=${MCP_VERSION} |
| 154 | shared.run_cmd("""\ |
| 155 | export BOOTSTRAP_TIMEOUT=3600 |
| 156 | export ENV_MANAGER=heat |
| 157 | export TEST_GROUP=test_create_environment |
| 158 | export SHUTDOWN_ENV_ON_TEARDOWN=false |
| 159 | export PYTHONIOENCODING=UTF-8 |
| 160 | export REPOSITORY_SUITE=${MCP_VERSION} |
| 161 | export UPDATE_VERSION=${UPDATE_VERSION} |
| 162 | export ENV_NAME=${ENV_NAME} |
| 163 | export LAB_CONFIG_NAME=${LAB_CONFIG_NAME} |
| 164 | export LAB_PARAM_DEFAULTS=${LAB_PARAM_DEFAULTS} |
| 165 | export LOG_NAME=swarm_test_create_environment.log |
| 166 | py.test --cache-clear -vvv -s -p no:django -p no:ipdb --junit-xml=deploy_hardware.xml -k \${TEST_GROUP} |
| 167 | """) |
| 168 | } |
| 169 | |
| 170 | stage("Add the Jenkins slave node") { |
| 171 | def jenkins_slave_ip_value_name = "foundation_public_ip" |
| 172 | def jenkins_slave_ip = shared.run_cmd_stdout("openstack --insecure stack output show ${ENV_NAME} ${jenkins_slave_ip_value_name} -f value -c output_value").trim().split().last() |
| 173 | def jenkins_slave_executors = 2 |
| 174 | common.printMsg("JENKINS_SLAVE_NODE_NAME=${JENKINS_SLAVE_NODE_NAME}", "green") |
| 175 | common.printMsg("JENKINS_SLAVE_IP=${jenkins_slave_ip}", "green") |
| 176 | |
| 177 | withCredentials([ |
| 178 | [$class : 'UsernamePasswordMultiBinding', |
| 179 | credentialsId : "${CREATE_JENKINS_NODE_CREDENTIALS}", |
| 180 | passwordVariable: 'JENKINS_PASS', |
| 181 | usernameVariable: 'JENKINS_USER'] |
| 182 | ]) { |
| 183 | |
| 184 | script_delete_agent = ("""\ |
| 185 | CRUMB=\$(curl --fail -0 -u \"\${JENKINS_USER}:\${JENKINS_PASS}\" \${JENKINS_URL}\'/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb)\' 2>/dev/null) |
| 186 | curl -w '%{http_code}' -o /dev/null \ |
| 187 | -u \"\${JENKINS_USER}:\${JENKINS_PASS}\" \ |
| 188 | -H \"Content-Type:application/x-www-form-urlencoded\" \ |
| 189 | -H \"\$CRUMB\" \ |
| 190 | \"\${JENKINS_URL}/computer/\${JENKINS_SLAVE_NODE_NAME}/doDelete\" \ |
| 191 | --request \'POST\' --data \'\' |
| 192 | sleep 10 |
| 193 | """) |
| 194 | |
| 195 | script_create_agent = ("""\ |
| 196 | CRUMB=\$(curl --fail -0 -u \"\${JENKINS_USER}:\${JENKINS_PASS}\" \${JENKINS_URL}\'/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb)\' 2>/dev/null) |
| 197 | |
| 198 | curl -L -sS -w '%{http_code}' -o /dev/null \ |
| 199 | -u \"\${JENKINS_USER}:\${JENKINS_PASS}\" \ |
| 200 | -H \"Content-Type:application/x-www-form-urlencoded\" \ |
| 201 | -H \"\$CRUMB\" \ |
| 202 | -X POST -d 'json={\ |
| 203 | \"name\": \"'\"\$JENKINS_SLAVE_NODE_NAME\"'\", \ |
| 204 | \"nodeDescription\": \"'\"\$ENV_NAME\"'\", \ |
| 205 | \"numExecutors\": \"'\"${jenkins_slave_executors}\"'\", \ |
| 206 | \"remoteFS\": \"'\"/home/jenkins/workspace\"'\", \ |
| 207 | \"labelString\": \"'\"\$ENV_NAME\"'\", \ |
| 208 | \"mode\": \"EXCLUSIVE\", \ |
| 209 | \"\": [\"hudson.plugins.sshslaves.SSHLauncher\", \"hudson.slaves.RetentionStrategy\$Always\"], \ |
| 210 | \"launcher\": {\ |
| 211 | \"stapler-class\": \"hudson.plugins.sshslaves.SSHLauncher\", \ |
| 212 | \"\$class\": \"hudson.plugins.sshslaves.SSHLauncher\", \ |
| 213 | \"host\": \"'\"${jenkins_slave_ip}\"'\", \ |
| 214 | \"credentialsId\": \"'\"\$ACCESS_JENKINS_NODE_CREDENTIALS\"'\", \ |
| 215 | \"port\": \"'\"22\"'\", \ |
| 216 | \"javaPath\": \"\", \ |
| 217 | \"jvmOptions\": \"\", \ |
| 218 | \"prefixStartSlaveCmd\": \"\", \ |
| 219 | \"suffixStartSlaveCmd\": \"\", \ |
| 220 | \"launchTimeoutSeconds\": \"\", \ |
| 221 | \"maxNumRetries\": \"\", \ |
| 222 | \"retryWaitTime\": \"\", \ |
| 223 | \"sshHostKeyVerificationStrategy\": {\ |
| 224 | \"\$class\": \"hudson.plugins.sshslaves.verifiers.NonVerifyingKeyVerificationStrategy\" \ |
| 225 | }, \ |
| 226 | \"tcpNoDelay\": \"true\"\ |
| 227 | }, \ |
| 228 | \"retentionStrategy\": {\ |
| 229 | \"stapler-class\": \"hudson.slaves.RetentionStrategy\$Always\", \ |
| 230 | \"\$class\": \"hudson.slaves.RetentionStrategy\$Always\"\ |
| 231 | }, \ |
| 232 | \"nodeProperties\": {\ |
| 233 | \"stapler-class-bag\": \"true\"\ |
| 234 | }, \ |
| 235 | \"type\": \"hudson.slaves.DumbSlave\", \ |
| 236 | \"crumb\": \"'\"\$CRUMB\"'\"}' \ |
| 237 | \"\${JENKINS_URL}/computer/doCreateItem?name=\${JENKINS_SLAVE_NODE_NAME}&type=hudson.slaves.DumbSlave\" |
| 238 | """) |
| 239 | shared.verbose_sh(script_delete_agent, true, false, true) |
| 240 | shared.verbose_sh(script_create_agent, true, false, true) |
| 241 | timeout(time: 30, unit: 'MINUTES') { |
| 242 | node("${JENKINS_SLAVE_NODE_NAME}") { |
| 243 | sh "echo 'ok'" |
| 244 | println "Jenkins agent is available now and can executes commands" |
| 245 | } |
| 246 | } |
| 247 | // Store jenkins agent IP address |
| 248 | jenkins_agent_description = "ssh jenkins@${jenkins_slave_ip} # foundation node with Jenkins agent <a href=${JENKINS_URL}/computer/${JENKINS_SLAVE_NODE_NAME}>${JENKINS_SLAVE_NODE_NAME}</a><br>ssh root@${SALT_MASTER_IP} # cfg01 node<br>" |
| 249 | writeFile(file: "jenkins_agent_description.txt", text: jenkins_agent_description, encoding: "UTF-8") |
| 250 | |
| 251 | } // withCredentials |
| 252 | |
| 253 | }// stage |
| 254 | |
| 255 | } // withCredentials |
| 256 | |
| 257 | } // dir |
| 258 | } // node |
Dennis Dmitriev | 4c38347 | 2019-04-12 13:58:06 +0300 | [diff] [blame] | 259 | |
| 260 | |
Hanna Arhipova | 6736dab | 2020-05-07 14:33:35 +0300 | [diff] [blame^] | 261 | node ("${JENKINS_SLAVE_NODE_NAME}") { |
| 262 | dir("${PARENT_WORKSPACE}") { |
Dennis Dmitriev | 4c38347 | 2019-04-12 13:58:06 +0300 | [diff] [blame] | 263 | |
Hanna Arhipova | 6736dab | 2020-05-07 14:33:35 +0300 | [diff] [blame^] | 264 | stage("Clean the environment and clone tcp-qa") { |
| 265 | deleteDir() |
| 266 | shared.verbose_sh("""\ |
| 267 | [ -d /home/jenkins/venv_testrail_reporter ] || virtualenv /home/jenkins/venv_testrail_reporter |
| 268 | """, true, false, true) |
| 269 | shared.run_cmd("""\ |
| 270 | . /home/jenkins/venv_testrail_reporter/bin/activate; pip install git+https://github.com/dis-xcom/testrail_reporter -U |
Dennis Dmitriev | 4c38347 | 2019-04-12 13:58:06 +0300 | [diff] [blame] | 271 | """) |
Hanna Arhipova | 6736dab | 2020-05-07 14:33:35 +0300 | [diff] [blame^] | 272 | shared.verbose_sh("""\ |
| 273 | [ -d /home/jenkins/fuel-devops30 ] || virtualenv /home/jenkins/fuel-devops30 |
| 274 | """, true, false, true) |
| 275 | shared.run_cmd("""\ |
| 276 | git clone https://gerrit.mcp.mirantis.com/mcp/tcp-qa ${PARENT_WORKSPACE} |
| 277 | """) |
| 278 | shared.update_working_dir() |
Dennis Dmitriev | 4c38347 | 2019-04-12 13:58:06 +0300 | [diff] [blame] | 279 | } |
Hanna Arhipova | 6736dab | 2020-05-07 14:33:35 +0300 | [diff] [blame^] | 280 | |
| 281 | withCredentials([ |
| 282 | [$class : 'UsernamePasswordMultiBinding', |
| 283 | credentialsId : env.OS_CREDENTIALS, |
| 284 | passwordVariable: 'OS_PASSWORD', |
| 285 | usernameVariable: 'OS_USERNAME'] |
| 286 | ]) { |
| 287 | |
| 288 | |
| 289 | stage("Run the 'underlay' and 'salt-deployed' fixtures to bootstrap salt cluster") { |
| 290 | def xml_report_name = "deploy_salt.xml" |
| 291 | try { |
| 292 | // deploy_salt.xml |
| 293 | shared.run_sh("""\ |
| 294 | export ENV_NAME=${ENV_NAME} |
| 295 | export LAB_CONFIG_NAME=${LAB_CONFIG_NAME} |
| 296 | export LAB_PARAM_DEFAULTS=${LAB_PARAM_DEFAULTS} |
| 297 | export ENV_MANAGER=heat |
| 298 | export SHUTDOWN_ENV_ON_TEARDOWN=false |
| 299 | export BOOTSTRAP_TIMEOUT=3600 |
| 300 | export PYTHONIOENCODING=UTF-8 |
| 301 | export REPOSITORY_SUITE=${MCP_VERSION} |
| 302 | export UPDATE_VERSION=${UPDATE_VERSION} |
| 303 | export TEST_GROUP=test_bootstrap_salt |
| 304 | export LOG_NAME=swarm_test_bootstrap_salt.log |
| 305 | py.test -vvv -s -p no:django -p no:ipdb --junit-xml=${xml_report_name} -k \${TEST_GROUP} |
| 306 | """) |
| 307 | // Wait for jenkins to start and IO calm down |
| 308 | sleep(60) |
| 309 | |
| 310 | } catch (e) { |
| 311 | common.printMsg("Saltstack cluster deploy is failed", "purple") |
| 312 | if (fileExists(xml_report_name)) { |
| 313 | shared.download_logs("deploy_salt_${ENV_NAME}") |
| 314 | def String junit_report_xml = readFile(xml_report_name) |
| 315 | def String junit_report_xml_pretty = new XmlUtil().serialize(junit_report_xml) |
| 316 | throw new Exception(junit_report_xml_pretty) |
| 317 | } else { |
| 318 | throw e |
| 319 | } |
| 320 | } finally { |
| 321 | // TODO(ddmitriev): add checks for salt cluster |
| 322 | } |
| 323 | } // stage |
| 324 | } // withCredentials |
| 325 | } // dir |
| 326 | } // node |
| 327 | } // timestamps |
Dennis Dmitriev | 1f08b0c | 2019-05-27 17:03:53 +0300 | [diff] [blame] | 328 | } // timeout |