From 4ae47aa2766aaaa432c8c77f23e97dbdfd7fb0f6 Mon Sep 17 00:00:00 2001 From: Felipe Vicens Date: Fri, 26 Jun 2020 10:08:25 +0200 Subject: [PATCH] Archive containers logs in robot test execution Change-Id: I71cb7dae8be96076340e41e369b7c650c600cf61 Signed-off-by: Felipe Vicens --- jenkins/ci-pipelines/ci_stage_3.groovy | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/jenkins/ci-pipelines/ci_stage_3.groovy b/jenkins/ci-pipelines/ci_stage_3.groovy index 29b0e0b8..b35e0276 100644 --- a/jenkins/ci-pipelines/ci_stage_3.groovy +++ b/jenkins/ci-pipelines/ci_stage_3.groovy @@ -101,6 +101,13 @@ 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 -i% docker service logs "%" --timestamps > containers_logs.txt 2>&1 + """ + archiveArtifacts artifacts: 'containers_logs.txt' +} + node("${params.NODE}") { sh 'env' @@ -315,7 +322,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 { -- 2.17.1