Merge "Fix cookiecutter branch mapping"
diff --git a/jobs/pipelines/deploy-cicd-and-run-tests.groovy b/jobs/pipelines/deploy-cicd-and-run-tests.groovy
index 0434b19..380d46a 100644
--- a/jobs/pipelines/deploy-cicd-and-run-tests.groovy
+++ b/jobs/pipelines/deploy-cicd-and-run-tests.groovy
@@ -98,7 +98,9 @@
archiveArtifacts artifacts: "**/*.xml,**/*.ini,**/*.log,**/*.tar.gz"
}
stage("report results to testrail") {
- shared.swarm_testrail_report(steps)
+ if (env.REPORT_TO_TESTRAIL ?: true) {
+ shared.swarm_testrail_report(steps)
+ }
}
stage("Store TestRail reports to job description") {
def String description = readFile("description.txt")
diff --git a/jobs/pipelines/swarm-testrail-report.groovy b/jobs/pipelines/swarm-testrail-report.groovy
index 42be763..1dfd597 100644
--- a/jobs/pipelines/swarm-testrail-report.groovy
+++ b/jobs/pipelines/swarm-testrail-report.groovy
@@ -12,6 +12,7 @@
* PARENT_WORKSPACE Path to the workspace of the parent job to use tcp-qa repo
* TEMPEST_TEST_SUITE_NAME Name of tempest suite
* TCP_QA_REFS Reference to the tcp-qa change on review.gerrithub.io, like refs/changes/46/418546/41
+ * TEST_PLAN_NAME_PREFIX Prefix of test plan name
*/
@Library('tcp-qa')_
@@ -41,6 +42,7 @@
}
def report_name = ''
+ def testPlanNamePrefix = env.TEST_PLAN_NAME_PREFIX ?: ''
def testSuiteName = ''
def methodname = ''
def testrail_name_template = ''
@@ -82,7 +84,9 @@
"--testrail-case-custom-fields {\\\"custom_qa_team\\\":\\\"9\\\"}",
"--testrail-case-section-name \'All\'",
]
- report_result = shared.upload_results_to_testrail(deployment_report_name, testSuiteName, methodname, testrail_name_template, reporter_extra_options)
+ report_result = shared.upload_results_to_testrail(
+ deployment_report_name, testSuiteName, methodname, testrail_name_template,
+ reporter_extra_options, testPlanNamePrefix=testPlanNamePrefix)
common.printMsg(report_result, "blue")
report_url = report_result.split("\n").each {
if (it.contains("[TestRun URL]")) {
@@ -103,7 +107,9 @@
"--testrail-case-custom-fields {\\\"custom_qa_team\\\":\\\"9\\\"}",
"--testrail-case-section-name \'All\'",
]
- report_result = shared.upload_results_to_testrail(tcpqa_report_name, testSuiteName, methodname, testrail_name_template, reporter_extra_options)
+ report_result = shared.upload_results_to_testrail(
+ tcpqa_report_name, testSuiteName, methodname, testrail_name_template,
+ reporter_extra_options, testPlanNamePrefix=testPlanNamePrefix)
common.printMsg(report_result, "blue")
report_url = report_result.split("\n").each {
if (it.contains("[TestRun URL]")) {
@@ -119,7 +125,9 @@
testSuiteName = env.TEMPEST_TEST_SUITE_NAME
methodname = "{classname}.{methodname}"
testrail_name_template = "{title}"
- report_result = shared.upload_results_to_testrail(tempest_report_name, testSuiteName, methodname, testrail_name_template)
+ report_result = shared.upload_results_to_testrail(
+ tempest_report_name, testSuiteName, methodname, testrail_name_template,
+ testPlanNamePrefix=testPlanNamePrefix)
common.printMsg(report_result, "blue")
report_url = report_result.split("\n").each {
if (it.contains("[TestRun URL]")) {
@@ -145,7 +153,9 @@
"--testrail-case-custom-fields {\\\"custom_qa_team\\\":\\\"9\\\"}",
"--testrail-case-section-name \'Conformance\'",
]
- report_result = shared.upload_results_to_testrail(k8s_conformance_report_name, testSuiteName, methodname, testrail_name_template, reporter_extra_options)
+ report_result = shared.upload_results_to_testrail(
+ k8s_conformance_report_name, testSuiteName, methodname, testrail_name_template,
+ reporter_extra_options, testPlanNamePrefix=testPlanNamePrefix)
common.printMsg(report_result, "blue")
report_url = report_result.split("\n").each {
if (it.contains("[TestRun URL]")) {
@@ -167,7 +177,9 @@
"--testrail-case-custom-fields {\\\"custom_qa_team\\\":\\\"9\\\"}",
"--testrail-case-section-name \'Conformance\'",
]
- report_result = shared.upload_results_to_testrail(k8s_conformance_virtlet_report_name, testSuiteName, methodname, testrail_name_template, reporter_extra_options)
+ report_result = shared.upload_results_to_testrail(
+ k8s_conformance_virtlet_report_name, testSuiteName, methodname, testrail_name_template,
+ reporter_extra_options, testPlanNamePrefix=testPlanNamePrefix)
common.printMsg(report_result, "blue")
report_url = report_result.split("\n").each {
if (it.contains("[TestRun URL]")) {
@@ -183,7 +195,9 @@
testSuiteName = "LMA2.0_Automated"
methodname = "{methodname}"
testrail_name_template = "{title}"
- report_result = shared.upload_results_to_testrail(stacklight_report_name, testSuiteName, methodname, testrail_name_template)
+ report_result = shared.upload_results_to_testrail(
+ stacklight_report_name, testSuiteName, methodname, testrail_name_template,
+ testPlanNamePrefix=testPlanNamePrefix)
common.printMsg(report_result, "blue")
report_url = report_result.split("\n").each {
if (it.contains("[TestRun URL]")) {
@@ -205,7 +219,9 @@
"--testrail-case-custom-fields {\\\"custom_qa_team\\\":\\\"9\\\"}",
"--testrail-case-section-name \'All\'",
]
- report_result = shared.upload_results_to_testrail(cvp_sanity_report_name, testSuiteName, methodname, testrail_name_template, reporter_extra_options)
+ report_result = shared.upload_results_to_testrail(
+ cvp_sanity_report_name, testSuiteName, methodname, testrail_name_template,
+ reporter_extra_options, testPlanNamePrefix=testPlanNamePrefix)
common.printMsg(report_result, "blue")
report_url = report_result.split("\n").each {
if (it.contains("[TestRun URL]")) {
diff --git a/src/com/mirantis/system_qa/SharedPipeline.groovy b/src/com/mirantis/system_qa/SharedPipeline.groovy
index 4e819ae..471d64b 100644
--- a/src/com/mirantis/system_qa/SharedPipeline.groovy
+++ b/src/com/mirantis/system_qa/SharedPipeline.groovy
@@ -295,6 +295,7 @@
string(name: 'PARENT_WORKSPACE', value: pwd()),
string(name: 'TCP_QA_REFS', value: "${tcp_qa_refs}"),
string(name: 'TEMPEST_TEST_SUITE_NAME', value: "${tempest_test_suite_name}"),
+ string(name: 'TEST_PLAN_NAME_PREFIX', value: env.TESTRAIL_TEST_PLAN_NAME_PREFIX ?: ''),
]
common.printMsg("Start building job 'swarm-testrail-report' with parameters:", "purple")
common.prettyPrint(parameters)
@@ -556,12 +557,15 @@
writeFile(file: filename, text: script, encoding: "UTF-8")
}
-def upload_results_to_testrail(report_name, testSuiteName, methodname, testrail_name_template, reporter_extra_options=[]) {
+def upload_results_to_testrail(report_name, testSuiteName, methodname, testrail_name_template, reporter_extra_options=[], testPlanNamePrefix=null) {
def venvPath = '/home/jenkins/venv_testrail_reporter'
def testPlanDesc = env.LAB_CONFIG_NAME
def testrailURL = "https://mirantis.testrail.com"
def testrailProject = "Mirantis Cloud Platform"
- def testPlanName = "[MCP-Q2]System-${MCP_VERSION}-${new Date().format('yyyy-MM-dd')}"
+ if (!testPlanNamePrefix) {
+ testPlanNamePrefix = "[MCP-Q2]System"
+ }
+ def testPlanName = "${testPlanNamePrefix}-${MCP_VERSION}-${new Date().format('yyyy-MM-dd')}"
def testrailMilestone = "MCP1.1"
def testrailCaseMaxNameLenght = 250
def jobURL = env.BUILD_URL
diff --git a/tcp_tests/templates/cookied-cicd-k8s-calico-sl/salt.yaml b/tcp_tests/templates/cookied-cicd-k8s-calico-sl/salt.yaml
index 77bc8f4..a7fefa8 100644
--- a/tcp_tests/templates/cookied-cicd-k8s-calico-sl/salt.yaml
+++ b/tcp_tests/templates/cookied-cicd-k8s-calico-sl/salt.yaml
@@ -13,3 +13,12 @@
{{SHARED.MACRO_CHECK_SALT_VERSION_ON_NODES()}}
+- description: "Share custom key from cfg to give each node acces with key from cfg01"
+ cmd: |
+ set -e;
+ set -x;
+ key=$(ssh-keygen -y -f /root/.ssh/id_rsa);
+ salt '*' cmd.run "echo $key >> /root/.ssh/authorized_keys";
+ node_name: {{ HOSTNAME_CFG01 }}
+ retry: {count: 1, delay: 5}
+ skip_fail: true
diff --git a/tcp_tests/templates/cookied-cicd-k8s-genie/salt.yaml b/tcp_tests/templates/cookied-cicd-k8s-genie/salt.yaml
index 625472c..7294447 100644
--- a/tcp_tests/templates/cookied-cicd-k8s-genie/salt.yaml
+++ b/tcp_tests/templates/cookied-cicd-k8s-genie/salt.yaml
@@ -12,3 +12,13 @@
{{SHARED.MACRO_CHECK_SALT_VERSION_SERVICES_ON_CFG()}}
{{SHARED.MACRO_CHECK_SALT_VERSION_ON_NODES()}}
+
+- description: "Share custom key from cfg to give each node acces with key from cfg01"
+ cmd: |
+ set -e;
+ set -x;
+ key=$(ssh-keygen -y -f /root/.ssh/id_rsa);
+ salt '*' cmd.run "echo $key >> /root/.ssh/authorized_keys";
+ node_name: {{ HOSTNAME_CFG01 }}
+ retry: {count: 1, delay: 5}
+ skip_fail: true
\ No newline at end of file
diff --git a/tcp_tests/templates/shared-salt.yaml b/tcp_tests/templates/shared-salt.yaml
index e269d50..e19b15c 100644
--- a/tcp_tests/templates/shared-salt.yaml
+++ b/tcp_tests/templates/shared-salt.yaml
@@ -1137,16 +1137,6 @@
retry: {count: 1, delay: 10}
skip_fail: false
-- description: "Share custom key from cfg to give each node acces with key from cfg01"
- cmd: |
- set -e;
- set -x;
- key=$(ssh-keygen -y -f /root/.ssh/id_rsa);
- salt '*' cmd.run "echo $key >> /root/.ssh/authorized_keys";
- node_name: {{ HOSTNAME_CFG01 }}
- retry: {count: 1, delay: 5}
- skip_fail: true
-
{%- endmacro %}