From: aktas Date: Thu, 27 May 2021 06:47:19 +0000 (+0300) Subject: Adding Juju in the pipeline for Robot tests X-Git-Tag: v10.0.1 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=7d3949795363412f8d116d1dd0f3207b51b407d7;p=osm%2Fdevops.git Adding Juju in the pipeline for Robot tests * Getting Juju data from installed osm * Bind the Juju data to robot-systest container Change-Id: I3fedd01fe0314b59e7b9db625b3fb206ceca4353 Signed-off-by: aktas (cherry picked from commit 20611225b7c1283bc5ce1572b5515e898c6df2b5) --- diff --git a/docker/tests/Dockerfile b/docker/tests/Dockerfile index a2c4378a..371430a8 100644 --- a/docker/tests/Dockerfile +++ b/docker/tests/Dockerfile @@ -38,6 +38,17 @@ ARG OSM_TESTS_URL ARG PYTHON3_OSM_IM_URL ARG PYTHON3_OSMCLIENT_URL +# Installing Juju +ARG JUJU_VERSION_M=2.8 +ARG JUJU_VERSION_R=11 +ARG JUJU_VERSION=$JUJU_VERSION_M.$JUJU_VERSION_R + +RUN curl --output /tmp/juju-$JUJU_VERSION-linux-amd64.tar.xz -LO \ + https://launchpad.net/juju/$JUJU_VERSION_M/$JUJU_VERSION/+download/juju-$JUJU_VERSION-linux-amd64.tar.xz && \ + tar -xf /tmp/juju-$JUJU_VERSION-linux-amd64.tar.xz -C /tmp && \ + install /tmp/juju /usr/local/bin/juju && \ + rm /tmp/juju /tmp/juju-$JUJU_VERSION-linux-amd64.tar.xz + RUN curl $PYTHON3_OSM_IM_URL -o osm_im.deb RUN dpkg -i ./osm_im.deb @@ -77,6 +88,9 @@ ENV ROBOT_REPORT_FOLDER=/robot-systest/results # Kubeconfig file ENV K8S_CREDENTIALS=/root/.kube/config +# Juju data folder +ENV JUJU_DATA=/root/.local/share/juju + 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 bc23e441..d9c687cf 100644 --- a/jenkins/ci-pipelines/ci_stage_3.groovy +++ b/jenkins/ci-pipelines/ci_stage_3.groovy @@ -56,7 +56,7 @@ properties([ //////////////////////////////////////////////////////////////////////////////////////// // Helper Functions //////////////////////////////////////////////////////////////////////////////////////// -def run_robot_systest(tagName,testName,osmHostname,prometheusHostname,prometheus_port=null,envfile=null,portmappingfile=null,kubeconfig=null,clouds=null,hostfile=null,jujuPassword=null,pass_th='0.0',unstable_th='0.0') { +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 ) { @@ -78,7 +78,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 ${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 ${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() @@ -178,6 +178,7 @@ node("${params.NODE}") { server_id = null http_server_name = null devopstempdir = null + jujutempdir = null useCharmedInstaller = params.INSTALLER.equalsIgnoreCase("charmed") try { @@ -490,6 +491,13 @@ node("${params.NODE}") { /usr/share/osm-devops/installers/osm_health.sh -k -s ${stackName} """ } // stage("OSM Health") +/////////////////////////////////////////////////////////////////////////////////////// +// Get juju data from installed OSM in remote vm +/////////////////////////////////////////////////////////////////////////////////////// + jujutempdir = sh(returnStdout: true, script: "mktemp -d").trim() + jujudatafolder = jujutempdir + '/juju' + homefolder = sshCommand remote: remote, command: 'echo ${HOME}' + sshGet remote: remote, from: homefolder + '/.local/share/juju', into: jujutempdir, override: true } // if ( params.DO_INSTALL ) @@ -524,6 +532,7 @@ EOF""" prometheusPort, params.ROBOT_VIM, params.ROBOT_PORT_MAPPING_VIM, + jujudatafolder, params.KUBECONFIG, params.CLOUDS, hostfile, @@ -638,5 +647,9 @@ EOF""" if ( devopstempdir != null ) { sh "rm -rf ${devopstempdir}" } + + if ( jujutempdir != null ) { + sh "rm -rf ${jujutempdir}" + } } }