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}")
])
}
+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'
if ( params.DO_BUILD ) {
stage("Build") {
sh "make -C docker clean"
- sh "make -C -j `nproc` docker Q= CMD_DOCKER_ARGS= TAG=${container_name} RELEASE=${params.RELEASE} REPOSITORY_BASE=${repo_base_url} REPOSITORY_KEY=${params.REPO_KEY_NAME} REPOSITORY=${params.REPO_DISTRO}"
+ sh "make -C docker -j `nproc` Q= CMD_DOCKER_ARGS= TAG=${container_name} RELEASE=${params.RELEASE} REPOSITORY_BASE=${repo_base_url} REPOSITORY_KEY=${params.REPO_KEY_NAME} REPOSITORY=${params.REPO_DISTRO}"
}
}
} //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 {