+ while (IP_ADDRESS == '') {
+ output = sh(returnStdout: true, script: """#!/bin/sh -e
+ for line in `grep OS ~/hive/robot-systest.cfg | grep -v OS_CLOUD` ; do export \$line ; done
+ openstack server show ${server_id}
+ """).trim()
+ IP_ADDRESS = get_value('addresses', output)
+ }
+ IP_ADDRESS = IP_ADDRESS.split('=')[1]
+ println("Waiting for VM at ${IP_ADDRESS} to be reachable")
+
+ alive = false
+ timeout(time: 1, unit: 'MINUTES') {
+ while (!alive) {
+ output = sh(
+ returnStatus: true,
+ script: "ssh -T -i ${SSH_KEY} " +
+ "-o StrictHostKeyChecking=no " +
+ "-o UserKnownHostsFile=/dev/null " +
+ "-o ConnectTimeout=5 ubuntu@${IP_ADDRESS} 'echo Alive'")
+ alive = (output == 0)
+ }
+ }
+ println('VM is ready and accepting ssh connections')
+
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ println('Applying sshd config workaround for Ubuntu 22.04 and old jsch client in Jenkins...')
+
+ sh( returnStatus: true,
+ script: "ssh -T -i ${SSH_KEY} " +
+ "-o StrictHostKeyChecking=no " +
+ "-o UserKnownHostsFile=/dev/null " +
+ "ubuntu@${IP_ADDRESS} " +
+ "'echo HostKeyAlgorithms +ssh-rsa | sudo tee -a /etc/ssh/sshd_config'")
+ sh( returnStatus: true,
+ script: "ssh -T -i ${SSH_KEY} " +
+ "-o StrictHostKeyChecking=no " +
+ "-o UserKnownHostsFile=/dev/null " +
+ "ubuntu@${IP_ADDRESS} " +
+ "'echo PubkeyAcceptedKeyTypes +ssh-rsa | sudo tee -a /etc/ssh/sshd_config'")
+ sh( returnStatus: true,
+ script: "ssh -T -i ${SSH_KEY} " +
+ "-o StrictHostKeyChecking=no " +
+ "-o UserKnownHostsFile=/dev/null " +
+ "ubuntu@${IP_ADDRESS} " +
+ "'sudo systemctl restart sshd'")
+ //////////////////////////////////////////////////////////////////////////////////////////////
+
+ } // stage("Spawn Remote VM")
+
+///////////////////////////////////////////////////////////////////////////////////////
+// Checks before installation
+///////////////////////////////////////////////////////////////////////////////////////
+ stage('Checks before installation') {
+ remote = [
+ name: containerName,
+ host: IP_ADDRESS,
+ user: 'ubuntu',
+ identityFile: SSH_KEY,
+ allowAnyHosts: true,
+ logLevel: 'INFO',
+ pty: true
+ ]
+
+ // Ensure the VM is ready
+ sshCommand remote: remote, command: 'cloud-init status --wait'
+ // Force time sync to avoid clock drift and invalid certificates
+ sshCommand remote: remote, command: 'sudo apt-get -y update'
+ sshCommand remote: remote, command: 'sudo apt-get -y install chrony'
+ sshCommand remote: remote, command: 'sudo service chrony stop'
+ sshCommand remote: remote, command: 'sudo chronyd -vq'
+ sshCommand remote: remote, command: 'sudo service chrony start'
+
+ } // stage("Checks before installation")
+///////////////////////////////////////////////////////////////////////////////////////
+// Installation
+///////////////////////////////////////////////////////////////////////////////////////
+ stage('Install') {