blob: 3da7c0480e14cf5ea44d8bd36b46b15cd4d19030 [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 {
Dennis Dmitrieveb50ce12018-09-27 13:34:32 +030034
35 if (env.TCP_QA_REFS) {
36 stage("Update working dir to patch ${TCP_QA_REFS}") {
37 shared.update_working_dir()
38 }
39 }
40
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +030041 def report_name = ''
42 def testSuiteName = ''
43 def methodname = ''
44 def testrail_name_template = ''
45 def reporter_extra_options = []
46
Dennis Dmitrievee5ef232018-08-31 13:53:18 +030047 stage("Archive all xml reports") {
48 archiveArtifacts artifacts: "**/*.xml"
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +030049 }
50
Dennis Dmitrievee5ef232018-08-31 13:53:18 +030051 def deployment_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"deployment_${ENV_NAME}.xml\"", returnStdout: true)
52 def tcpqa_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"nosetests.xml\"", returnStdout: true)
53 def tempest_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"report_*.xml\"", returnStdout: true)
54 def k8s_conformance_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"conformance_result.xml\"", returnStdout: true)
55 def stacklight_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"stacklight_report.xml\"", returnStdout: true)
56 common.printMsg(deployment_report_name ? "Found deployment report: ${deployment_report_name}" : "Deployment report not found", deployment_report_name ? "blue" : "red")
57 common.printMsg(tcpqa_report_name ? "Found tcp-qa report: ${tcpqa_report_name}" : "tcp-qa report not found", tcpqa_report_name ? "blue" : "red")
58 common.printMsg(tempest_report_name ? "Found tempest report: ${tempest_report_name}" : "tempest report not found", tempest_report_name ? "blue" : "red")
59 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")
60 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 +030061
Dennis Dmitrievee5ef232018-08-31 13:53:18 +030062
63 if (deployment_report_name) {
64 stage("Deployment report") {
65// report_name = "deployment_${ENV_NAME}.xml"
66 testSuiteName = "[MCP] Integration automation"
67 methodname = '{methodname}'
68 testrail_name_template = '{title}'
69 reporter_extra_options = [
70 "--testrail-add-missing-cases",
71 "--testrail-case-custom-fields {\\\"custom_qa_team\\\":\\\"9\\\"}",
72 "--testrail-case-section-name \'All\'",
73 ]
74 shared.upload_results_to_testrail(deployment_report_name, testSuiteName, methodname, testrail_name_template, reporter_extra_options)
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +030075 }
76 }
77
Dennis Dmitrievee5ef232018-08-31 13:53:18 +030078 if (tcpqa_report_name) {
79 stage("tcp-qa cases report") {
Dennis Dmitrieveb50ce12018-09-27 13:34:32 +030080 // tcpqa_report_name =~ "nosetests.xml"
Dennis Dmitrievee5ef232018-08-31 13:53:18 +030081 testSuiteName = "[MCP_X] integration cases"
82 methodname = "{methodname}"
83 testrail_name_template = "{title}"
84 reporter_extra_options = [
85 "--testrail-add-missing-cases",
86 "--testrail-case-custom-fields {\\\"custom_qa_team\\\":\\\"9\\\"}",
87 "--testrail-case-section-name \'All\'",
88 ]
89 shared.upload_results_to_testrail(tcpqa_report_name, testSuiteName, methodname, testrail_name_template, reporter_extra_options)
90 }
91 }
92
93 if ('openstack' in stacks && tempest_report_name) {
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +030094 stage("Tempest report") {
Dennis Dmitrieveb50ce12018-09-27 13:34:32 +030095 // tempest_report_name =~ "report_*.xml"
Dennis Dmitrievee5ef232018-08-31 13:53:18 +030096 testSuiteName = "[MCP1.1_PIKE]Tempest"
97 methodname = "{classname}.{methodname}"
98 testrail_name_template = "{title}"
99 shared.upload_results_to_testrail(tempest_report_name, testSuiteName, methodname, testrail_name_template)
100 }
101 }
102
103 if ('k8s' in stacks && k8s_conformance_report_name) {
104 stage("K8s conformance report") {
Dennis Dmitrieveb50ce12018-09-27 13:34:32 +0300105 // k8s_conformance_report_name =~ conformance_result.xml
106 // TODO(ddmitriev): it's better to get the k8s version right after deployment
107 // and store in some artifact that can be re-used here.
Dennis Dmitriev265a1c72018-09-29 05:08:47 +0300108 def k8s_version=shared.run_cmd_stdout("""\
Dennis Dmitrievcf866e72018-10-09 17:51:43 +0300109 . ./env_k8s_version;
110 echo "\$KUBE_SERVER_VERSION"
Dennis Dmitrieveb50ce12018-09-27 13:34:32 +0300111 """).trim().split().last()
112 testSuiteName = "[MCP][k8s]Hyperkube ${k8s_version}.x"
113 methodname = "{methodname}"
114 testrail_name_template = "{title}"
115 reporter_extra_options = [
Dennis Dmitriev74d7e752018-10-01 17:37:49 +0300116 "--send-duplicates",
Dennis Dmitrieveb50ce12018-09-27 13:34:32 +0300117 "--testrail-add-missing-cases",
118 "--testrail-case-custom-fields {\\\"custom_qa_team\\\":\\\"9\\\"}",
119 "--testrail-case-section-name \'Conformance\'",
120 ]
121 shared.upload_results_to_testrail(k8s_conformance_report_name, testSuiteName, methodname, testrail_name_template, reporter_extra_options)
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +0300122 }
123 }
124
Dennis Dmitrievee5ef232018-08-31 13:53:18 +0300125 if ('stacklight' in stacks && stacklight_report_name) {
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +0300126 stage("stacklight-pytest report") {
Dennis Dmitrieveb50ce12018-09-27 13:34:32 +0300127 // stacklight_report_name =~ "stacklight_report.xml"
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +0300128 testSuiteName = "LMA2.0_Automated"
129 methodname = "{methodname}"
130 testrail_name_template = "{title}"
Dennis Dmitrievee5ef232018-08-31 13:53:18 +0300131 shared.upload_results_to_testrail(stacklight_report_name, testSuiteName, methodname, testrail_name_template)
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +0300132 }
133 }
134
135 } catch (e) {
Dennis Dmitrieveb50ce12018-09-27 13:34:32 +0300136 common.printMsg("Job is failed", "red")
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +0300137 throw e
138 } finally {
139 // reporting is failed for some reason
140 }
141 }
142}