X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=jenkins%2Fci-pipelines%2Fci_helper.groovy;h=21a8373f2f0961b41e87861bbeb2e18f5e1d8d4c;hb=ae7f5f30904c98a1aa6653f9e392dcdfe28d5bf3;hp=a7312672872959da68a8671e0355dabb84c5d5d7;hpb=42368e26851ef17f528a7cb9ad92b7b60993c0c4;p=osm%2Fdevops.git diff --git a/jenkins/ci-pipelines/ci_helper.groovy b/jenkins/ci-pipelines/ci_helper.groovy index a7312672..21a8373f 100644 --- a/jenkins/ci-pipelines/ci_helper.groovy +++ b/jenkins/ci-pipelines/ci_helper.groovy @@ -25,7 +25,7 @@ def get_archive(artifactory_server, mdg, branch, build_name, build_number, patte "files": [ { "target": "./", - "pattern": "${repo_prefix}${mdg}/${pattern}", + "pattern": "${repo_prefix}${mdg}/${branch}/${pattern}", "build": "${build_name}/${build_number}" } ] @@ -33,8 +33,8 @@ def get_archive(artifactory_server, mdg, branch, build_name, build_number, patte server.download(downloadSpec) // workaround. flatten and repo the specific build num from the directory - sh "cp -R ${build_num}/* ." - sh "rm -rf ${build_num}" + sh "cp -R ${branch}/${build_num}/* ." + sh "rm -rf ${branch}/${build_num}" } def get_env_value(build_env_file,key) { @@ -45,6 +45,10 @@ def lxc_run(container_name,cmd) { return sh(returnStdout: true, script: "lxc exec ${container_name} -- ${cmd}").trim() } +def lxc_file_push(container_name,file,destination) { + return sh(returnStdout: true, script: "lxc file push ${file} ${container_name}/${destination}").trim() +} + // start a http server // return the http server URL def start_http_server(repo_dir,server_name) { @@ -57,12 +61,22 @@ def lxc_get_file(container_name,file,destination) { sh "lxc file pull ${container_name}/${file} ${destination}" } -def systest_run(container_name, test) { +def systest_run(container_name, test, source_rc = null) { // need to get the SO IP inside the running container so_ip = lxc_run(container_name,"lxc list SO-ub -c 4|grep eth0 |awk '{print \$2}'") + ro_ip = lxc_run(container_name,"lxc list RO -c 4|grep eth0 |awk '{print \$2}'") //container_ip = get_ip_from_container(container_name) - // - lxc_run(container_name, "make -C devops/systest OSM_HOSTNAME=${so_ip} ${test}") + + if ( source_rc ) { + pre_source = "/tmp/" + source_rc.substring(source_rc.lastIndexOf('/')+1) + + lxc_file_push(container_name,source_rc,pre_source) + lxc_run(container_name, "sh -c '. ${pre_source}; make -C devops/systest OSM_HOSTNAME=${so_ip} OSM_RO_HOSTNAME=${ro_ip} ${test}'") + } + else + { + lxc_run(container_name, "make -C devops/systest OSM_HOSTNAME=${so_ip} OSM_RO_HOSTNAME=${ro_ip} ${test}") + } lxc_get_file(container_name, "/root/devops/systest/reports/pytest-${test}.xml",'.') } @@ -79,19 +93,19 @@ def archive(artifactory_server,mdg,branch,status) { "files": [ { "pattern": "dists/*.gz", - "target": "${repo_prefix}${mdg}/${BUILD_NUMBER}/", + "target": "${repo_prefix}${mdg}/${branch}/${BUILD_NUMBER}/", "props": "${properties}", "flat": false }, { "pattern": "dists/*Packages", - "target": "${repo_prefix}${mdg}/${BUILD_NUMBER}/", + "target": "${repo_prefix}${mdg}/${branch}/${BUILD_NUMBER}/", "props": "${properties}", "flat": false }, { "pattern": "pool/*/*.deb", - "target": "${repo_prefix}${mdg}/${BUILD_NUMBER}/", + "target": "${repo_prefix}${mdg}/${branch}/${BUILD_NUMBER}/", "props": "${properties}", "flat": false }]