From 372ec40c643bcbb9ca494c0f5c5c8d8c8bf51dd3 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Tue, 17 Sep 2024 10:13:18 -0700 Subject: [PATCH] Wrap deleteDir() in try/catch This sometimes fails, causing the entire build step to fail. This should hopefully provide more information as to why its failing, as well as also allow the build to succeed. --- Jenkinsfile | 44 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4e7594d..70fda8f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -68,7 +68,11 @@ pipeline { } post { cleanup { - deleteDir() + try { + deleteDir() + } catch (e) { + println e + } } } } @@ -107,7 +111,11 @@ pipeline { cleanup { library("tailor-meta@${params.tailor_meta}") cleanDocker() - deleteDir() + try { + deleteDir() + } catch (e) { + println e + } } } } @@ -156,7 +164,11 @@ pipeline { cleanup { library("tailor-meta@${params.tailor_meta}") cleanDocker() - deleteDir() + try { + deleteDir() + } catch (e) { + println e + } } } } @@ -185,7 +197,11 @@ pipeline { } finally { library("tailor-meta@${params.tailor_meta}") cleanDocker() - deleteDir() + try { + deleteDir() + } catch (e) { + println e + } } }}] } @@ -234,7 +250,11 @@ pipeline { artifacts: "$debian_dir/rules*, $debian_dir/control*, $debian_dir/Dockerfile*", allowEmptyArchive: true) library("tailor-meta@${params.tailor_meta}") cleanDocker() - deleteDir() + try { + deleteDir() + } catch (e) { + println e + } } }}] } @@ -255,7 +275,7 @@ pipeline { docker.withRegistry(params.docker_registry, docker_credentials) { bundle_image.pull() } } bundle_image.inside("-v $HOME/tailor/ccache:/ccache -e CCACHE_DIR=/ccache") { - // Invoke the Jenkins Job Cacher Plugin via the cache method. + // Invoke the Jenkins Job Cacher Plugin via the cache method. cache(caches: [ arbitraryFileCache(path: '${HOME}/tailor/ccache', cacheName: recipe_label) ]) { @@ -274,7 +294,11 @@ pipeline { // archiveArtifacts(artifacts: "*.deb", allowEmptyArchive: true) library("tailor-meta@${params.tailor_meta}") cleanDocker() - deleteDir() + try { + deleteDir() + } catch (e) { + println e + } } }}] } @@ -312,7 +336,11 @@ pipeline { } finally { library("tailor-meta@${params.tailor_meta}") cleanDocker() - deleteDir() + try { + deleteDir() + } catch (e) { + println e + } } }}] }