blob: 2d2f993fd881990315279975c760db0710bfd5e2 [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
Tatyana Leontovichf3718442018-10-31 13:36:13 +020013 * TEMPEST_TEST_SUITE_NAME Name of tempest suite
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +030014 * TCP_QA_REFS Reference to the tcp-qa change on review.gerrithub.io, like refs/changes/46/418546/41
15 */
16
17@Library('tcp-qa')_
18
19def common = new com.mirantis.mk.Common()
20def shared = new com.mirantis.system_qa.SharedPipeline()
21def stacks = shared.get_steps_list(PASSED_STEPS)
22
23if (! env.PARENT_NODE_NAME) {
24 error "'PARENT_NODE_NAME' must be set from the parent deployment job!"
25}
26
27currentBuild.description = "${PARENT_NODE_NAME}:${ENV_NAME}"
28
29node ("${PARENT_NODE_NAME}") {
30 if (! fileExists("${PARENT_WORKSPACE}")) {
31 error "'PARENT_WORKSPACE' contains path to non-existing directory ${PARENT_WORKSPACE} on the node '${PARENT_NODE_NAME}'."
32 }
33 dir("${PARENT_WORKSPACE}") {
Dennis Dmitrievfbf42272018-10-23 00:19:50 +030034 def description = ''
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +030035 try {
Dennis Dmitrieveb50ce12018-09-27 13:34:32 +030036
37 if (env.TCP_QA_REFS) {
38 stage("Update working dir to patch ${TCP_QA_REFS}") {
39 shared.update_working_dir()
40 }
41 }
42
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +030043 def report_name = ''
44 def testSuiteName = ''
45 def methodname = ''
46 def testrail_name_template = ''
47 def reporter_extra_options = []
48
Dennis Dmitrievfbf42272018-10-23 00:19:50 +030049 def report_result = ''
50 def report_url = ''
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +030051
Dennis Dmitriev09ef69e2018-11-09 15:25:18 +020052 // deployment_report_name = "deployment_${ENV_NAME}.xml"
Dennis Dmitrievec7ae972019-02-19 12:29:11 +020053 def deployment_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"deployment_${ENV_NAME}.xml\" -printf \"'%p'\" ", returnStdout: true).trim()
Dennis Dmitriev09ef69e2018-11-09 15:25:18 +020054 // tcpqa_report_name =~ "nosetests.xml"
Dennis Dmitrievec7ae972019-02-19 12:29:11 +020055 def tcpqa_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"nosetests.xml\" -printf \"'%p'\" ", returnStdout: true).trim()
Dennis Dmitriev09ef69e2018-11-09 15:25:18 +020056 // tempest_report_name =~ "report_*.xml"
Dennis Dmitrievec7ae972019-02-19 12:29:11 +020057 def tempest_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"report_*.xml\" -printf \"'%p'\" ", returnStdout: true).trim()
Dennis Dmitriev09ef69e2018-11-09 15:25:18 +020058 // k8s_conformance_report_name =~ conformance_result.xml
Dennis Dmitrievec7ae972019-02-19 12:29:11 +020059 def k8s_conformance_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"conformance_result.xml\" -printf \"'%p'\" ", returnStdout: true).trim()
Dennis Dmitriev34fd3002018-11-15 18:25:16 +020060 // k8s_conformance_report_name =~ conformance_virtlet_result.xml
Dennis Dmitrievec7ae972019-02-19 12:29:11 +020061 def k8s_conformance_virtlet_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"conformance_virtlet_result.xml\" -printf \"'%p'\" ", returnStdout: true).trim()
Dennis Dmitriev09ef69e2018-11-09 15:25:18 +020062 // stacklight_report_name =~ "stacklight_report.xml" or "report.xml"
Dennis Dmitrievec7ae972019-02-19 12:29:11 +020063 def stacklight_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"*report.xml\"", returnStdout: true).trim()
Dennis Dmitriev8565c342019-02-11 23:45:03 +020064 // cvp_sanity_report_name =~ cvp_sanity_report.xml
Dennis Dmitrievec7ae972019-02-19 12:29:11 +020065 def cvp_sanity_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"cvp_sanity_results.xml\" -printf \"'%p'\" ", returnStdout: true).trim()
Dennis Dmitrievee5ef232018-08-31 13:53:18 +030066 common.printMsg(deployment_report_name ? "Found deployment report: ${deployment_report_name}" : "Deployment report not found", deployment_report_name ? "blue" : "red")
67 common.printMsg(tcpqa_report_name ? "Found tcp-qa report: ${tcpqa_report_name}" : "tcp-qa report not found", tcpqa_report_name ? "blue" : "red")
68 common.printMsg(tempest_report_name ? "Found tempest report: ${tempest_report_name}" : "tempest report not found", tempest_report_name ? "blue" : "red")
69 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")
Dennis Dmitriev34fd3002018-11-15 18:25:16 +020070 common.printMsg(k8s_conformance_virtlet_report_name ? "Found k8s conformance virtlet report: ${k8s_conformance_virtlet_report_name}" : "k8s conformance virtlet report not found", k8s_conformance_virtlet_report_name ? "blue" : "red")
Dennis Dmitrievee5ef232018-08-31 13:53:18 +030071 common.printMsg(stacklight_report_name ? "Found stacklight-pytest report: ${stacklight_report_name}" : "stacklight-pytest report not found", stacklight_report_name ? "blue" : "red")
Dennis Dmitriev8565c342019-02-11 23:45:03 +020072 common.printMsg(cvp_sanity_report_name ? "Found CVP Sanity report: ${cvp_sanity_report_name}" : "CVP Sanity report not found", cvp_sanity_report_name ? "blue" : "red")
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +030073
Dennis Dmitrievee5ef232018-08-31 13:53:18 +030074
75 if (deployment_report_name) {
76 stage("Deployment report") {
Dennis Dmitrievee5ef232018-08-31 13:53:18 +030077 testSuiteName = "[MCP] Integration automation"
78 methodname = '{methodname}'
79 testrail_name_template = '{title}'
80 reporter_extra_options = [
81 "--testrail-add-missing-cases",
82 "--testrail-case-custom-fields {\\\"custom_qa_team\\\":\\\"9\\\"}",
83 "--testrail-case-section-name \'All\'",
84 ]
Dennis Dmitrievaf59f7e2019-04-02 11:54:06 +000085 report_result = shared.upload_results_to_testrail(deployment_report_name, testSuiteName, methodname, testrail_name_template, reporter_extra_options)
Dennis Dmitrievfbf42272018-10-23 00:19:50 +030086 common.printMsg(report_result, "blue")
87 report_url = report_result.split("\n").each {
88 if (it.contains("[TestRun URL]")) {
89 common.printMsg("Found report URL: " + it.trim().split().last(), "blue")
Dennis Dmitriev27007322019-05-03 19:21:44 +030090 description += "<a href=" + it.trim().split().last() + ">${testSuiteName}</a><br>"
Dennis Dmitrievfbf42272018-10-23 00:19:50 +030091 }
92 }
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +030093 }
94 }
95
Dennis Dmitrievee5ef232018-08-31 13:53:18 +030096 if (tcpqa_report_name) {
97 stage("tcp-qa cases report") {
Dennis Dmitrievee5ef232018-08-31 13:53:18 +030098 testSuiteName = "[MCP_X] integration cases"
99 methodname = "{methodname}"
100 testrail_name_template = "{title}"
101 reporter_extra_options = [
102 "--testrail-add-missing-cases",
103 "--testrail-case-custom-fields {\\\"custom_qa_team\\\":\\\"9\\\"}",
104 "--testrail-case-section-name \'All\'",
105 ]
Dennis Dmitrievaf59f7e2019-04-02 11:54:06 +0000106 report_result = shared.upload_results_to_testrail(tcpqa_report_name, testSuiteName, methodname, testrail_name_template, reporter_extra_options)
Dennis Dmitrievfbf42272018-10-23 00:19:50 +0300107 common.printMsg(report_result, "blue")
108 report_url = report_result.split("\n").each {
109 if (it.contains("[TestRun URL]")) {
110 common.printMsg("Found report URL: " + it.trim().split().last(), "blue")
Dennis Dmitriev27007322019-05-03 19:21:44 +0300111 description += "<a href=" + it.trim().split().last() + ">${testSuiteName}</a><br>"
Dennis Dmitrievfbf42272018-10-23 00:19:50 +0300112 }
113 }
Dennis Dmitrievee5ef232018-08-31 13:53:18 +0300114 }
115 }
116
117 if ('openstack' in stacks && tempest_report_name) {
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +0300118 stage("Tempest report") {
Tatyana Leontovichf3718442018-10-31 13:36:13 +0200119 testSuiteName = env.TEMPEST_TEST_SUITE_NAME
Dennis Dmitrievee5ef232018-08-31 13:53:18 +0300120 methodname = "{classname}.{methodname}"
121 testrail_name_template = "{title}"
Dennis Dmitrievaf59f7e2019-04-02 11:54:06 +0000122 report_result = shared.upload_results_to_testrail(tempest_report_name, testSuiteName, methodname, testrail_name_template)
Dennis Dmitrievfbf42272018-10-23 00:19:50 +0300123 common.printMsg(report_result, "blue")
124 report_url = report_result.split("\n").each {
125 if (it.contains("[TestRun URL]")) {
126 common.printMsg("Found report URL: " + it.trim().split().last(), "blue")
Dennis Dmitriev27007322019-05-03 19:21:44 +0300127 description += "<a href=" + it.trim().split().last() + ">${testSuiteName}</a><br>"
Dennis Dmitrievfbf42272018-10-23 00:19:50 +0300128 }
129 }
Dennis Dmitrievee5ef232018-08-31 13:53:18 +0300130 }
131 }
132
133 if ('k8s' in stacks && k8s_conformance_report_name) {
134 stage("K8s conformance report") {
Dennis Dmitriev265a1c72018-09-29 05:08:47 +0300135 def k8s_version=shared.run_cmd_stdout("""\
Dennis Dmitrievcf866e72018-10-09 17:51:43 +0300136 . ./env_k8s_version;
137 echo "\$KUBE_SERVER_VERSION"
Dennis Dmitrieveb50ce12018-09-27 13:34:32 +0300138 """).trim().split().last()
139 testSuiteName = "[MCP][k8s]Hyperkube ${k8s_version}.x"
140 methodname = "{methodname}"
141 testrail_name_template = "{title}"
142 reporter_extra_options = [
Dennis Dmitriev74d7e752018-10-01 17:37:49 +0300143 "--send-duplicates",
Dennis Dmitrieveb50ce12018-09-27 13:34:32 +0300144 "--testrail-add-missing-cases",
145 "--testrail-case-custom-fields {\\\"custom_qa_team\\\":\\\"9\\\"}",
146 "--testrail-case-section-name \'Conformance\'",
147 ]
Dennis Dmitrievaf59f7e2019-04-02 11:54:06 +0000148 report_result = shared.upload_results_to_testrail(k8s_conformance_report_name, testSuiteName, methodname, testrail_name_template, reporter_extra_options)
Dennis Dmitrievfbf42272018-10-23 00:19:50 +0300149 common.printMsg(report_result, "blue")
150 report_url = report_result.split("\n").each {
151 if (it.contains("[TestRun URL]")) {
152 common.printMsg("Found report URL: " + it.trim().split().last(), "blue")
Dennis Dmitriev27007322019-05-03 19:21:44 +0300153 description += "<a href=" + it.trim().split().last() + ">${testSuiteName}</a><br>"
Dennis Dmitrievfbf42272018-10-23 00:19:50 +0300154 }
155 }
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +0300156 }
157 }
158
Dennis Dmitriev34fd3002018-11-15 18:25:16 +0200159 if ('k8s' in stacks && k8s_conformance_virtlet_report_name) {
160 stage("K8s conformance virtlet report") {
161 testSuiteName = "[k8s] Virtlet"
162 methodname = "{methodname}"
163 testrail_name_template = "{title}"
164 reporter_extra_options = [
165 "--send-duplicates",
166 "--testrail-add-missing-cases",
167 "--testrail-case-custom-fields {\\\"custom_qa_team\\\":\\\"9\\\"}",
168 "--testrail-case-section-name \'Conformance\'",
169 ]
Dennis Dmitrievaf59f7e2019-04-02 11:54:06 +0000170 report_result = shared.upload_results_to_testrail(k8s_conformance_virtlet_report_name, testSuiteName, methodname, testrail_name_template, reporter_extra_options)
Dennis Dmitriev34fd3002018-11-15 18:25:16 +0200171 common.printMsg(report_result, "blue")
172 report_url = report_result.split("\n").each {
173 if (it.contains("[TestRun URL]")) {
174 common.printMsg("Found report URL: " + it.trim().split().last(), "blue")
Dennis Dmitriev27007322019-05-03 19:21:44 +0300175 description += "<a href=" + it.trim().split().last() + ">${testSuiteName}</a><br>"
Dennis Dmitriev34fd3002018-11-15 18:25:16 +0200176 }
177 }
178 }
179 }
180
Dennis Dmitrievee5ef232018-08-31 13:53:18 +0300181 if ('stacklight' in stacks && stacklight_report_name) {
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +0300182 stage("stacklight-pytest report") {
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +0300183 testSuiteName = "LMA2.0_Automated"
184 methodname = "{methodname}"
185 testrail_name_template = "{title}"
Dennis Dmitrievaf59f7e2019-04-02 11:54:06 +0000186 report_result = shared.upload_results_to_testrail(stacklight_report_name, testSuiteName, methodname, testrail_name_template)
Dennis Dmitrievfbf42272018-10-23 00:19:50 +0300187 common.printMsg(report_result, "blue")
188 report_url = report_result.split("\n").each {
189 if (it.contains("[TestRun URL]")) {
190 common.printMsg("Found report URL: " + it.trim().split().last(), "blue")
Dennis Dmitriev27007322019-05-03 19:21:44 +0300191 description += "<a href=" + it.trim().split().last() + ">${testSuiteName}</a><br>"
Dennis Dmitrievfbf42272018-10-23 00:19:50 +0300192 }
193 }
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +0300194 }
195 }
196
Dennis Dmitriev8565c342019-02-11 23:45:03 +0200197 if ('cicd' in stacks && cvp_sanity_report_name) {
198 stage("CVP Sanity report") {
199 testSuiteName = "[MCP] cvp sanity"
200 methodname = '{methodname}'
201 testrail_name_template = '{title}'
202 reporter_extra_options = [
203 "--send-duplicates",
204 "--testrail-add-missing-cases",
205 "--testrail-case-custom-fields {\\\"custom_qa_team\\\":\\\"9\\\"}",
206 "--testrail-case-section-name \'All\'",
207 ]
Dennis Dmitrievaf59f7e2019-04-02 11:54:06 +0000208 report_result = shared.upload_results_to_testrail(cvp_sanity_report_name, testSuiteName, methodname, testrail_name_template, reporter_extra_options)
Dennis Dmitriev8565c342019-02-11 23:45:03 +0200209 common.printMsg(report_result, "blue")
210 report_url = report_result.split("\n").each {
211 if (it.contains("[TestRun URL]")) {
212 common.printMsg("Found report URL: " + it.trim().split().last(), "blue")
Dennis Dmitriev27007322019-05-03 19:21:44 +0300213 description += "<a href=" + it.trim().split().last() + ">${testSuiteName}</a><br>"
Dennis Dmitriev8565c342019-02-11 23:45:03 +0200214 }
215 }
216 }
217 }
218
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +0300219 } catch (e) {
Dennis Dmitrievb08c0772018-10-17 15:10:26 +0300220 common.printMsg("Job is failed", "purple")
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +0300221 throw e
222 } finally {
223 // reporting is failed for some reason
Dennis Dmitrievfbf42272018-10-23 00:19:50 +0300224 writeFile(file: "description.txt", text: description, encoding: "UTF-8")
Dennis Dmitrieve4b831b2018-08-15 17:16:10 +0300225 }
226 }
227}