blob: 83335a9d279d8f97e7c1a349558976bc08cc64e7 [file] [log] [blame]
Dennis Dmitrievb3b37492018-07-08 21:23:00 +03001@Library('tcp-qa')_
2
Dennis Dmitriev0f624a82018-06-11 12:57:13 +03003common = new com.mirantis.mk.Common()
Dennis Dmitrievb3b37492018-07-08 21:23:00 +03004shared = new com.mirantis.system_qa.SharedPipeline()
Dennis Dmitriev0f624a82018-06-11 12:57:13 +03005
6node ("${NODE_NAME}") {
7 try {
8
Dennis Dmitrievb3b37492018-07-08 21:23:00 +03009 stage("Clean the environment and clone tcp-qa") {
10 shared.prepare_working_dir()
Dennis Dmitriev0f624a82018-06-11 12:57:13 +030011 }
12
Dennis Dmitrievb3b37492018-07-08 21:23:00 +030013 stage("Create environment, generate mode, bootstrap the salt-cluster") {
14 shared.swarm_bootstrap_salt_cluster_devops()
Dennis Dmitriev0f624a82018-06-11 12:57:13 +030015 }
16
17 // Install core and cicd
18 stage("Run Jenkins job on salt-master [deploy_openstack:core]") {
19 shared.run_job_on_day01_node("core")
20 }
21
22 stage("Run Jenkins job on salt-master [deploy_openstack:cicd]") {
23 shared.run_job_on_day01_node("cicd")
24 }
25
26 // Install the cluster
Dennis Dmitrievb3b37492018-07-08 21:23:00 +030027 for (stack in "${PLATFORM_STACK_INSTALL}".split(",")) {
Dennis Dmitriev0f624a82018-06-11 12:57:13 +030028 stage("Run Jenkins job on CICD [deploy_openstack:${stack}]") {
29 shared.run_job_on_cicd_nodes(stack)
30 }
31 }
32
33 stage("Run tests") {
Dennis Dmitrievb3b37492018-07-08 21:23:00 +030034 shared.run_cmd("""\
Dennis Dmitriev0f624a82018-06-11 12:57:13 +030035 export ENV_NAME=${ENV_NAME}
36 . ./tcp_tests/utils/env_salt
37 . ./tcp_tests/utils/env_k8s
38
39 # Initialize variables used in tcp-qa tests
40 export CURRENT_SNAPSHOT=k8s_deployed # provide the snapshot name required by the test
41 export TESTS_CONFIGS=\$(pwd)/${ENV_NAME}_salt_deployed.ini # some SSH data may be filled separatelly
42
43 export MANAGER=empty # skip 'hardware' fixture, disable snapshot/revert features
44 # export SSH='{...}' # non-empty SSH required to skip 'underlay' fixture. It is filled from TESTS_CONFIGS now
45 export salt_master_host=\$SALT_MASTER_IP # skip salt_deployed fixture
46 export salt_master_port=6969
47 export SALT_USER=\$SALTAPI_USER
48 export SALT_PASSWORD=\$SALTAPI_PASS
Dennis Dmitrievea48cf52018-07-18 18:04:39 +030049 export CORE_INSTALLED=true # skip core_deployed fixture
Dennis Dmitriev0f624a82018-06-11 12:57:13 +030050 export K8S_INSTALLED=true # skip k8s_deployed fixture
51
52 py.test -vvv -s -p no:django -p no:ipdb --junit-xml=nosetests.xml -m k8s_calico
53 """)
54 }
55
56 } catch (e) {
57 common.printMsg("Job failed", "red")
58 throw e
59 } finally {
60 // TODO(ddmitriev): analyze the "def currentResult = currentBuild.result ?: 'SUCCESS'"
61 // and report appropriate data to TestRail
Dennis Dmitrievb3b37492018-07-08 21:23:00 +030062 shared.run_cmd("""\
Dennis Dmitriev0f624a82018-06-11 12:57:13 +030063 dos.py destroy ${ENV_NAME}
64 """)
65 }
66
67}