From 28e0905964b3f50f475a50c232ee2ac83cb3e9f1 Mon Sep 17 00:00:00 2001 From: Pavel Busko Date: Wed, 6 Oct 2021 10:25:50 +0200 Subject: [PATCH] fix(dockerExecuteOnKubernetes) print the error cause if unstash failed and always invalidate (#3142) Co-authored-by: Ralf Pannemans Co-authored-by: Pavel Busko --- vars/dockerExecuteOnKubernetes.groovy | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vars/dockerExecuteOnKubernetes.groovy b/vars/dockerExecuteOnKubernetes.groovy index 0f25ad36a..3ee7f9a06 100644 --- a/vars/dockerExecuteOnKubernetes.groovy +++ b/vars/dockerExecuteOnKubernetes.groovy @@ -415,13 +415,14 @@ private Map getSecurityContext(Map config) { private void unstashWorkspace(config, prefix) { try { unstash "${prefix}-${config.uniqueId}" - echo "invalidate stash ${prefix}-${config.uniqueId}" - stash name: "${prefix}-${config.uniqueId}", excludes: '**/*', allowEmpty: true } catch (AbortException | IOException e) { - echo "${e.getMessage()}" + echo "${e.getMessage()}\n${e.getCause()}" } catch (Throwable e) { echo "Unstash workspace failed with throwable ${e.getMessage()}" throw e + } finally { + echo "invalidate stash ${prefix}-${config.uniqueId}" + stash name: "${prefix}-${config.uniqueId}", excludes: '**/*', allowEmpty: true } }