Update build for offline image

* Update build job
* Update salt setup for offline-image

Related-Prod: PROD-32735
Related-Prod: PROD-32736
Change-Id: Ief81e34d6800533fed04710f84635de3116907bc
diff --git a/packer-image-buid.groovy b/packer-image-buid.groovy
index 3b48075..2cc625b 100644
--- a/packer-image-buid.groovy
+++ b/packer-image-buid.groovy
@@ -152,8 +152,10 @@
                             checkout([
                                     $class             : 'GitSCM',
                                     branches           : [[name: 'FETCH_HEAD']],
-                                    recursiveSubmodules: true,
-                                    extensions         : [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'config-drive/model']],
+                                    extensions         : [
+                                        [$class: 'RelativeTargetDirectory', relativeTargetDir: 'config-drive/model'],
+                                        [$class: 'SubmoduleOption', disableSubmodules: false, parentCredentials: true, recursiveSubmodules: true, trackingSubmodules: false],
+                                    ],
                                     userRemoteConfigs  : [[url: model, refspec: extra_vars.get('CLUSTER_MODEL_REF', 'master'), credentialsId: gerritCredentials]]
                             ])
 
@@ -162,6 +164,20 @@
                             if (clusterName == 'mcp-offline' && mcpVersion != '') {
                                 def filePath = 'classes/cluster/mcp-offline/infra/apt01_dummy.yml'
                                 sh "sed -i 's/mcp_version: .*/mcp_version: ${mcpVersion}/' config-drive/model/${filePath}"
+                                // speed up build by using internal mirrors in the same region
+                                if (os_openrc.get('CLOUD_REGION', 'US').matches("[Ee][Uu]")) {
+                                    sh "sed -i 's/debmirror_mirrors_host: .*/debmirror_mirrors_host: mirror-eu.mcp.mirantis.net/' config-drive/model/${filePath}"
+                                }
+                            }
+
+                            def reclass_url = extra_vars.get('RECLASS_SYSTEM_URL', '')
+                            def reclass_ref = extra_vars.get('RECLASS_SYSTEM_REF', '')
+                            if (reclass_url && reclass_ref) {
+                                if (fileExists('config-drive/model/classes/system')) {
+                                    dir('config-drive/model/classes/system') {
+                                        gerrit.gerritPatchsetCheckout(reclass_url, reclass_ref, "HEAD", gerritCredentials)
+                                    }
+                                }
                             }
                         }
                         def scripts = extra_vars.get('GIT_SALT_FORMULAS_SCRIPTS', '')