blob: 2de799538cadc60aff8a917c9f5de951c547529e [file] [log] [blame]
Dennis Dmitrievfde667f2018-07-23 16:26:50 +03001@Library('tcp-qa')_
2
3def common = new com.mirantis.mk.Common()
4def shared = new com.mirantis.system_qa.SharedPipeline()
5def steps = "hardware,create_model,salt," + env.DRIVETRAIN_STACK_INSTALL + "," + env.PLATFORM_STACK_INSTALL
6
7node ("${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 Dmitriev1fed6662018-07-27 18:22:13 +030046 sleep 20 # Wait for I/O on the host calms down
Dennis Dmitrievfde667f2018-07-23 16:26:50 +030047 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}