Merge "Add retry to openstack network list"
diff --git a/deploy-aws-k8s-kqueen-pipeline.groovy b/deploy-aws-k8s-kqueen-pipeline.groovy
index 402ed31..0a5903e 100644
--- a/deploy-aws-k8s-kqueen-pipeline.groovy
+++ b/deploy-aws-k8s-kqueen-pipeline.groovy
@@ -16,6 +16,9 @@
  *
  *   SALT_MASTER_CREDENTIALS    Credentials to the Salt API
  *   SALT_MASTER_URL            URL of Salt master
+ *
+ * optional parameters for overwriting soft params
+ *   SALT_OVERRIDES              YAML with overrides for Salt deployment
  */
 
 common = new com.mirantis.mk.Common()
@@ -25,6 +28,7 @@
 python = new com.mirantis.mk.Python()
 salt = new com.mirantis.mk.Salt()
 
+
 // Define global variables
 def venv
 def venvPepper
@@ -85,6 +89,17 @@
                 python.setupPepperVirtualenv(venvPepper, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
             }
 
+            // Set up override params
+            if (common.validInputParam('SALT_OVERRIDES')) {
+                stage('Set Salt overrides') {
+                    salt.setSaltOverrides(venvPepper,  SALT_OVERRIDES)
+                }
+            }
+
+            //
+            // Install
+            //
+
             stage('Install core infrastructure') {
                 def staticMgmtNetwork = false
                 if (common.validInputParam('STATIC_MGMT_NETWORK')) {
diff --git a/tag-git-repos.groovy b/tag-git-repos.groovy
index ad74505..52344d1 100644
--- a/tag-git-repos.groovy
+++ b/tag-git-repos.groovy
@@ -17,7 +17,7 @@
     dir(repoName) {
         sh "git tag -f -a ${tag} ${ref} -m \"Release of mcp version ${tag}\""
         sshagent([credentials]) {
-            sh "git push origin ${tag}"
+            sh "git push -f origin ${tag}:refs/tags/${tag}"
         }
     }
 }
diff --git a/test-salt-formulas-pipeline.groovy b/test-salt-formulas-pipeline.groovy
index 3c75950..e329079 100644
--- a/test-salt-formulas-pipeline.groovy
+++ b/test-salt-formulas-pipeline.groovy
@@ -4,6 +4,8 @@
  *  DEFAULT_GIT_URL
  *  CREDENTIALS_ID
  *  KITCHEN_TESTS_PARALLEL
+ *  RUN_TEST_IN_DOCKER     If true, run test stage in docker
+ *  SMOKE_TEST_DOCKER_IMG  Docker image for run test (default "ubuntu:16.04")
  */
 common = new com.mirantis.mk.Common()
 def gerrit = new com.mirantis.mk.Gerrit()
@@ -108,7 +110,28 @@
           saltVersion = "" // default value is empty string, means latest
         }
         withEnv(["SALT_VERSION=${saltVersion}"]) {
-          sh("make clean && make test")
+          boolean run_test_in_docker = (env.RUN_TEST_IN_DOCKER ?: false).asBoolean()
+          if (run_test_in_docker) {
+            def dockerLib = new com.mirantis.mk.Docker()
+            def img = dockerLib.getImage(env.SMOKE_TEST_DOCKER_IMG, "ubuntu:16.04")
+            def workspace = common.getWorkspace()
+            img.inside("-u root:root -v ${workspace}/:/formula/") {
+              sh("""cd /etc/apt/ && echo > sources.list \
+              && echo "deb [arch=amd64] http://cz.archive.ubuntu.com/ubuntu xenial main restricted universe multiverse" >> sources.list \
+              && echo "deb [arch=amd64] http://cz.archive.ubuntu.com/ubuntu xenial-updates main restricted universe multiverse" >> sources.list \
+              && echo "deb [arch=amd64] http://cz.archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiverse" >> sources.list \
+              && echo 'Acquire::Languages "none";' > apt.conf.d/docker-no-languages \
+              && echo 'Acquire::GzipIndexes "true"; Acquire::CompressionTypes::Order:: "gz";' > apt.conf.d/docker-gzip-indexes \
+              && echo 'APT::Get::Install-Recommends "false"; APT::Get::Install-Suggests "false";' > apt.conf.d/docker-recommends \
+              && apt-get update \
+              && apt-get install -y git-core wget curl apt-transport-https \
+              && apt-get install -y python-pip python3-pip python-virtualenv python3-virtualenv python-yaml autoconf build-essential""")
+              sh("cd /formula/ && make clean && make test")
+            }
+          } else {
+            common.warningMsg("Those tests should be always be run in clean env! Recommends to use docker env!")
+            sh("make clean && make test")
+          }
         }
       }
     }
diff --git a/validate-cloud.groovy b/validate-cloud.groovy
index 5dd8008..dbfc94b 100644
--- a/validate-cloud.groovy
+++ b/validate-cloud.groovy
@@ -70,13 +70,7 @@
 
             stage('Run Rally tests') {
                 if (RUN_RALLY_TESTS.toBoolean() == true) {
-                    def report_dir = '/root/qa_results'
-                    try {
-                         if(REPORT_DIR != ""){
-                             report_dir = REPORT_DIR
-                         }
-                    } catch (MissingPropertyException e) {
-                    }
+                    def report_dir = env.REPORT_DIR ?: '/root/qa_results'
                     def rally_variables = ["floating_network=${FLOATING_NETWORK}",
                                            "rally_image=${RALLY_IMAGE}",
                                            "rally_flavor=${RALLY_FLAVOR}",