1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-18 05:18:24 +02:00

Adopt work-around for Jenkins on Kubernetes regarding deleteDir()...

... from SDK pipeline.
This commit is contained in:
Stephan Aßmus 2020-01-22 09:35:17 +01:00
parent ddd10683c4
commit 878e09abbb

View File

@ -99,7 +99,11 @@ private void executeStage(script, originalStage, stageName, config, utils) {
} finally {
//Perform stashing of selected files in workspace
utils.stashList(script, script.commonPipelineEnvironment.configuration.stageStashes?.get(stageName)?.stashes ?: [])
deleteDir()
//NOTE: We do not delete the directory in case Jenkins runs on Kubernetes.
// deleteDir() is not required in pods, but would be nice to have the same behaviour and leave a clean fileSystem.
if (!isInsidePod(script)) {
deleteDir()
}
def duration = System.currentTimeMillis() - startTime
utils.pushToSWA([
@ -162,3 +166,7 @@ private boolean isOldInterceptorInterfaceUsed(Script interceptor) {
MetaMethod method = interceptor.metaClass.pickMethod("call", [Closure.class, String.class, Map.class, Map.class] as Class[])
return method != null
}
private boolean isInsidePod(Script script) {
return script.env.POD_NAME
}