From 0d2bb41f347d3f09499163674feedc1de411dccf Mon Sep 17 00:00:00 2001 From: Marcus Holl Date: Tue, 12 Dec 2017 15:36:58 +0100 Subject: [PATCH 1/2] Avoid strange behaviour with return value from DefaultValueCache getinstance --- src/com/sap/piper/DefaultValueCache.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/com/sap/piper/DefaultValueCache.groovy b/src/com/sap/piper/DefaultValueCache.groovy index 37fabe27f..7ab6fb80c 100644 --- a/src/com/sap/piper/DefaultValueCache.groovy +++ b/src/com/sap/piper/DefaultValueCache.groovy @@ -1,5 +1,7 @@ package com.sap.piper +import com.cloudbees.groovy.cps.NonCPS + class DefaultValueCache implements Serializable { private static DefaultValueCache instance @@ -9,6 +11,7 @@ class DefaultValueCache implements Serializable { this.defaultValues = defaultValues } + @NonCPS static getInstance(){ return instance } From 8fc4ae7cdc63e01067cf92e988296e58435e6d48 Mon Sep 17 00:00:00 2001 From: Marcus Holl Date: Tue, 12 Dec 2017 16:33:13 +0100 Subject: [PATCH 2/2] Avoid getting the unflattened default values Caused by the missing nonCps annotation the unflatted configuration tree of all the default values was returned. After adding the nonCps annotation we get only the default for either stages or steps and only for the required step/stage. --- src/com/sap/piper/DefaultValueCache.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/src/com/sap/piper/DefaultValueCache.groovy b/src/com/sap/piper/DefaultValueCache.groovy index 7ab6fb80c..a620d3dce 100644 --- a/src/com/sap/piper/DefaultValueCache.groovy +++ b/src/com/sap/piper/DefaultValueCache.groovy @@ -20,6 +20,7 @@ class DefaultValueCache implements Serializable { instance = new DefaultValueCache(defaultValues) } + @NonCPS Map getDefaultValues(){ return defaultValues }