Dennis Dmitriev | fde667f | 2018-07-23 16:26:50 +0300 | [diff] [blame] | 1 | @Library('tcp-qa')_ |
| 2 | |
| 3 | def common = new com.mirantis.mk.Common() |
| 4 | def shared = new com.mirantis.system_qa.SharedPipeline() |
| 5 | def steps = "hardware,create_model,salt," + env.DRIVETRAIN_STACK_INSTALL + "," + env.PLATFORM_STACK_INSTALL |
| 6 | |
| 7 | node ("${NODE_NAME}") { |
| 8 | try { |
| 9 | |
| 10 | stage("Clean the environment and clone tcp-qa") { |
| 11 | shared.prepare_working_dir() |
| 12 | } |
| 13 | |
| 14 | stage("Create environment, generate model, bootstrap the salt-cluster") { |
| 15 | // steps: "hardware,create_model,salt" |
| 16 | shared.swarm_bootstrap_salt_cluster_devops() |
| 17 | } |
| 18 | |
| 19 | stage("Install core infrastructure and deploy CICD nodes") { |
| 20 | // steps: env.DRIVETRAIN_STACK_INSTALL |
| 21 | shared.swarm_deploy_cicd(env.DRIVETRAIN_STACK_INSTALL) |
| 22 | } |
| 23 | |
| 24 | stage("Install core infrastructure and deploy CICD nodes") { |
| 25 | // steps: env.PLATFORM_STACK_INSTALL |
| 26 | shared.swarm_deploy_platform(env.PLATFORM_STACK_INSTALL) |
| 27 | } |
| 28 | |
| 29 | stage("Run tests") { |
| 30 | shared.swarm_run_pytest(steps) |
| 31 | } |
| 32 | |
| 33 | } catch (e) { |
| 34 | common.printMsg("Job failed", "red") |
| 35 | shared.run_cmd("""\ |
| 36 | dos.py suspend ${ENV_NAME} || true |
| 37 | dos.py snapshot ${ENV_NAME} test_failed || true |
| 38 | """) |
| 39 | throw e |
| 40 | } finally { |
| 41 | // TODO(ddmitriev): analyze the "def currentResult = currentBuild.result ?: 'SUCCESS'" |
| 42 | // and report appropriate data to TestRail |
| 43 | if ("${env.SHUTDOWN_ENV_ON_TEARDOWN}" == "false") { |
| 44 | shared.run_cmd("""\ |
| 45 | dos.py resume ${ENV_NAME} || true |
Dennis Dmitriev | 1fed666 | 2018-07-27 18:22:13 +0300 | [diff] [blame] | 46 | sleep 20 # Wait for I/O on the host calms down |
Dennis Dmitriev | fde667f | 2018-07-23 16:26:50 +0300 | [diff] [blame] | 47 | dos.py time-sync ${ENV_NAME} || true |
| 48 | """) |
| 49 | } else { |
| 50 | shared.run_cmd("""\ |
| 51 | dos.py destroy ${ENV_NAME} || true |
| 52 | """) |
| 53 | } |
| 54 | shared.report_deploy_result(steps) |
| 55 | shared.report_test_result() |
| 56 | } |
| 57 | } |