Merge "[CVP] Fix cvp-perf job for xrally 0.11.2" into release/proposed/2019.2.0
diff --git a/src/com/mirantis/mcp/Validate.groovy b/src/com/mirantis/mcp/Validate.groovy
index 0be4c36..a5fa817 100644
--- a/src/com/mirantis/mcp/Validate.groovy
+++ b/src/com/mirantis/mcp/Validate.groovy
@@ -33,34 +33,55 @@
/**
* Run docker container with parameters
*
- * @param target Host to run container
- * @param dockerImageLink Docker image link. May be custom or default rally image
- * @param name Name for container
- * @param env_var Environment variables to set in container
- * @param entrypoint Set entrypoint to /bin/bash or leave default
+ * @param target Host to run container
+ * @param dockerImageLink Docker image link. May be custom or default rally image
+ * @param name Name for container
+ * @param env_var Environment variables to set in container
+ * @param entrypoint Set entrypoint to /bin/bash or leave default
+ * @param mounts Map with mounts for container
**/
-
-def runContainer(master, target, dockerImageLink, name='cvp', env_var=[], entrypoint=true){
- def salt = new com.mirantis.mk.Salt()
+def runContainer(Map params){
def common = new com.mirantis.mk.Common()
+ defaults = ["name": "cvp", "env_var": [], "entrypoint": true]
+ params = defaults + params
+ def salt = new com.mirantis.mk.Salt()
def variables = ''
def entry_point = ''
- def cluster_name = salt.getPillar(master, 'I@salt:master', '_param:cluster_name')['return'][0].values()[0]
- if ( salt.cmdRun(master, target, "docker ps -f name=${name} -q", false, null, false)['return'][0].values()[0] ) {
- salt.cmdRun(master, target, "docker rm -f ${name}")
+ def tempest_conf_mount = ''
+ def mounts = ''
+ def cluster_name = salt.getPillar(params.master, 'I@salt:master', '_param:cluster_name')['return'][0].values()[0]
+ default_mounts = ["/etc/ssl/certs/": "/etc/ssl/certs/",
+ "/srv/salt/pki/${cluster_name}/": "/etc/certs",
+ "/root/test/": "/root/tempest/",
+ "/tmp/": "/tmp/",
+ "/etc/hosts": "/etc/hosts"]
+ params.mounts = default_mounts + params.mounts
+ if ( salt.cmdRun(params.master, params.target, "docker ps -f name=${params.name} -q", false, null, false)['return'][0].values()[0] ) {
+ salt.cmdRun(params.master, params.target, "docker rm -f ${params.name}")
}
- if (env_var.size() > 0) {
- variables = ' -e ' + env_var.join(' -e ')
+ if (params.env_var.size() > 0) {
+ variables = ' -e ' + params.env_var.join(' -e ')
}
- if (entrypoint) {
+ if (params.entrypoint) {
entry_point = '--entrypoint /bin/bash'
}
- salt.cmdRun(master, target, "docker run -tid --net=host --name=${name} " +
- "-u root ${entry_point} ${variables} " +
- "-v /srv/salt/pki/${cluster_name}/:/etc/certs ${dockerImageLink}")
+ params.mounts.each { local, container ->
+ mounts = mounts + " -v ${local}:${container}"
+ }
+ salt.cmdRun(params.master, params.target, "docker run -tid --net=host --name=${params.name}" +
+ "${mounts} -u root ${entry_point} ${variables} ${params.dockerImageLink}")
}
+def runContainer(master, target, dockerImageLink, name='cvp', env_var=[], entrypoint=true, mounts=[:]){
+ def common = new com.mirantis.mk.Common()
+ common.infoMsg("This method will be deprecated. Convert you method call to use Map as input parameter")
+ // Convert to Map
+ params = ['master': master, 'target': target, 'dockerImageLink': dockerImageLink, 'name': name, 'env_var': env_var,
+ 'entrypoint': entrypoint, 'mounts': mounts]
+ // Call new method with Map as parameter
+ return runContainer(params)
+}
/**
* Get v2 Keystone credentials from pillars
@@ -640,21 +661,24 @@
tempest_endpoint_type="internalURL", tempest_version="",
conf_script_path="", ext_variables = [], container_name="cvp") {
def salt = new com.mirantis.mk.Salt()
+ def common = new com.mirantis.mk.Common()
if (testing_tools_repo != "" ) {
+ workdir = ''
if (testing_tools_repo.contains('http://') || testing_tools_repo.contains('https://')) {
salt.cmdRun(master, target, "docker exec ${container_name} git clone ${testing_tools_repo} cvp-configuration")
configure_script = conf_script_path != "" ? conf_script_path : "cvp-configuration/configure.sh"
}
else {
configure_script = testing_tools_repo
+ workdir = ' -w /var/lib/'
}
ext_variables.addAll("PROXY=${proxy}", "TEMPEST_REPO=${tempest_repo}",
"TEMPEST_ENDPOINT_TYPE=${tempest_endpoint_type}",
"tempest_version=${tempest_version}")
- salt.cmdRun(master, target, "docker exec -e " + ext_variables.join(' -e ') + " ${container_name} bash -c ${configure_script}")
+ salt.cmdRun(master, target, "docker exec -e " + ext_variables.join(' -e ') + " ${workdir} ${container_name} bash -c ${configure_script}")
}
else {
- common.infoMsg("TOOLS_REPO is empty, no confguration is needed for container")
+ common.infoMsg("TOOLS_REPO is empty, no configuration is needed for this container")
}
}
@@ -807,10 +831,12 @@
* Find vip on nodes
*
* @param target Host with cvp container
+ * @param container_name Name of container
+ * @param script_path Path to cleanup script (inside container)
*/
-def openstack_cleanup(master, target, script_path="/home/rally/cvp-configuration/cleanup.sh") {
+def openstack_cleanup(master, target, container_name="cvp", script_path="/home/rally/cleanup.sh") {
def salt = new com.mirantis.mk.Salt()
- salt.runSaltProcessStep(master, "${target}", 'cmd.run', ["docker exec cvp bash -c ${script_path}"])
+ salt.runSaltProcessStep(master, "${target}", 'cmd.run', ["docker exec ${container_name} bash -c ${script_path}"])
}
diff --git a/src/com/mirantis/mk/Orchestrate.groovy b/src/com/mirantis/mk/Orchestrate.groovy
index d0d0b1e..ebd403e 100644
--- a/src/com/mirantis/mk/Orchestrate.groovy
+++ b/src/com/mirantis/mk/Orchestrate.groovy
@@ -785,8 +785,10 @@
}
// Jenkins
- def jenkins_master_url_pillar = salt.getPillar(master, jenkins_compound, '_param:jenkins_master_url')
- jenkins_master_url = salt.getReturnValues(jenkins_master_url_pillar)
+ def jenkins_master_host = salt.getReturnValues(salt.getPillar(master, jenkins_compound, '_param:jenkins_master_host'))
+ def jenkins_master_port = salt.getReturnValues(salt.getPillar(master, jenkins_compound, '_param:jenkins_master_port'))
+ def jenkins_master_protocol = salt.getReturnValues(salt.getPillar(master, jenkins_compound, '_param:jenkins_master_protocol'))
+ jenkins_master_url = "${jenkins_master_protocol}://${jenkins_master_host}:${jenkins_master_port}"
timeout(wait_timeout) {
common.infoMsg('Waiting for Jenkins to come up..')