Merge "Add upgrading of SaltStack to update drivetrain pipeline."
diff --git a/cloud-update.groovy b/cloud-update.groovy
index b6a44b6..07674e2 100644
--- a/cloud-update.groovy
+++ b/cloud-update.groovy
@@ -1534,7 +1534,7 @@
 
             if (merges.contains("log")) {
                 if (salt.testTarget(pepperEnv, LOG_TARGET)) {
-                    mergeSnapshot(pepperEnv, LOG_TARGET. 'log')
+                    mergeSnapshot(pepperEnv, LOG_TARGET, 'log')
                 }
             }
 
diff --git a/generate-cookiecutter-products.groovy b/generate-cookiecutter-products.groovy
index 0a2888e..b3dc718 100644
--- a/generate-cookiecutter-products.groovy
+++ b/generate-cookiecutter-products.groovy
@@ -169,7 +169,8 @@
             stage("Test") {
                 if (sharedReclassUrl != "" && TEST_MODEL && TEST_MODEL.toBoolean()) {
                     sh("cp -r ${modelEnv} ${testEnv}")
-                    saltModelTesting.setupAndTestNode("${saltMaster}.${clusterDomain}", "", testEnv)
+                    def DockerCName = "${env.JOB_NAME.toLowerCase()}_${env.BUILD_TAG.toLowerCase()}"
+                    saltModelTesting.setupAndTestNode("${saltMaster}.${clusterDomain}", "", testEnv, dockerContainerName: DockerCName)
                 }
             }
 
diff --git a/git-mirror-2way-pipeline.groovy b/git-mirror-2way-pipeline.groovy
index 21d72bf..bd9dcb8 100644
--- a/git-mirror-2way-pipeline.groovy
+++ b/git-mirror-2way-pipeline.groovy
@@ -6,7 +6,7 @@
       try{
         def branches = BRANCHES.tokenize(',')
         def pollBranches = []
-        for (i=0; i < branches.size; i++) {
+        for (i=0; i < branches.size(); i++) {
             pollBranches.add([name:branches[i]])
         }
         dir("target") {
diff --git a/git-mirror-pipeline.groovy b/git-mirror-pipeline.groovy
index 45536d0..8bfe467 100644
--- a/git-mirror-pipeline.groovy
+++ b/git-mirror-pipeline.groovy
@@ -6,7 +6,7 @@
       try{
         def branches = BRANCHES.tokenize(',')
         def pollBranches = []
-        for (i=0; i < branches.size; i++) {
+        for (i=0; i < branches.size(); i++) {
             pollBranches.add([name:branches[i]])
         }
         dir("source") {
diff --git a/test-cookiecutter-reclass.groovy b/test-cookiecutter-reclass.groovy
index ba05406..57fcb74 100644
--- a/test-cookiecutter-reclass.groovy
+++ b/test-cookiecutter-reclass.groovy
@@ -96,7 +96,9 @@
     while (nbTry < 5) {
         nbTry++
         try {
-            saltModelTesting.setupAndTestNode("cfg01.${clusterDomain}", clusterName, EXTRA_FORMULAS, testEnv, "pkg", DISTRIB_REVISION)
+            def DockerCName = "${env.JOB_NAME.toLowerCase()}_${env.BUILD_TAG.toLowerCase()}"
+            saltModelTesting.setupAndTestNode("cfg01.${clusterDomain}", clusterName, EXTRA_FORMULAS, testEnv, "pkg",
+                    DISTRIB_REVISION, dockerContainerName: DockerCName)
             break
         } catch (Exception e) {
             if (e.getMessage() == "script returned exit code 124") {
@@ -174,11 +176,10 @@
             stage("test-nodes") {
                 def partitions = common.partitionList(contextFileList, PARALLEL_NODE_GROUP_SIZE.toInteger())
                 def buildSteps = [:]
-                for (int i = 0; i < partitions.size(); i++) {
-                    def partition = partitions[i]
+                partitions.eachWithIndex { partition, i ->
                     buildSteps.put("partition-${i}", new HashMap<String,org.jenkinsci.plugins.workflow.cps.CpsClosure2>())
-                    for(int k = 0; k < partition.size; k++){
-                        def basename = sh(script: "basename ${partition[k]} .yml", returnStdout: true).trim()
+                    for(part in partition){
+                        def basename = sh(script: "basename ${part} .yml", returnStdout: true).trim()
                         def testEnv = "${env.WORKSPACE}/model/${basename}"
                         buildSteps.get("partition-${i}").put(basename, { testModel(basename, testEnv) })
                     }
diff --git a/test-salt-formulas-pipeline.groovy b/test-salt-formulas-pipeline.groovy
index 401628b..ca4eb67 100644
--- a/test-salt-formulas-pipeline.groovy
+++ b/test-salt-formulas-pipeline.groovy
@@ -182,9 +182,6 @@
         common.errorMsg("----------------KITCHEN LOG:---------------")
         println readFile(".kitchen/logs/kitchen.log")
       }
-      def slack = new com.mirantis.mcp.SlackNotification()
-      slack.jobResultNotification("success", "#test_reclass_notify")
-      common.sendNotification(currentBuild.result, "", ["slack"])
     }
   }
 }
diff --git a/test-salt-model-node.groovy b/test-salt-model-node.groovy
index 7fc333d..ccea1f4 100644
--- a/test-salt-model-node.groovy
+++ b/test-salt-model-node.groovy
@@ -64,7 +64,10 @@
             def workspace = common.getWorkspace()
             common.infoMsg("Running salt model test for node ${NODE_TARGET} in cluster ${CLUSTER_NAME}")
             try {
-              saltModelTesting.setupAndTestNode(NODE_TARGET, CLUSTER_NAME, EXTRA_FORMULAS, workspace, FORMULAS_SOURCE, FORMULAS_REVISION, RECLASS_VERSION, MAX_CPU_PER_JOB.toInteger(), RECLASS_IGNORE_CLASS_NOTFOUND, LEGACY_TEST_MODE, APT_REPOSITORY, APT_REPOSITORY_GPG)
+              def DockerCName = "${env.JOB_NAME.toLowerCase()}_${env.BUILD_TAG.toLowerCase()}"
+              saltModelTesting.setupAndTestNode(NODE_TARGET, CLUSTER_NAME, EXTRA_FORMULAS, workspace, FORMULAS_SOURCE,
+                      FORMULAS_REVISION, RECLASS_VERSION, MAX_CPU_PER_JOB.toInteger(), RECLASS_IGNORE_CLASS_NOTFOUND,
+                      LEGACY_TEST_MODE, APT_REPOSITORY, APT_REPOSITORY_GPG, dockerContainerName: DockerCName)
             } catch (Exception e) {
               if (e.getMessage() == "script returned exit code 124") {
                 common.errorMsg("Impossible to test node due to timeout of salt-master, ABORTING BUILD")