blob: d44ce6210dbcfcc1e9c80ff1d584e2315bec59a2 [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
46 dos.py time-sync ${ENV_NAME} || true
47 """)
48 } else {
49 shared.run_cmd("""\
50 dos.py destroy ${ENV_NAME} || true
51 """)
52 }
53 shared.report_deploy_result(steps)
54 shared.report_test_result()
55 }
56}