diff --git a/src/com/sap/piper/ConfigurationHelper.groovy b/src/com/sap/piper/ConfigurationHelper.groovy index e09f3cbed..a5a4e0a68 100644 --- a/src/com/sap/piper/ConfigurationHelper.groovy +++ b/src/com/sap/piper/ConfigurationHelper.groovy @@ -9,10 +9,11 @@ class ConfigurationHelper implements Serializable { new ConfigurationHelper(step, config) } - ConfigurationHelper loadStepDefaults() { + ConfigurationHelper loadStepDefaults(Map compatibleParameters = [:]) { this.step.prepareDefaultValues() this.config = ConfigurationLoader.defaultGeneralConfiguration() - mixin(ConfigurationLoader.defaultStepConfiguration(null, name)) + mixin(ConfigurationLoader.defaultGeneralConfiguration(), null, compatibleParameters) + mixin(ConfigurationLoader.defaultStepConfiguration(null, name), null, compatibleParameters) } private Map config @@ -71,11 +72,10 @@ class ConfigurationHelper implements Serializable { } if (configSubMap == null || (configSubMap != null && configSubMap[entry.getKey()] == null)) { def stages = entry.getValue()?.tokenize('.') - def configOldSubMap = configMap - def value = resolveToFlat(stages, configOldSubMap) - def paramName = (paramStructure ? paramStructure + '.' : '') + entry.getKey() + def value = resolveToFlat(stages, configMap) if (value != null) { newConfig[entry.getKey()] = value + def paramName = (paramStructure ? paramStructure + '.' : '') + entry.getKey() this.step.echo ("[INFO] The parameter '${entry.getValue()}' is COMPATIBLE to the parameter '${paramName}'") } } @@ -84,11 +84,12 @@ class ConfigurationHelper implements Serializable { return newConfig } - private String resolveToFlat(List stages, configMap) { + private String resolveToFlat(stages, configMap) { + def first = 0 def result - def configSubMap = configMap[stages[0]] + def configSubMap = configMap[stages[first]] if(configSubMap instanceof Map) { - stages.remove(0) + stages.remove(first) result = resolveToFlat(stages, configSubMap) } else { result = configSubMap diff --git a/vars/whitesourceExecuteScan.groovy b/vars/whitesourceExecuteScan.groovy index 97b2b4c0a..8147268a8 100644 --- a/vars/whitesourceExecuteScan.groovy +++ b/vars/whitesourceExecuteScan.groovy @@ -184,7 +184,7 @@ void call(Map parameters = [:]) { // load default & individual configuration Map config = ConfigurationHelper.newInstance(this) - .loadStepDefaults() + .loadStepDefaults(CONFIG_KEY_COMPATIBILITY) .mixinGeneralConfig(script.commonPipelineEnvironment, GENERAL_CONFIG_KEYS, CONFIG_KEY_COMPATIBILITY) .mixinStepConfig(script.commonPipelineEnvironment, STEP_CONFIG_KEYS, CONFIG_KEY_COMPATIBILITY) .mixinStageConfig(script.commonPipelineEnvironment, parameters.stageName ?: env.STAGE_NAME, STEP_CONFIG_KEYS, CONFIG_KEY_COMPATIBILITY)