X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=jenkins%2Fci-pipelines%2Fci_helper.groovy;fp=jenkins%2Fci-pipelines%2Fci_helper.groovy;h=0b41169daf213fe01eae66a7768f09b38c33f9f3;hb=a4c063d6e0aae64bd82bf3f5c4d87cf795f91774;hp=c920f46be4bd87127a03f4f7a12cd304da3c1138;hpb=f8c3ce569b2b7fe824a15cf4e3d6c6876d9a0a5d;p=osm%2Fdevops.git diff --git a/jenkins/ci-pipelines/ci_helper.groovy b/jenkins/ci-pipelines/ci_helper.groovy index c920f46b..0b41169d 100644 --- a/jenkins/ci-pipelines/ci_helper.groovy +++ b/jenkins/ci-pipelines/ci_helper.groovy @@ -69,7 +69,24 @@ def lxc_file_push(container_name,file,destination) { def start_http_server(repo_dir,server_name,port) { sh "docker run -dit --name ${server_name} -p ${port}:80 -v ${repo_dir}:/usr/local/apache2/htdocs/ httpd:2.4" def http_server_ip = sh(returnStdout:true, script: "docker inspect --format '{{ .NetworkSettings.IPAddress }}' ${server_name}").trim() - return "http://${http_server_ip}/" + return "http://${http_server_ip}:${port}/" +} + +def check_status_http_server(ip, port) { + alive = false + timeout(time: 1, unit: 'MINUTES') { + while (!alive) { + output = sh( + returnStatus: true, + script: "wget http://${ip}:${port}/release/dists/unstable/Release") + alive = (output == 0) + if (!alive) { + sleep(time: 5, unit: 'SECONDS') + } + } + } + println('HTTP server is ready and accepting http connections') + return } def lxc_get_file(container_name,file,destination) {