blob: 333547a02e1a483e344ae5efc9e084f617e0dc7f [file] [log] [blame]
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +03001/**
2 *
3 * Deploy the product cluster using Jenkins master on CICD cluster
4 *
5 * Expected parameters:
6
7 * ENV_NAME Fuel-devops environment name
8 * MCP_VERSION MCP version, like 2018.4 or proposed
9 * PASSED_STEPS Steps passed to install components using Jenkins on CICD cluster: "salt,core,cicd,openstack:3200,stacklight:2400",
10 where 3200 and 2400 might be timeouts (not used in the testing pipeline)
11 * PARENT_NODE_NAME Name of the jenkins slave to create the environment
12 * PARENT_WORKSPACE Path to the workspace of the parent job to use tcp-qa repo
13 * TCP_QA_REFS Reference to the tcp-qa change on review.gerrithub.io, like refs/changes/46/418546/41
14 */
15
16@Library('tcp-qa')_
17
18def common = new com.mirantis.mk.Common()
19def shared = new com.mirantis.system_qa.SharedPipeline()
20def stacks = shared.get_steps_list(PASSED_STEPS)
21
22if (! env.PARENT_NODE_NAME) {
23 error "'PARENT_NODE_NAME' must be set from the parent deployment job!"
24}
25
26currentBuild.description = "${PARENT_NODE_NAME}:${ENV_NAME}"
27
28node ("${PARENT_NODE_NAME}") {
29 if (! fileExists("${PARENT_WORKSPACE}")) {
30 error "'PARENT_WORKSPACE' contains path to non-existing directory ${PARENT_WORKSPACE} on the node '${PARENT_NODE_NAME}'."
31 }
32 dir("${PARENT_WORKSPACE}") {
33 try {
34 def report_name = ''
35 def testSuiteName = ''
36 def methodname = ''
37 def testrail_name_template = ''
38 def reporter_extra_options = []
39
Dennis Dmitrievee5ef232018-08-31 13:53:18 +030040 stage("Archive all xml reports") {
41 archiveArtifacts artifacts: "**/*.xml"
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +030042 }
43
Dennis Dmitrievee5ef232018-08-31 13:53:18 +030044 def deployment_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"deployment_${ENV_NAME}.xml\"", returnStdout: true)
45 def tcpqa_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"nosetests.xml\"", returnStdout: true)
46 def tempest_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"report_*.xml\"", returnStdout: true)
47 def k8s_conformance_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"conformance_result.xml\"", returnStdout: true)
48 def stacklight_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"stacklight_report.xml\"", returnStdout: true)
49 common.printMsg(deployment_report_name ? "Found deployment report: ${deployment_report_name}" : "Deployment report not found", deployment_report_name ? "blue" : "red")
50 common.printMsg(tcpqa_report_name ? "Found tcp-qa report: ${tcpqa_report_name}" : "tcp-qa report not found", tcpqa_report_name ? "blue" : "red")
51 common.printMsg(tempest_report_name ? "Found tempest report: ${tempest_report_name}" : "tempest report not found", tempest_report_name ? "blue" : "red")
52 common.printMsg(k8s_conformance_report_name ? "Found k8s conformance report: ${k8s_conformance_report_name}" : "k8s conformance report not found", k8s_conformance_report_name ? "blue" : "red")
53 common.printMsg(stacklight_report_name ? "Found stacklight-pytest report: ${stacklight_report_name}" : "stacklight-pytest report not found", stacklight_report_name ? "blue" : "red")
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +030054
Dennis Dmitrievee5ef232018-08-31 13:53:18 +030055
56 if (deployment_report_name) {
57 stage("Deployment report") {
58// report_name = "deployment_${ENV_NAME}.xml"
59 testSuiteName = "[MCP] Integration automation"
60 methodname = '{methodname}'
61 testrail_name_template = '{title}'
62 reporter_extra_options = [
63 "--testrail-add-missing-cases",
64 "--testrail-case-custom-fields {\\\"custom_qa_team\\\":\\\"9\\\"}",
65 "--testrail-case-section-name \'All\'",
66 ]
67 shared.upload_results_to_testrail(deployment_report_name, testSuiteName, methodname, testrail_name_template, reporter_extra_options)
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +030068 }
69 }
70
Dennis Dmitrievee5ef232018-08-31 13:53:18 +030071 if (tcpqa_report_name) {
72 stage("tcp-qa cases report") {
73// report_name = "nosetests.xml"
74 testSuiteName = "[MCP_X] integration cases"
75 methodname = "{methodname}"
76 testrail_name_template = "{title}"
77 reporter_extra_options = [
78 "--testrail-add-missing-cases",
79 "--testrail-case-custom-fields {\\\"custom_qa_team\\\":\\\"9\\\"}",
80 "--testrail-case-section-name \'All\'",
81 ]
82 shared.upload_results_to_testrail(tcpqa_report_name, testSuiteName, methodname, testrail_name_template, reporter_extra_options)
83 }
84 }
85
86 if ('openstack' in stacks && tempest_report_name) {
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +030087 stage("Tempest report") {
Dennis Dmitrievee5ef232018-08-31 13:53:18 +030088// report_name = "report_*.xml"
89 testSuiteName = "[MCP1.1_PIKE]Tempest"
90 methodname = "{classname}.{methodname}"
91 testrail_name_template = "{title}"
92 shared.upload_results_to_testrail(tempest_report_name, testSuiteName, methodname, testrail_name_template)
93 }
94 }
95
96 if ('k8s' in stacks && k8s_conformance_report_name) {
97 stage("K8s conformance report") {
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +030098 println "TBD"
99 // K8s conformance report
100 }
101 }
102
Dennis Dmitrievee5ef232018-08-31 13:53:18 +0300103 if ('stacklight' in stacks && stacklight_report_name) {
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +0300104 stage("stacklight-pytest report") {
Dennis Dmitrievee5ef232018-08-31 13:53:18 +0300105// report_name = "stacklight_report.xml"
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +0300106 testSuiteName = "LMA2.0_Automated"
107 methodname = "{methodname}"
108 testrail_name_template = "{title}"
Dennis Dmitrievee5ef232018-08-31 13:53:18 +0300109 shared.upload_results_to_testrail(stacklight_report_name, testSuiteName, methodname, testrail_name_template)
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +0300110 }
111 }
112
113 } catch (e) {
114 common.printMsg("Job is failed: " + e.message, "red")
115 throw e
116 } finally {
117 // reporting is failed for some reason
118 }
119 }
120}