1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00

fix(dockerExecuteOnKubernetes) print the error cause if unstash failed and always invalidate (#3142)

Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
Co-authored-by: Pavel Busko <pavel.busko@sap.com>
This commit is contained in:
Pavel Busko 2021-10-06 10:25:50 +02:00 committed by GitHub
parent abd0406fcc
commit 28e0905964
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}
}