Merge "Add kubernetes conformance in-cluster execution"
diff --git a/src/com/mirantis/mcp/MCPArtifactory.groovy b/src/com/mirantis/mcp/MCPArtifactory.groovy
index 0101eb8..de4f81f 100644
--- a/src/com/mirantis/mcp/MCPArtifactory.groovy
+++ b/src/com/mirantis/mcp/MCPArtifactory.groovy
@@ -125,6 +125,31 @@
 }
 
 /**
+ * Check if image with tag exist by provided path
+ * Returns true or false
+ *
+ * @param artifactoryURL String, an URL to Artifactory
+ * @param imageRepo String, path to image to check, includes repo path and image name
+ * @param tag String, tag to check
+ * @param artifactoryCreds String, artifactory creds to use. Optional, default is 'artifactory'
+ */
+def imageExists(String artifactoryURL, String imageRepo, String tag, String artifactoryCreds = 'artifactory') {
+    def url = artifactoryURL + '/v2/' + imageRepo + '/manifest/' + tag
+    def result
+    withCredentials([
+            [$class          : 'UsernamePasswordMultiBinding',
+             credentialsId   : artifactoryCreds,
+             passwordVariable: 'ARTIFACTORY_PASSWORD',
+             usernameVariable: 'ARTIFACTORY_LOGIN']
+    ]) {
+        result = sh(script: "bash -c \"curl -X GET -u ${ARTIFACTORY_LOGIN}:${ARTIFACTORY_PASSWORD} \'${url}\'\"",
+                returnStdout: true).trim()
+    }
+    def properties = new groovy.json.JsonSlurperClassic().parseText(result)
+    return properties.get("errors") ? false : true
+}
+
+/**
  * Find docker images by tag
  * Returns Array of image' hashes with names as full path in @repo
  *
diff --git a/src/com/mirantis/mcp/Validate.groovy b/src/com/mirantis/mcp/Validate.groovy
index 48f73a7..29402fe 100644
--- a/src/com/mirantis/mcp/Validate.groovy
+++ b/src/com/mirantis/mcp/Validate.groovy
@@ -828,7 +828,7 @@
  * @param repo_url          Repository url to clone
  * @param proxy             Proxy address to use
  */
-def prepareVenv(repo_url, proxy) {
+def prepareVenv(repo_url, proxy, useSystemPackages=false) {
     def python = new com.mirantis.mk.Python()
     repo_name = "${repo_url}".tokenize("/").last()
     if (repo_url.tokenize().size() > 1){
@@ -845,7 +845,7 @@
     if (proxy != 'offline') {
         withEnv(["HTTPS_PROXY=${proxy}", "HTTP_PROXY=${proxy}", "https_proxy=${proxy}", "http_proxy=${proxy}"]) {
             sh "git clone ${repo_url}"
-            python.setupVirtualenv(path_venv, "python2", [], path_req, true)
+            python.setupVirtualenv(path_venv, "python2", [], path_req, true, useSystemPackages)
         }
     }
     else {
diff --git a/src/com/mirantis/mk/Orchestrate.groovy b/src/com/mirantis/mk/Orchestrate.groovy
index ce5f7f3..dea0366 100644
--- a/src/com/mirantis/mk/Orchestrate.groovy
+++ b/src/com/mirantis/mk/Orchestrate.groovy
@@ -719,7 +719,9 @@
     salt.fullRefresh(master, gerrit_compound)
     salt.fullRefresh(master, jenkins_compound)
 
-    salt.enforceState(master, "I@docker:swarm:role:master and I@jenkins:client ${extra_tgt}", 'docker.client', true, true, null, false, -1, 2)
+    // Temporary exclude cfg node from docker.client state (PROD-24934)
+    def dockerClientExclude = !salt.getPillar(master, 'I@salt:master', 'docker:client:stack:jenkins').isEmpty() ? 'and not I@salt:master' : ''
+    salt.enforceState(master, "I@docker:swarm:role:master and I@jenkins:client ${dockerClientExclude} ${extra_tgt}", 'docker.client', true, true, null, false, -1, 2)
 
     // API timeout in minutes
     def wait_timeout = 10
diff --git a/src/com/mirantis/mk/SaltModelTesting.groovy b/src/com/mirantis/mk/SaltModelTesting.groovy
index eb6e546..156034b 100644
--- a/src/com/mirantis/mk/SaltModelTesting.groovy
+++ b/src/com/mirantis/mk/SaltModelTesting.groovy
@@ -31,7 +31,9 @@
     def runFinally = config.get('runFinally', [:])
     def baseRepoPreConfig = config.get('baseRepoPreConfig', true)
     def dockerContainerName = config.get('dockerContainerName', defaultContainerName)
-    def dockerImageName = config.get('image', "mirantis/salt:saltstack-ubuntu-xenial-salt-2017.7")
+    //  def dockerImageName = config.get('image', "mirantis/salt:saltstack-ubuntu-xenial-salt-2017.7")
+    // FIXME /PROD-25244
+    def dockerImageName = config.get('image', "docker-dev-virtual.docker.mirantis.net/mirantis/salt:saltstack-ubuntu-xenial-salt-2017.7")
     def dockerMaxCpus = config.get('dockerMaxCpus', 4)
     def dockerExtraOpts = config.get('dockerExtraOpts', [])
     def envOpts = config.get('envOpts', [])