Recheck and reinstall virtualenv for analyzer tool

Change-Id: I4d12e8fb3cfb396a1a980ea9c47d669ce409c28c
diff --git a/jobs/pipelines/swarm-testrail-report.groovy b/jobs/pipelines/swarm-testrail-report.groovy
index 1736c62..1167978 100644
--- a/jobs/pipelines/swarm-testrail-report.groovy
+++ b/jobs/pipelines/swarm-testrail-report.groovy
@@ -78,13 +78,24 @@
             common.printMsg(stacklight_report_name ? "Found stacklight-pytest report: ${stacklight_report_name}" : "stacklight-pytest report not found", stacklight_report_name ? "blue" : "red")
             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")
 
-            stage("Prepare/update venv for reporter tool"){
+            stage("Prepare/update venvs for reporter/analyzer tools"){
                 sshagent(credentials: ['maintenance-team-ssh']) {
                     shared.run_cmd("""\
                             . /home/jenkins/venv_testrail_reporter/bin/activate;
                             pip install git+ssh://maintenance-ci-robot@gerrit.mcp.mirantis.com:29418/mcp/testrail-reporter -U;
                             pip install --force-reinstall --no-deps git+ssh://maintenance-ci-robot@gerrit.mcp.mirantis.com:29418/mcp/testrail-reporter;""")
                 }
+                shared.run_cmd("""\
+                    if [ -f /home/jenkins/venv_testrail_analyzer/bin/python &&
+                        $(/home/jenkins/venv_testrail_analyzer/bin/python -V | awk -F "." '{print \$2}') -lt 6 ] ; then
+                        rm -rf /home/jenkins/venv_testrail_analyzer ;
+                    fi
+                """)
+                shared.run_cmd("""\
+                    [ -d /home/jenkins/venv_testrail_analyzer ] || virtualenv --python=python3.7 /home/jenkins/venv_testrail_analyzer ;
+                    source /home/jenkins/venv_testrail_analyzer/bin/activate;
+                    pip install git+https://review.gerrithub.io/ibumarskov/testrail-reporter@b9041b241f3364022cd0ad63510f02aab4352a6b
+                """)
             }
 
             if (deployment_report_name) {