X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=jenkins%2Fci-pipelines%2Fci_stage_3.groovy;h=0428fa1e6a9355f9e38be975e97b7e22c9bd97f8;hb=a65a65408ad1a8538090b383322cd896561936f3;hp=58f965fbfa65df578d3204d4a73148b1c5a9fdbf;hpb=c61b88daa74127abafdf384aba2dd245f05cb19e;p=osm%2Fdevops.git diff --git a/jenkins/ci-pipelines/ci_stage_3.groovy b/jenkins/ci-pipelines/ci_stage_3.groovy index 58f965fb..0428fa1e 100644 --- a/jenkins/ci-pipelines/ci_stage_3.groovy +++ b/jenkins/ci-pipelines/ci_stage_3.groovy @@ -84,7 +84,7 @@ def run_robot_systest(stackName,tagName,testName,envfile=null,kubeconfig=null,cl sh(script: "touch ${tempdir}/env") envfile="${tempdir}/env" } - sh "docker run --network net${stackName} --env OSM_HOSTNAME=${stackName}_nbi --env-file ${envfile} -v ${clouds}:/etc/openstack/clouds.yaml -v ${kubeconfig}:/root/.kube/config -v ${tempdir}:/robot-systest/reports opensourcemano/tests:${tagName} -c -t ${testName}" + sh "docker run --network net${stackName} --env OSM_HOSTNAME=${stackName}_nbi --env PROMETHEUS_HOSTNAME=${stackName}_prometheus --env-file ${envfile} -v ${clouds}:/etc/openstack/clouds.yaml -v ${kubeconfig}:/root/.kube/config -v ${tempdir}:/robot-systest/reports opensourcemano/tests:${tagName} -c -t ${testName}" sh "cp ${tempdir}/* ." outputDirectory = sh(returnStdout: true, script: "pwd").trim() println ("Present Directory is : ${outputDirectory}") @@ -101,6 +101,12 @@ def run_robot_systest(stackName,tagName,testName,envfile=null,kubeconfig=null,cl ]) } +def archive_logs(stackName) { + sh "docker service ls |grep \"${stackName}\"| awk '{print \$2}' | xargs -iy docker ps -af name=y --format \"{{.ID}} {{.Names}}\" --no-trunc | awk '{ print \"sudo cp /var/lib/docker/containers/\"\$1\"/\"\$1\"-json.log \"\$2\".log\"}' | xargs -iy bash -c y" + sh "sudo chown jenkins: osm*.log" + archiveArtifacts artifacts: '*.log' +} + node("${params.NODE}") { sh 'env' @@ -315,7 +321,8 @@ node("${params.NODE}") { } //else { run_systest(container_name,container_name,"openstack_stage_4",params.HIVE_VIM_1) //} - + // Archive logs to containers_logs.txt + archive_logs(container_name) if ( ! currentBuild.result.equals('UNSTABLE') && ! currentBuild.result.equals('FAILURE')) { stage_archive = keep_artifacts } else {