Merge "Rollout and test the config change"
diff --git a/cloud-deploy-pipeline.groovy b/cloud-deploy-pipeline.groovy
index 6683910..d1faac2 100644
--- a/cloud-deploy-pipeline.groovy
+++ b/cloud-deploy-pipeline.groovy
@@ -397,6 +397,10 @@
             stage('Copy Tempest results to config node') {
                 test.copyTempestResults(saltMaster, TEST_TEMPEST_TARGET)
             }
+
+            stage('Archive rally artifacts') {
+                test.archiveRallyArtifacts(saltMaster, TEST_TEMPEST_TARGET)
+            }
         }
 
         if (common.checkContains('STACK_INSTALL', 'finalize')) {
diff --git a/generate-cookiecutter-products.groovy b/generate-cookiecutter-products.groovy
index 2583fb1..0c57300 100644
--- a/generate-cookiecutter-products.groovy
+++ b/generate-cookiecutter-products.groovy
@@ -43,7 +43,16 @@
         print("Using context:\n" + COOKIECUTTER_TEMPLATE_CONTEXT)
 
         stage ('Download Cookiecutter template') {
-            git.checkoutGitRepository(templateEnv, COOKIECUTTER_TEMPLATE_URL, COOKIECUTTER_TEMPLATE_BRANCH, COOKIECUTTER_TEMPLATE_CREDENTIALS)
+            if (COOKIECUTTER_TEMPLATE_BRANCH.startsWith('refs/changes/')) {
+                git.checkoutGitRepository(templateEnv, COOKIECUTTER_TEMPLATE_URL, 'master', COOKIECUTTER_TEMPLATE_CREDENTIALS)
+
+                dir(templateEnv) {
+                    ssh.agentSh("git fetch ${COOKIECUTTER_TEMPLATE_URL} ${COOKIECUTTER_TEMPLATE_BRANCH} && git checkout FETCH_HEAD")
+                }
+            } else {
+                git.checkoutGitRepository(templateEnv, COOKIECUTTER_TEMPLATE_URL, COOKIECUTTER_TEMPLATE_BRANCH, COOKIECUTTER_TEMPLATE_CREDENTIALS)
+            }
+
         }
 
         stage ('Create empty reclass model') {
@@ -64,11 +73,20 @@
             // get templateOutputDir and productDir
             if (product.startsWith("stacklight")) {
                 templateOutputDir = "${env.WORKSPACE}/output/stacklight"
+
+                def stacklightVersion
                 try {
-                    productDir = "stacklight" + templateContext.default_context['stacklight_version']
+                    stacklightVersion = templateContext.default_context['stacklight_version']
                 } catch (Throwable e) {
+                    common.warningMsg('Stacklight version loading failed')
+                }
+
+                if (stacklightVersion) {
+                    productDir = "stacklight" + stacklightVersion
+                } else {
                     productDir = "stacklight1"
                 }
+
             } else {
                 templateOutputDir = "${env.WORKSPACE}/output/${product}"
                 productDir = product