Dennis Dmitriev | b3b3749 | 2018-07-08 21:23:00 +0300 | [diff] [blame] | 1 | @Library('tcp-qa')_ |
| 2 | |
Dennis Dmitriev | 0f624a8 | 2018-06-11 12:57:13 +0300 | [diff] [blame] | 3 | common = new com.mirantis.mk.Common() |
Dennis Dmitriev | b3b3749 | 2018-07-08 21:23:00 +0300 | [diff] [blame] | 4 | shared = new com.mirantis.system_qa.SharedPipeline() |
Dennis Dmitriev | 0f624a8 | 2018-06-11 12:57:13 +0300 | [diff] [blame] | 5 | |
| 6 | node ("${NODE_NAME}") { |
| 7 | try { |
| 8 | |
Dennis Dmitriev | b3b3749 | 2018-07-08 21:23:00 +0300 | [diff] [blame] | 9 | stage("Clean the environment and clone tcp-qa") { |
| 10 | shared.prepare_working_dir() |
Dennis Dmitriev | 0f624a8 | 2018-06-11 12:57:13 +0300 | [diff] [blame] | 11 | } |
| 12 | |
Dennis Dmitriev | b3b3749 | 2018-07-08 21:23:00 +0300 | [diff] [blame] | 13 | stage("Create environment, generate mode, bootstrap the salt-cluster") { |
| 14 | shared.swarm_bootstrap_salt_cluster_devops() |
Dennis Dmitriev | 0f624a8 | 2018-06-11 12:57:13 +0300 | [diff] [blame] | 15 | } |
| 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 Dmitriev | b3b3749 | 2018-07-08 21:23:00 +0300 | [diff] [blame] | 27 | for (stack in "${PLATFORM_STACK_INSTALL}".split(",")) { |
Dennis Dmitriev | 0f624a8 | 2018-06-11 12:57:13 +0300 | [diff] [blame] | 28 | 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 Dmitriev | b3b3749 | 2018-07-08 21:23:00 +0300 | [diff] [blame] | 34 | shared.run_cmd("""\ |
Dennis Dmitriev | 0f624a8 | 2018-06-11 12:57:13 +0300 | [diff] [blame] | 35 | 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 |
Dennis Dmitriev | ea48cf5 | 2018-07-18 18:04:39 +0300 | [diff] [blame] | 40 | export CURRENT_SNAPSHOT=stacklight_deployed # provide the snapshot name required by the test |
Dennis Dmitriev | 0f624a8 | 2018-06-11 12:57:13 +0300 | [diff] [blame] | 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 Dmitriev | ea48cf5 | 2018-07-18 18:04:39 +0300 | [diff] [blame] | 49 | export CORE_INSTALLED=true # skip core_deployed fixture |
Dennis Dmitriev | 0f624a8 | 2018-06-11 12:57:13 +0300 | [diff] [blame] | 50 | export K8S_INSTALLED=true # skip k8s_deployed fixture |
Dennis Dmitriev | ea48cf5 | 2018-07-18 18:04:39 +0300 | [diff] [blame] | 51 | export sl_installed=true # skip stacklight_deployed fixture |
Dennis Dmitriev | 0f624a8 | 2018-06-11 12:57:13 +0300 | [diff] [blame] | 52 | |
| 53 | py.test -vvv -s -p no:django -p no:ipdb --junit-xml=nosetests.xml -m k8s_calico_sl |
| 54 | |
| 55 | #dos.py suspend ${ENV_NAME} |
| 56 | #dos.py snapshot ${ENV_NAME} test_completed |
| 57 | #dos.py resume ${ENV_NAME} |
| 58 | #dos.py time-sync ${ENV_NAME} |
| 59 | """) |
| 60 | } |
| 61 | |
| 62 | } catch (e) { |
| 63 | common.printMsg("Job failed", "red") |
| 64 | throw e |
| 65 | } finally { |
| 66 | // TODO(ddmitriev): analyze the "def currentResult = currentBuild.result ?: 'SUCCESS'" |
| 67 | // and report appropriate data to TestRail |
Dennis Dmitriev | b3b3749 | 2018-07-08 21:23:00 +0300 | [diff] [blame] | 68 | shared.run_cmd("""\ |
Dennis Dmitriev | 0f624a8 | 2018-06-11 12:57:13 +0300 | [diff] [blame] | 69 | dos.py destroy ${ENV_NAME} |
| 70 | """) |
| 71 | } |
| 72 | } |