Merge "Return error in promoteDockerArtifact fct when promote failed"
diff --git a/src/com/mirantis/mcp/MCPArtifactory.groovy b/src/com/mirantis/mcp/MCPArtifactory.groovy
index 7820135..0101eb8 100644
--- a/src/com/mirantis/mcp/MCPArtifactory.groovy
+++ b/src/com/mirantis/mcp/MCPArtifactory.groovy
@@ -47,13 +47,13 @@
def properties_str = ''
for (int i = 0; i < properties.size(); i++) {
// avoid serialization errors
- key = properties.entrySet().toArray()[i].key
- value = properties.entrySet().toArray()[i].value
- properties_str += "${key}=${value}&"
+ key = properties.entrySet().toArray()[i].key.trim()
+ value = properties.entrySet().toArray()[i].value.trim()
+ properties_str += /${key}=${value}&/
}
def search_url = "${artifactoryURL}/api/search/prop?${properties_str}"
- def result = sh(script: "bash -c \"curl -X GET \'${search_url}\'\"",
+ def result = sh(script: /curl -X GET '${search_url}'/,
returnStdout: true).trim()
def content = new groovy.json.JsonSlurperClassic().parseText(result)
def uri = content.get("results")
diff --git a/src/com/mirantis/mcp/Validate.groovy b/src/com/mirantis/mcp/Validate.groovy
index f04e21e..d1188de 100644
--- a/src/com/mirantis/mcp/Validate.groovy
+++ b/src/com/mirantis/mcp/Validate.groovy
@@ -675,10 +675,22 @@
repo_name = repo_url.tokenize()[0].tokenize("/").last()
}
}
+ path_venv = "${env.WORKSPACE}/venv"
+ path_req = "${env.WORKSPACE}/${repo_name}/requirements.txt"
sh "rm -rf ${repo_name}"
- withEnv(["HTTPS_PROXY=${proxy}", "HTTP_PROXY=${proxy}", "https_proxy=${proxy}", "http_proxy=${proxy}"]) {
+ // this is temporary W/A for offline deployments
+ // Jenkins slave image has /opt/pip-mirror/ folder
+ // where pip wheels for cvp projects are located
+ 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)
+ }
+ }
+ else {
sh "git clone ${repo_url}"
- python.setupVirtualenv("${env.WORKSPACE}/venv", "python2", [], "${env.WORKSPACE}/${repo_name}/requirements.txt", true)
+ sh "virtualenv ${path_venv} --python python2"
+ python.runVirtualenvCommand(path_venv, "pip install --no-index --find-links=/opt/pip-mirror/ -r ${path_req}", true)
}
}