Merge "Continue pipeline on "another" node after updating GFS on clients"
diff --git a/cvp-perf.groovy b/cvp-perf.groovy
index 60a064c..ebb7987 100644
--- a/cvp-perf.groovy
+++ b/cvp-perf.groovy
@@ -36,19 +36,20 @@
             if (!os_version) {
                 throw new Exception("Openstack is not found on this env. Exiting")
             }
+            container_name = "${env.JOB_NAME}"
             salt.cmdRun(saltMaster, TARGET_NODE, "rm -rf ${remote_artifacts_dir}")
             salt.cmdRun(saltMaster, TARGET_NODE, "mkdir -p ${remote_artifacts_dir}")
             keystone_creds = validate._get_keystone_creds_v3(saltMaster)
             if (!keystone_creds) {
                 keystone_creds = validate._get_keystone_creds_v2(saltMaster)
             }
-            validate.runContainer(saltMaster, TARGET_NODE, TEST_IMAGE, 'cvp', keystone_creds)
-            validate.configureContainer(saltMaster, TARGET_NODE, PROXY, TOOLS_REPO, "")
+            validate.runContainer(saltMaster, TARGET_NODE, TEST_IMAGE, container_name, keystone_creds)
+            validate.configureContainer(saltMaster, TARGET_NODE, PROXY, TOOLS_REPO, "", "internalURL", "", "", [], container_name)
         }
 
         stage('Run Rally tests') {
             sh "mkdir -p ${artifacts_dir}"
-            validate.runCVPrally(saltMaster, TARGET_NODE, RALLY_SCENARIO_FILE, remote_artifacts_dir)
+            validate.runCVPrally(saltMaster, TARGET_NODE, RALLY_SCENARIO_FILE, remote_artifacts_dir, "docker-rally", container_name)
         }
 
         stage('Collect results') {
@@ -63,7 +64,8 @@
         throw e
     } finally {
         if (DEBUG_MODE == 'false') {
-            validate.runCleanup(saltMaster, TARGET_NODE)
+            validate.openstack_cleanup(saltMaster, TARGET_NODE, container_name)
+            validate.runCleanup(saltMaster, TARGET_NODE, container_name)
             salt.cmdRun(saltMaster, TARGET_NODE, "rm -rf ${remote_artifacts_dir}")
         }
     }
diff --git a/cvp-runner.groovy b/cvp-runner.groovy
index 1b1d5e0..d64e057 100644
--- a/cvp-runner.groovy
+++ b/cvp-runner.groovy
@@ -62,7 +62,8 @@
                 def env_vars_list  =  [
                     "SALT_USERNAME=${creds.username}",
                     "SALT_PASSWORD=${creds.password}",
-                    "SALT_URL=${SALT_MASTER_URL}"
+                    "SALT_URL=${SALT_MASTER_URL}",
+                    "REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt"
                     ] + env_vars
 
                 // Generating final config
@@ -73,6 +74,7 @@
                     'dockerExtraOpts' : [
                         "--network=host",
                         "-v /root/qa_results/:/root/qa_results/",
+                        "-v /etc/ssl/certs/:/etc/ssl/certs/:ro",
                         "-v ${env.WORKSPACE}/${artifacts_dir}/:${container_workdir}/${artifacts_dir}/",
                     ],
                     'envOpts'         : env_vars_list,
diff --git a/generate-cookiecutter-products.groovy b/generate-cookiecutter-products.groovy
index d4be6cc..63d7b52 100644
--- a/generate-cookiecutter-products.groovy
+++ b/generate-cookiecutter-products.groovy
@@ -75,34 +75,19 @@
     // because each of them, might be 'refs/' variable, we need to add  some tricky trigger of using
     // 'release/XXX' logic. This is totall guess - so,if even those one failed, to definitely must pass
     // correct variable finally!
-    [context.get('cookiecutter_template_branch'), context.get('shared_reclass_branch'), context.get('mcp_common_scripts_branch')].any { branch ->
+    [ context.get('cookiecutter_template_branch'), context.get('shared_reclass_branch'), context.get('mcp_common_scripts_branch') ].any { branch ->
         if (branch.toString().startsWith('release/')) {
             gitGuessedVersion = branch
             return true
         }
     }
-    // Use mcpVersion git tag if not specified branch for cookiecutter-templates
-    if (!context.get('cookiecutter_template_branch')) {
-        context['cookiecutter_template_branch'] = gitGuessedVersion ?: context['mcp_version']
-    }
-    // Don't have n/t/s for cookiecutter-templates repo, therefore use master
-    if (["nightly", "testing", "stable"].contains(context['cookiecutter_template_branch'])) {
-        context['cookiecutter_template_branch'] = 'master'
-    }
-    if (!context.get('shared_reclass_branch')) {
-        context['shared_reclass_branch'] = gitGuessedVersion ?: context['mcp_version']
-    }
-    // Don't have nightly/testing for reclass-system repo, therefore use master
-    if (["nightly", "testing", "stable"].contains(context['shared_reclass_branch'])) {
-        context['shared_reclass_branch'] = 'master'
-    }
-    if (!context.get('mcp_common_scripts_branch')) {
-        // Pin exactly to CC branch, since it might use 'release/XXX' format
-        context['mcp_common_scripts_branch'] = gitGuessedVersion ?: context['mcp_version']
-    }
-    // Don't have n/t/s for mcp-common-scripts repo, therefore use master
-    if (["nightly", "testing", "stable"].contains(context['mcp_common_scripts_branch'])) {
-        context['mcp_common_scripts_branch'] = 'master'
+
+    [ 'cookiecutter_template_branch', 'shared_reclass_branch', 'mcp_common_scripts_branch' ].each { repoName ->
+        if (context['mcp_version'] in [ "nightly", "testing", "stable" ] && ! context.get(repoName)) {
+            context[repoName] = 'master'
+        } else if (! context.get(repoName)) {
+            context[repoName] = gitGuessedVersion ?: "release/${context['mcp_version']}".toString()
+        }
     }
     //
     distribRevision = context['mcp_version']
diff --git a/test-model-generator.groovy b/test-model-generator.groovy
index 02e1789..144f760 100644
--- a/test-model-generator.groovy
+++ b/test-model-generator.groovy
@@ -27,6 +27,9 @@
 def dockerRegistry = env.DOCKER_REGISTRY ?: 'docker-prod-local.docker.mirantis.net'
 def dockerReviewRegistry = env.DOCKER_REVIEW_REGISTRY ?: 'docker-dev-local.docker.mirantis.net'
 def cvpImageName = env.CVP_DOCKER_IMG ? "${dockerRegistry}/${env.CVP_DOCKER_IMG}:${version}" : "${dockerRegistry}/mirantis/cvp/cvp-trymcp-tests:${version}"
+if (env.CVP_DEV_TAG && env.CVP_DOCKER_IMG) {
+    cvpImageName = "${dockerReviewRegistry}/${env.CVP_DOCKER_IMG}:${env.CVP_DEV_TAG}"
+}
 
 def checkouted = false
 def testReportHTMLFile = 'reports/report.html'