From 1f405cf638cf081ca53777336eefb7e245c6ca92 Mon Sep 17 00:00:00 2001 From: Mike Marchetti Date: Fri, 17 Aug 2018 14:43:50 -0400 Subject: [PATCH 1/1] Avoid deleting of lxc container when not installing Change-Id: Icea51817f0c0815ada1abd4ff8690ec0b4b03b5a Signed-off-by: Mike Marchetti --- jenkins/ci-pipelines/ci_stage_3.groovy | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/jenkins/ci-pipelines/ci_stage_3.groovy b/jenkins/ci-pipelines/ci_stage_3.groovy index 52aa3b2f..2e2bf087 100644 --- a/jenkins/ci-pipelines/ci_stage_3.groovy +++ b/jenkins/ci-pipelines/ci_stage_3.groovy @@ -235,15 +235,17 @@ node("${params.NODE}") { finally { sh "docker stop ${http_server_name}" - if (error) { - if ( !params.SAVE_CONTAINER_ON_FAIL ) { - sh "lxc delete ${container_name} --force" + if ( params.DO_INSTALL ) { + if (error) { + if ( !params.SAVE_CONTAINER_ON_FAIL ) { + sh "lxc delete ${container_name} --force" + } + throw error } - throw error - } - else { - if ( !params.SAVE_CONTAINER_ON_PASS ) { - sh "lxc delete ${container_name} --force" + else { + if ( !params.SAVE_CONTAINER_ON_PASS ) { + sh "lxc delete ${container_name} --force" + } } } } -- 2.25.1