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