Add private key to docker/tests to access OSM instance
Some of the tests require access to OSM instance in order
to run some commands from there. Those commands could be run
using ssh, but a private key is required to be able connect to
that OSM instance.
This change gets the private key corresponding to the public key in
OSM instance and mounts it in docker/tests so that the container can
access to OSM instance via ssh and run commands there.
Change-Id: Id12ede582d5e519afbc41647b90d192b80cf8fcf
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
diff --git a/docker/tests/Dockerfile b/docker/tests/Dockerfile
index da51572..4a17bab 100644
--- a/docker/tests/Dockerfile
+++ b/docker/tests/Dockerfile
@@ -89,6 +89,9 @@
# Juju data folder
ENV JUJU_DATA=/root/.local/share/juju
+# OSM RSA file
+ENV OSM_RSA_FILE=/root/osm_id_rsa
+
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
diff --git a/jenkins/ci-pipelines/ci_stage_3.groovy b/jenkins/ci-pipelines/ci_stage_3.groovy
index d9c687c..8804cee 100644
--- a/jenkins/ci-pipelines/ci_stage_3.groovy
+++ b/jenkins/ci-pipelines/ci_stage_3.groovy
@@ -56,10 +56,23 @@
////////////////////////////////////////////////////////////////////////////////////////
// Helper Functions
////////////////////////////////////////////////////////////////////////////////////////
-def run_robot_systest(tagName,testName,osmHostname,prometheusHostname,prometheus_port=null,envfile=null,portmappingfile=null,jujudata=null,kubeconfig=null,clouds=null,hostfile=null,jujuPassword=null,pass_th='0.0',unstable_th='0.0') {
- tempdir = sh(returnStdout: true, script: "mktemp -d").trim()
- if ( !envfile )
- {
+void run_robot_systest(String tagName,
+ String testName,
+ String osmHostname,
+ String prometheusHostname,
+ Integer prometheusPort=null,
+ String envfile=null,
+ String portmappingfile=null,
+ String jujudata=null,
+ String kubeconfig=null,
+ String clouds=null,
+ String hostfile=null,
+ String jujuPassword=null,
+ String osmRSAfile=null,
+ String passThreshold='0.0',
+ String unstableThreshold='0.0') {
+ tempdir = sh(returnStdout: true, script: 'mktemp -d').trim()
+ if ( !envfile ) {
sh(script: "touch ${tempdir}/env")
envfile="${tempdir}/env"
}
@@ -78,7 +91,7 @@
}
try {
- sh "docker run --env OSM_HOSTNAME=${osmHostname} --env PROMETHEUS_HOSTNAME=${prometheusHostname} ${PROMETHEUS_PORT_VAR} ${JUJU_PASSWORD_VAR} --env-file ${envfile} -v ${clouds}:/etc/openstack/clouds.yaml -v ${jujudata}:/root/.local/share/juju -v ${kubeconfig}:/root/.kube/config -v ${tempdir}:/robot-systest/reports -v ${portmappingfile}:/root/port-mapping.yaml ${hostfilemount} opensourcemano/tests:${tagName} -c -t ${testName}"
+ sh "docker run --env OSM_HOSTNAME=${osmHostname} --env PROMETHEUS_HOSTNAME=${prometheusHostname} ${PROMETHEUS_PORT_VAR} ${JUJU_PASSWORD_VAR} --env-file ${envfile} -v ${clouds}:/etc/openstack/clouds.yaml -v ${jujudata}:/root/.local/share/juju -v ${osmRSAfile}:/root/osm_id_rsa -v ${kubeconfig}:/root/.kube/config -v ${tempdir}:/robot-systest/reports -v ${portmappingfile}:/root/port-mapping.yaml ${hostfilemount} opensourcemano/tests:${tagName} -c -t ${testName}"
} finally {
sh "cp ${tempdir}/* ."
outputDirectory = sh(returnStdout: true, script: "pwd").trim()
@@ -537,6 +550,7 @@
params.CLOUDS,
hostfile,
jujuPassword,
+ SSH_KEY,
params.ROBOT_PASS_THRESHOLD,
params.ROBOT_UNSTABLE_THRESHOLD
)