From abe5d02605ed31fb8d68d116bd7b14d5490ca86d Mon Sep 17 00:00:00 2001 From: Damien Duportal Date: Thu, 7 Nov 2024 10:00:02 +0100 Subject: [PATCH] chore(Jenkinsfile) capture azcopy logs when deployment fails (#1989) --- Jenkinsfile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a8fe8f6fe..0cca522b2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -146,14 +146,19 @@ pipeline { --put-md5 \ --local-hash-storage-mode=HiddenFiles \ ./plugins/plugin-site/public/ "${FILESHARE_SIGNED_URL}" - - # Retrieve azcopy logs to archive them - cat /home/jenkins/.azcopy/*.log > azcopy.log ''' - archiveArtifacts 'azcopy.log' } } } + post { + failure { + // Retrieve azcopy logs and archive them when deployment fails + sh ''' + cat /home/jenkins/.azcopy/*.log > azcopy.log + ''' + archiveArtifacts 'azcopy.log' + } + } } } }