From: Mark Beierl Date: Fri, 29 Jul 2022 16:46:18 +0000 (-0400) Subject: Bug 2129: Fix logic to always delete VM X-Git-Tag: release-v13.0-start~62 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=e0f5743b3e1372f5ca96b21a986f6a319ca9fd7d;p=osm%2Fdevops.git Bug 2129: Fix logic to always delete VM Puts the step to extract the container logs into a try/catch block so that the logic to delete the VM and stop the apache container will always execute, instead of leaving them behind on error. Fixes bug 2129 Change-Id: If252670b5374f1665f0e8b649b9fbc16c1ff2705 Signed-off-by: Mark Beierl --- diff --git a/jenkins/ci-pipelines/ci_stage_3.groovy b/jenkins/ci-pipelines/ci_stage_3.groovy index 4fea5919..d9d1fbdf 100644 --- a/jenkins/ci-pipelines/ci_stage_3.groovy +++ b/jenkins/ci-pipelines/ci_stage_3.groovy @@ -682,18 +682,22 @@ EOF""" } finally { stage('Archive Container Logs') { if ( ARCHIVE_LOGS_FLAG ) { - // Archive logs - remote = [ - name: containerName, - host: IP_ADDRESS, - user: 'ubuntu', - identityFile: SSH_KEY, - allowAnyHosts: true, - logLevel: 'INFO', - pty: true - ] - println('Archiving container logs') - archive_logs(remote) + try { + // Archive logs + remote = [ + name: containerName, + host: IP_ADDRESS, + user: 'ubuntu', + identityFile: SSH_KEY, + allowAnyHosts: true, + logLevel: 'INFO', + pty: true + ] + println('Archiving container logs') + archive_logs(remote) + } catch (Exception e) { + println('Error fetching logs: '+ e.getMessage()) + } } // end if ( ARCHIVE_LOGS_FLAG ) } stage('Cleanup') {