Merge "Add 'packer-image-create' job"
diff --git a/jobs/pipelines/swarm-bootstrap-salt-cluster-devops.groovy b/jobs/pipelines/swarm-bootstrap-salt-cluster-devops.groovy
index 1adc18a..86b5122 100644
--- a/jobs/pipelines/swarm-bootstrap-salt-cluster-devops.groovy
+++ b/jobs/pipelines/swarm-bootstrap-salt-cluster-devops.groovy
@@ -70,6 +70,7 @@
                 export ENV_MANAGER=devops
                 export PYTHONIOENCODING=UTF-8
                 export REPOSITORY_SUITE=${MCP_VERSION}
+                export UPDATE_VERSION=${UPDATE_VERSION}
                 export TEST_GROUP=test_create_environment
                 export LOG_NAME=swarm_test_create_environment.log
                 py.test -vvv -s -p no:django -p no:ipdb --junit-xml=deploy_hardware.xml -k \${TEST_GROUP}
@@ -123,6 +124,7 @@
                     export BOOTSTRAP_TIMEOUT=1800
                     export PYTHONIOENCODING=UTF-8
                     export REPOSITORY_SUITE=${MCP_VERSION}
+                    export UPDATE_VERSION=${UPDATE_VERSION}
                     export TEST_GROUP=test_bootstrap_salt
                     export LOG_NAME=swarm_test_bootstrap_salt.log
                     py.test -vvv -s -p no:django -p no:ipdb --junit-xml=${xml_report_name} -k \${TEST_GROUP}
diff --git a/jobs/pipelines/swarm-bootstrap-salt-cluster-heat.groovy b/jobs/pipelines/swarm-bootstrap-salt-cluster-heat.groovy
index 3776926..0d497ab 100644
--- a/jobs/pipelines/swarm-bootstrap-salt-cluster-heat.groovy
+++ b/jobs/pipelines/swarm-bootstrap-salt-cluster-heat.groovy
@@ -28,6 +28,7 @@
  *   OS_USER_DOMAIN_NAME           OpenStack user domain name
  *   OS_CREDENTIALS                OpenStack username and password credentials ID in Jenkins
  *   JENKINS_PIPELINE_BRANCH       Should be set in release/proposed/2019.2.0 when we test non-released version
+ *   UPDATE_VERSION                Version of update to deploy
  *   LAB_PARAM_DEFAULTS            Filename placed in tcp_tests/templates/_heat_environments, with default parameters for the heat template
  *
  *   CREATE_JENKINS_NODE_CREDENTIALS   Jenkins username and password with rights to add/delete Jenkins agents
@@ -155,6 +156,7 @@
                     export SHUTDOWN_ENV_ON_TEARDOWN=false
                     export PYTHONIOENCODING=UTF-8
                     export REPOSITORY_SUITE=${MCP_VERSION}
+                    export UPDATE_VERSION=${UPDATE_VERSION}
                     export ENV_NAME=${ENV_NAME}
                     export LAB_CONFIG_NAME=${LAB_CONFIG_NAME}
                     export LAB_PARAM_DEFAULTS=${LAB_PARAM_DEFAULTS}
@@ -290,6 +292,7 @@
                         export BOOTSTRAP_TIMEOUT=3600
                         export PYTHONIOENCODING=UTF-8
                         export REPOSITORY_SUITE=${MCP_VERSION}
+                        export UPDATE_VERSION=${UPDATE_VERSION}
                         export TEST_GROUP=test_bootstrap_salt
                         export LOG_NAME=swarm_test_bootstrap_salt.log
                         py.test -vvv -s -p no:django -p no:ipdb --junit-xml=${xml_report_name} -k \${TEST_GROUP}
diff --git a/jobs/pipelines/swarm-create-cfg-config-drive.groovy b/jobs/pipelines/swarm-create-cfg-config-drive.groovy
index 0707fec..86b9eec 100644
--- a/jobs/pipelines/swarm-create-cfg-config-drive.groovy
+++ b/jobs/pipelines/swarm-create-cfg-config-drive.groovy
@@ -20,6 +20,8 @@
 // smc['LOCAL_REPOS'] = 'true'
 smc['MCP_SALT_REPO_KEY'] = "${MCP_SALT_REPO_KEY}"
 smc['MCP_SALT_REPO_URL'] = "${MCP_SALT_REPO_URL}"
+smc['MCP_SALT_REPO_UPDATES'] = "${MCP_SALT_REPO_UPDATES}"
+
 
 def entries(m) {
     m.collect {k, v -> [k, v]}
@@ -186,6 +188,8 @@
 #      export LOCAL_REPOS="true"
 #      export MCP_SALT_REPO_KEY="${MCP_SALT_REPO_KEY}"
 #      export MCP_SALT_REPO_URL="${MCP_SALT_REPO_URL}"
+#      export MCP_SALT_REPO_UPDATES="${MCP_SALT_REPO_UPDATES}"
+#      export ENABLE_MCP_SALT_REPO_UPDATES="true"
 
 output:
   all: '| tee -a /var/log/cloud-init-output.log /dev/tty0'
diff --git a/src/com/mirantis/system_qa/SharedPipeline.groovy b/src/com/mirantis/system_qa/SharedPipeline.groovy
index 06ca19d..6426db5 100644
--- a/src/com/mirantis/system_qa/SharedPipeline.groovy
+++ b/src/com/mirantis/system_qa/SharedPipeline.groovy
@@ -208,6 +208,7 @@
         def mk_pipelines_ref = env.MK_PIPELINES_REF ?: ''
         def pipeline_library_ref = env.PIPELINE_LIBRARY_REF ?: ''
         def cookiecutter_ref_change = env.COOKIECUTTER_REF_CHANGE ?: ''
+        def mcp_common_scripts_refs = env.MCP_COMMON_SCRIPTS_REFS ?: ''
         def environment_template_ref_change = env.ENVIRONMENT_TEMPLATE_REF_CHANGE ?: ''
         def mcp_salt_repo_url = env.MCP_SALT_REPO_URL ?: ''
         def mcp_salt_repo_key = env.MCP_SALT_REPO_KEY ?: ''
@@ -217,6 +218,7 @@
         def env_lab_mgm_iface = env.LAB_MANAGEMENT_IFACE ?: ''
         def env_lab_ctl_iface = env.LAB_CONTROL_IFACE ?: ''
         def update_repo_custom_tag = env.UPDATE_REPO_CUSTOM_TAG ?: ''
+        def update_version = env.UPDATE_VERSION ?: ''
         def parameters = [
                 string(name: 'PARENT_NODE_NAME', value: "${NODE_NAME}"),
                 string(name: 'PARENT_WORKSPACE', value: pwd()),
@@ -242,6 +244,8 @@
                 string(name: 'LAB_CONTROL_IFACE', value: env_lab_ctl_iface),
                 string(name: 'UPDATE_REPO_CUSTOM_TAG', value: "${update_repo_custom_tag}"),
                 string(name: 'JENKINS_PIPELINE_BRANCH', value: "${jenkins_pipelines_branch}"),
+                string(name: 'MCP_COMMON_SCRIPTS_REFS', value: "${mcp_common_scripts_refs}"),
+                string(name: 'UPDATE_VERSION', value: "${update_version}"),
                 booleanParam(name: 'SHUTDOWN_ENV_ON_TEARDOWN', value: false),
             ]
 
@@ -253,6 +257,7 @@
         def common = new com.mirantis.mk.Common()
         def cookiecutter_template_commit = env.COOKIECUTTER_TEMPLATE_COMMIT ?: "release/${env.MCP_VERSION}"
         def salt_models_system_commit = env.SALT_MODELS_SYSTEM_COMMIT ?: "release/${env.MCP_VERSION}"
+        def mcp_common_scripts_refs = env.MCP_COMMON_SCRIPTS_REFS ?: ''
         def tcp_qa_refs = env.TCP_QA_REFS ?: ''
         def mk_pipelines_ref = env.MK_PIPELINES_REF ?: ''
         def jenkins_pipelines_branch = env.JENKINS_PIPELINE_BRANCH ?: ''
@@ -266,6 +271,7 @@
         def env_lab_mgm_iface = env.LAB_MANAGEMENT_IFACE ?: ''
         def env_lab_ctl_iface = env.LAB_CONTROL_IFACE ?: ''
         def update_repo_custom_tag = env.UPDATE_REPO_CUSTOM_TAG ?: ''
+        def update_version = env.UPDATE_VERSION ?: ''
         def parameters = [
                 string(name: 'PARENT_NODE_NAME', value: "${NODE_NAME}"),
                 string(name: 'JENKINS_SLAVE_NODE_NAME', value: jenkins_slave_node_name),
@@ -285,6 +291,8 @@
                 string(name: 'ENVIRONMENT_TEMPLATE_REF_CHANGE', value: "${environment_template_ref_change}"),
                 string(name: 'MCP_SALT_REPO_URL', value: "${mcp_salt_repo_url}"),
                 string(name: 'MCP_SALT_REPO_KEY', value: "${mcp_salt_repo_key}"),
+                string(name: 'MCP_COMMON_SCRIPTS_REFS', value: "${mcp_common_scripts_refs}"),
+                string(name: 'UPDATE_VERSION', value: "${update_version}"),
                 string(name: 'IPMI_USER', value: env_ipmi_user),
                 string(name: 'IPMI_PASS', value: env_ipmi_pass),
                 string(name: 'LAB_MANAGEMENT_IFACE', value: env_lab_mgm_iface),
@@ -419,6 +427,7 @@
         def cookiecutter_ref_change = env.COOKIECUTTER_REF_CHANGE ?: ''
         def jenkins_pipelines_branch=env.JENKINS_PIPELINE_BRANCH ?: ''
         def update_repo_custom_tag = env.UPDATE_REPO_CUSTOM_TAG ?: ''
+        def update_version = env.UPDATE_VERSION ?: ''
 
         def parameters = [
                 string(name: 'LAB_CONTEXT_NAME', value: "${LAB_CONFIG_NAME}"),
@@ -439,6 +448,8 @@
                 string(name: 'UPDATE_REPO_CUSTOM_TAG', value: "${update_repo_custom_tag}"),
                 string(name: 'JENKINS_PIPELINE_BRANCH', value: "${jenkins_pipelines_branch}"),
                 string(name: 'IMAGE_PATH_CFG01_DAY01', value: env.IMAGE_PATH_CFG01_DAY01),
+                string(name: 'UPDATE_VERSION', value: "${update_version}"),
+
             ]
 
         build_shell_job('swarm-cookied-model-generator', parameters, "deploy_generate_model.xml")
@@ -450,8 +461,10 @@
         println("ADMIN_NETWORK_GW=" + ADMIN_NETWORK_GW)
 
         def mk_pipelines_ref = env.MK_PIPELINES_REF ?: ''
+        def mcp_common_scripts_ref = env.MCP_COMMON_SCRIPTS_REFS ?: ''
         def pipeline_library_ref = env.PIPELINE_LIBRARY_REF ?: ''
         def tcp_qa_refs = env.TCP_QA_REFS ?: ''
+        def update_version = env.UPDATE_VERSION?: 'proposed'
         def mcp_salt_repo_url = env.MCP_SALT_REPO_URL ?: ''
         def mcp_salt_repo_key = env.MCP_SALT_REPO_KEY ?: ''
         def deploy_network_mask = env.DEPLOY_NETWORK_NETMASK ?: ''
@@ -475,6 +488,9 @@
                 string(name: 'PIPELINE_LIBRARY_REF', value: "${pipeline_library_ref}"),
                 string(name: 'MK_PIPELINES_REF', value: "${mk_pipelines_ref}"),
                 string(name: 'TCP_QA_REFS', value: "${tcp_qa_refs}"),
+                string(name: 'UPDATE_VERSION', value: "${update_version}"),
+                string(name: 'MCP_COMMON_SCRIPTS_REFS', value: "${mcp_common_scripts_ref}"),
+                string(name: 'MCP_SALT_REPO_UPDATES', value: "'deb [arch=amd64] http://mirror.mirantis.com/update/${UPDATE_VERSION}/salt-formulas/xenial xenial main'"),
             ]
         build_pipeline_job('swarm-create-cfg-config-drive', parameters)
 }