+ remote.name = container_name
+ remote.host = IP_ADDRESS
+ remote.user = 'ubuntu'
+ remote.identityFile = SSH_KEY
+ remote.allowAnyHosts = true
+ remote.logLevel = 'INFO'
+ remote.pty = true
+
+ sshCommand remote: remote, command: """
+ wget https://osm-download.etsi.org/ftp/osm-10.0-ten/install_osm.sh
+ chmod +x ./install_osm.sh
+ sed -i '1 i\\export PATH=/snap/bin:\${PATH}' ~/.bashrc
+ """
+
+ if ( useCharmedInstaller ) {
+ // Use local proxy for docker hub
+ sshCommand remote: remote, command: '''
+ sudo snap install microk8s --classic --channel=1.19/stable
+ sudo sed -i "s|https://registry-1.docker.io|http://172.21.1.1:5000|" /var/snap/microk8s/current/args/containerd-template.toml
+ sudo systemctl restart snap.microk8s.daemon-containerd.service
+ sudo snap alias microk8s.kubectl kubectl
+ '''
+
+ withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'gitlab-registry',
+ usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
+ sshCommand remote: remote, command: """
+ ./install_osm.sh -y \
+ ${repo_base_url} \
+ ${repo_key_name} \
+ ${release} -r unstable \
+ --charmed \
+ --registry ${USERNAME}:${PASSWORD}@${INTERNAL_DOCKER_REGISTRY} \
+ --tag ${container_name}
+ """
+ }
+ prometheusHostname = "prometheus."+IP_ADDRESS+".nip.io"
+ prometheusPort = 80
+ osmHostname = "nbi."+IP_ADDRESS+".nip.io:443"
+ } else {
+ // Run -k8s installer here specifying internal docker registry and docker proxy
+ withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'gitlab-registry',
+ usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
+ sshCommand remote: remote, command: """
+ ./install_osm.sh -y \
+ ${repo_base_url} \
+ ${repo_key_name} \
+ ${release} -r unstable \
+ -d ${USERNAME}:${PASSWORD}@${INTERNAL_DOCKER_REGISTRY} \
+ -p ${INTERNAL_DOCKER_PROXY} \
+ -t ${container_name} \
+ --nocachelxdimages
+ """
+ }
+ prometheusHostname = IP_ADDRESS
+ prometheusPort = 9091
+ osmHostname = IP_ADDRESS
+ }
+ } // stage("Install")
+///////////////////////////////////////////////////////////////////////////////////////
+// Health check of installed OSM in remote vm
+///////////////////////////////////////////////////////////////////////////////////////
+ stage("OSM Health") {
+ stackName = "osm"
+ sshCommand remote: remote, command: """
+ /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 )
+
+
+///////////////////////////////////////////////////////////////////////////////////////
+// Execute Robot tests
+///////////////////////////////////////////////////////////////////////////////////////
+ stage_archive = false
+ if ( params.DO_ROBOT ) {
+ try {
+ stage("System Integration Test") {
+ if ( useCharmedInstaller ) {
+ tempdir = sh(returnStdout: true, script: "mktemp -d").trim()
+ sh(script: "touch ${tempdir}/hosts")
+ hostfile="${tempdir}/hosts"
+ sh """cat << EOF > ${hostfile}
+127.0.0.1 localhost
+${remote.host} prometheus.${remote.host}.nip.io nbi.${remote.host}.nip.io
+EOF"""
+ } else {
+ hostfile=null
+ }
+
+ jujuPassword=sshCommand remote: remote, command: """
+ echo `juju gui 2>&1 | grep password | cut -d: -f2`
+ """
+
+ run_robot_systest(
+ container_name,
+ params.ROBOT_TAG_NAME,
+ osmHostname,
+ prometheusHostname,
+ prometheusPort,
+ params.ROBOT_VIM,
+ params.ROBOT_PORT_MAPPING_VIM,
+ jujudatafolder,
+ params.KUBECONFIG,
+ params.CLOUDS,
+ hostfile,
+ jujuPassword,
+ SSH_KEY,
+ params.ROBOT_PASS_THRESHOLD,
+ params.ROBOT_UNSTABLE_THRESHOLD
+ )
+ } // stage("System Integration Test")
+ } finally {
+ stage("Archive Container Logs") {
+ // Archive logs to containers_logs.txt
+ archive_logs(remote)
+ if ( ! currentBuild.result.equals('FAILURE') ) {
+ stage_archive = keep_artifacts
+ } else {
+ println ("Systest test failed, throwing error")
+ error = new Exception("Systest test failed")
+ currentBuild.result = 'FAILURE'
+ throw error
+ }