Bug 2129: Fix logic to always delete VM
[osm/devops.git] / jenkins / ci-pipelines / ci_stage_3.groovy
index 4fea591..d9d1fbd 100644 (file)
@@ -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') {