X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=jenkins%2Fci-pipelines%2Fci_stage_3.groovy;h=801ddbb05fe0200f4bbb61b7f8ead3e673dfacfb;hb=8d02acc38f50ffba219f1bd2f0787e3ebebf9809;hp=4141f8d49e77e11e2b539b46663419f04e1b43ea;hpb=318551148eb32854ea4959e340eaba56f1f2de5f;p=osm%2Fdevops.git diff --git a/jenkins/ci-pipelines/ci_stage_3.groovy b/jenkins/ci-pipelines/ci_stage_3.groovy index 4141f8d4..801ddbb0 100644 --- a/jenkins/ci-pipelines/ci_stage_3.groovy +++ b/jenkins/ci-pipelines/ci_stage_3.groovy @@ -294,10 +294,13 @@ node("${params.NODE}") { http_server_name = "${container_name}-apache" pwd = sh(returnStdout:true, script: 'pwd').trim() - repo_port = sh(script: 'echo $(python -c \'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()\');', returnStdout: true).trim() - repo_base_url = ci_helper.start_http_server(pwd,http_server_name,repo_port) - NODE_IP_ADDRESS=sh(returnStdout: true, script: + repo_port = sh(script: 'echo $(python -c \'import socket; s=socket.socket(); s.bind(("", 0));' + + 'print(s.getsockname()[1]); s.close()\');', + returnStdout: true).trim() + internal_docker_http_server_url = ci_helper.start_http_server(pwd, http_server_name, repo_port) + NODE_IP_ADDRESS = sh(returnStdout: true, script: "echo ${SSH_CONNECTION} | awk '{print \$3}'").trim() + ci_helper.check_status_http_server(NODE_IP_ADDRESS, repo_port) } // Unpack devops package into temporary location so that we use it from upstream if it was part of a patch @@ -393,10 +396,16 @@ node("${params.NODE}") { println("Waiting for VM at ${IP_ADDRESS} to be reachable") alive = false - while (! alive) { - output=sh(returnStdout: true, script: "sleep 1 ; nc -zv ${IP_ADDRESS} 22 2>&1 || true").trim() - println("output is [$output]") - alive = output.contains("succeeded") + 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") } // stage("Spawn Remote VM") @@ -450,10 +459,10 @@ node("${params.NODE}") { // Force time sync to avoid clock drift and invalid certificates sshCommand remote: remote, command: """ sudo apt update - sudo apt install -y ntp - sudo service ntp stop - sudo ntpd -gq - sudo service ntp start + sudo apt install -y chrony + sudo service chrony stop + sudo chrony -vq + sudo service chrony start """ sshCommand remote: remote, command: """