From 11a8a1e472867d2246228217f6736675e905c5d1 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Thu, 17 Nov 2022 12:58:49 +0100 Subject: [PATCH 1/1] Add logs before removing repo Change-Id: I8d9cde6217f24c7c532bee441ce34f4563697f56 Signed-off-by: garciadeblas --- jenkins/ci-pipelines/ci_helper.groovy | 6 +++--- jenkins/ci-pipelines/ci_stage_3.groovy | 21 ++++++++++++--------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/jenkins/ci-pipelines/ci_helper.groovy b/jenkins/ci-pipelines/ci_helper.groovy index 0b41169d..4f1d32da 100644 --- a/jenkins/ci-pipelines/ci_helper.groovy +++ b/jenkins/ci-pipelines/ci_helper.groovy @@ -39,15 +39,15 @@ def get_archive(artifactory_server, mdg, branch, build_name, build_number, patte def results = server.download(downloadSpec) // Save the list of URLs that we need to pass to the dockerfiles for build def debian_packages = [] - for ( result in results.getDependencies()) { + for ( result in results.getDependencies() ) { if (result.remotePath.contains(".deb")) { debian_packages.add(result.remotePath) } } // workaround. flatten repo to remove specific build num from the directory - sh "cp -R ${branch}/${build_number}/* ." - sh "rm -rf ${branch}/${build_number}" + sh "cp -Rv ${branch}/${build_number}/* ." + sh "rm -rfv ${branch}/${build_number}" return debian_packages } diff --git a/jenkins/ci-pipelines/ci_stage_3.groovy b/jenkins/ci-pipelines/ci_stage_3.groovy index e5159938..3f1190f9 100644 --- a/jenkins/ci-pipelines/ci_stage_3.groovy +++ b/jenkins/ci-pipelines/ci_stage_3.groovy @@ -215,7 +215,10 @@ node("${params.NODE}") { /////////////////////////////////////////////////////////////////////////////////////// stage('Copy Artifacts') { // cleanup any previous repo - sh 'rm -rf repo' + sh "pwd" + sh "tree -fD repo" + sh "lsof repo" + sh "rm -rfv repo" dir('repo') { packageList = [] dir("${RELEASE}") { @@ -725,8 +728,8 @@ EOF""" } // if (params.SAVE_ARTIFACTS_OVERRIDE || stage_archive) } // dir(OSM_DEVOPS) } finally { - stage('Archive Container Logs') { - if ( ARCHIVE_LOGS_FLAG ) { + stage('Archive Container Logs') { + if (ARCHIVE_LOGS_FLAG) { try { // Archive logs remote = [ @@ -746,16 +749,16 @@ EOF""" } // end if ( ARCHIVE_LOGS_FLAG ) } stage('Cleanup') { - if ( params.DO_INSTALL && server_id != null) { + if (params.DO_INSTALL && server_id != null) { delete_vm = true - if (error && params.SAVE_CONTAINER_ON_FAIL ) { + if (error && params.SAVE_CONTAINER_ON_FAIL) { delete_vm = false } - if (!error && params.SAVE_CONTAINER_ON_PASS ) { + if (!error && params.SAVE_CONTAINER_ON_PASS) { delete_vm = false } - if ( delete_vm ) { + if (delete_vm) { if (server_id != null) { println("Deleting VM: $server_id") sh """#!/bin/sh -e @@ -767,12 +770,12 @@ EOF""" } } } - if ( http_server_name != null ) { + if (http_server_name != null) { sh "docker stop ${http_server_name} || true" sh "docker rm ${http_server_name} || true" } - if ( devopstempdir != null ) { + if (devopstempdir != null) { sh "rm -rf ${devopstempdir}" } } -- 2.25.1