blob: 585ad8317ac2d553990b84aad31f7dc6147064f6 [file] [log] [blame]
Dennis Dmitrievb3b37492018-07-08 21:23:00 +03001@Library('tcp-qa')_
2
3common = new com.mirantis.mk.Common()
4shared = new com.mirantis.system_qa.SharedPipeline()
5
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 shared.swarm_bootstrap_salt_cluster_devops()
16 }
17
18 stage("Install core infrastructure and deploy CICD nodes") {
19 shared.swarm_deploy_cicd(env.DRIVETRAIN_STACK_INSTALL)
20 }
21
22 stage("Install core infrastructure and deploy CICD nodes") {
23 shared.swarm_deploy_platform(env.PLATFORM_STACK_INSTALL)
24 }
25
26 stage("Run tests") {
27 shared.run_cmd("""\
28 export ENV_NAME=${ENV_NAME}
29 . ./tcp_tests/utils/env_salt
30 # TODO: . ./tcp_tests/utils/env_keystonercv3
31
32 # Prepare snapshots that may be used in tests if MANAGER=devops
33 cp \$(pwd)/${ENV_NAME}_salt_deployed.ini \$(pwd)/${ENV_NAME}_openstack_deployed.ini
Dennis Dmitrievea48cf52018-07-18 18:04:39 +030034 cp \$(pwd)/${ENV_NAME}_salt_deployed.ini \$(pwd)/${ENV_NAME}_stacklight_deployed.ini
Dennis Dmitrievb3b37492018-07-08 21:23:00 +030035 cp \$(pwd)/${ENV_NAME}_salt_deployed.ini \$(pwd)/${ENV_NAME}_sl_os_deployed.ini
36 #dos.py suspend ${ENV_NAME}
37 #dos.py snapshot ${ENV_NAME} openstack_deployed
Dennis Dmitrievea48cf52018-07-18 18:04:39 +030038 #dos.py snapshot ${ENV_NAME} stacklight_deployed
Dennis Dmitrievb3b37492018-07-08 21:23:00 +030039 #dos.py snapshot ${ENV_NAME} sl_os_deployed
40 #dos.py resume ${ENV_NAME}
41 #dos.py time-sync ${ENV_NAME}
42
43 # Initialize variables used in tcp-qa tests
Dennis Dmitrievea48cf52018-07-18 18:04:39 +030044 export CURRENT_SNAPSHOT=stacklight_deployed # provide the snapshot name required by the test
Dennis Dmitrievb3b37492018-07-08 21:23:00 +030045 export TESTS_CONFIGS=\$(pwd)/${ENV_NAME}_salt_deployed.ini # some SSH data may be filled separatelly
46
47 #export MANAGER=empty # skip 'hardware' fixture, disable snapshot/revert features
48 export MANAGER=devops # use 'hardware' fixture to manage fuel-devops environment
49 export MAKE_SNAPSHOT_STAGES=false # skip 'hardware' fixture, disable snapshot/revert features
50 # export SSH='{...}' # non-empty SSH required to skip 'underlay' fixture. It is filled from TESTS_CONFIGS now
51 export salt_master_host=\$SALT_MASTER_IP # skip salt_deployed fixture
52 export salt_master_port=6969
53 export SALT_USER=\$SALTAPI_USER
54 export SALT_PASSWORD=\$SALTAPI_PASS
Dennis Dmitrievea48cf52018-07-18 18:04:39 +030055 export CORE_INSTALLED=true # skip core_deployed fixture
Dennis Dmitrievb3b37492018-07-08 21:23:00 +030056 export OPENSTACK_INSTALLED=true # skip k8s_deployed fixture
Dennis Dmitrievea48cf52018-07-18 18:04:39 +030057 export sl_installed=true # skip stacklight_deployed fixture
Dennis Dmitrievb3b37492018-07-08 21:23:00 +030058
59 py.test --junit-xml=nosetests.xml ${RUN_TEST_OPTS}
60
61 dos.py suspend ${ENV_NAME}
62 dos.py snapshot ${ENV_NAME} test_completed
63 """)
64 }
65
66 } catch (e) {
67 common.printMsg("Job failed", "red")
68 shared.run_cmd("""\
69 dos.py suspend ${ENV_NAME} || true
70 dos.py snapshot ${ENV_NAME} test_failed || true
71 """)
72 throw e
73 } finally {
74 // TODO(ddmitriev): analyze the "def currentResult = currentBuild.result ?: 'SUCCESS'"
75 // and report appropriate data to TestRail
76 if ("${env.SHUTDOWN_ENV_ON_TEARDOWN}" == "true") {
77 shared.run_cmd("""\
78 dos.py destroy ${ENV_NAME} || true
79 """)
80 } else {
81 shared.run_cmd("""\
82 dos.py resume ${ENV_NAME} || true
83 dos.py time-sync ${ENV_NAME} || true
84 """)
85 }
86 shared.report_deploy_result("hardware,create_model,salt," + env.DRIVETRAIN_STACK_INSTALL + "," + env.PLATFORM_STACK_INSTALL)
87 shared.report_test_result()
88 }
89}