Report from foundation node

Change-Id: I2bd8bacc15a13815bff0b016e098eb430755d5d7
diff --git a/jobs/pipelines/deploy-cicd-and-run-tests.groovy b/jobs/pipelines/deploy-cicd-and-run-tests.groovy
index de92a25..1af17d1 100644
--- a/jobs/pipelines/deploy-cicd-and-run-tests.groovy
+++ b/jobs/pipelines/deploy-cicd-and-run-tests.groovy
@@ -7,10 +7,12 @@
 
 if (env_manager == 'devops') {
     jenkins_slave_node_name = "${NODE_NAME}"
+    node_with_reports = "${NODE_NAME}"
     make_snapshot_stages = "${env.MAKE_SNAPSHOT_STAGES}" != "false" ? true : false
 } else if (env_manager == 'heat') {
     jenkins_slave_node_name = "openstack_slave_${JOB_NAME}"
     make_snapshot_stages = false
+    node_with_reports = jenkins_slave_node_name
 }
 
 currentBuild.description = "${NODE_NAME}:${ENV_NAME}<br>"
@@ -139,9 +141,14 @@
             // then archive artifacts also on that node
             if (jenkins_slave_node_name != env.NODE_NAME) {
                 node ("${jenkins_slave_node_name}") {
-                    stage("Archive all xml reports from node ${}") {
+                    stage("Archive all xml reports from node ${jenkins_slave_node_name}") {
                         archiveArtifacts artifacts: "**/*.xml,**/*.ini,**/*.log,**/*.tar.gz"
                     }
+                    if ("${env.REPORT_TO_TESTRAIL}" != "false") {
+                      stage("report results to testrail") {
+                      shared.swarm_testrail_report(steps, node_with_reports)
+                    }
+                    }
                 }
             }
         }
@@ -151,7 +158,7 @@
         }
         if ("${env.REPORT_TO_TESTRAIL}" != "false") {
             stage("report results to testrail") {
-                shared.swarm_testrail_report(steps)
+                shared.swarm_testrail_report(steps, node_with_reports)
             }
             stage("Store TestRail reports to job description") {
                 def String description = readFile("description.txt")
diff --git a/jobs/pipelines/swarm-bootstrap-salt-cluster-heat.groovy b/jobs/pipelines/swarm-bootstrap-salt-cluster-heat.groovy
index 8c10291..53fe251 100644
--- a/jobs/pipelines/swarm-bootstrap-salt-cluster-heat.groovy
+++ b/jobs/pipelines/swarm-bootstrap-salt-cluster-heat.groovy
@@ -254,6 +254,12 @@
         stage("Clean the environment and clone tcp-qa") {
             deleteDir()
             shared.verbose_sh("""\
+                [ -d /home/jenkins/venv_testrail_reporter ] || virtualenv /home/jenkins/venv_testrail_reporter
+            """, true, false, true)
+            shared.run_cmd("""\
+                . /home/jenkins/venv_testrail_reporter/bin/activate; pip install git+https://github.com/dis-xcom/testrail_reporter -U
+            """)
+            shared.verbose_sh("""\
                 [ -d /home/jenkins/fuel-devops30 ] || virtualenv /home/jenkins/fuel-devops30
             """, true, false, true)
             shared.run_cmd("""\
diff --git a/src/com/mirantis/system_qa/SharedPipeline.groovy b/src/com/mirantis/system_qa/SharedPipeline.groovy
index d74b600..e639eb8 100644
--- a/src/com/mirantis/system_qa/SharedPipeline.groovy
+++ b/src/com/mirantis/system_qa/SharedPipeline.groovy
@@ -375,7 +375,7 @@
             parameters: parameters
 }
 
-def swarm_testrail_report(String passed_steps) {
+def swarm_testrail_report(String passed_steps, String node_with_reports) {
         // Run pytest tests
         def common = new com.mirantis.mk.Common()
         def tcp_qa_refs = env.TCP_QA_REFS ?: ''
@@ -386,7 +386,7 @@
                 string(name: 'LAB_CONFIG_NAME', value: "${LAB_CONFIG_NAME}"),
                 string(name: 'MCP_VERSION', value: "${MCP_VERSION}"),
                 string(name: 'PASSED_STEPS', value: passed_steps),
-                string(name: 'PARENT_NODE_NAME', value: "${NODE_NAME}"),
+                string(name: 'PARENT_NODE_NAME', value: node_with_reports),
                 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}"),