Skip to content
Snippets Groups Projects
Commit 2ad64322 authored by garciadeblas's avatar garciadeblas Committed by Mark Beierl
Browse files

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: default avatargarciadeblas <gerardo.garciadeblas@telefonica.com>
parent d680be4f
No related branches found
No related tags found
No related merge requests found
......@@ -89,6 +89,9 @@ ENV K8S_CREDENTIALS=/root/.kube/config
# 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
......
......@@ -56,10 +56,23 @@ properties([
////////////////////////////////////////////////////////////////////////////////////////
// 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 @@ def run_robot_systest(tagName,testName,osmHostname,prometheusHostname,prometheus
}
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 @@ EOF"""
params.CLOUDS,
hostfile,
jujuPassword,
SSH_KEY,
params.ROBOT_PASS_THRESHOLD,
params.ROBOT_UNSTABLE_THRESHOLD
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment