mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-18 05:18:24 +02:00
only merge lists
This commit is contained in:
parent
e70c40bdfc
commit
7ce0c85fe9
@ -1,32 +1,28 @@
|
||||
import com.sap.piper.DefaultValueCache
|
||||
import com.sap.piper.MapUtils
|
||||
|
||||
import hudson.AbortException
|
||||
|
||||
def call(Map parameters = [:]) {
|
||||
handlePipelineStepErrors (stepName: 'prepareDefaultValues', stepParameters: parameters) {
|
||||
if(!DefaultValueCache.getInstance() || parameters.customDefaults) {
|
||||
def defaultValues = [:]
|
||||
def configurationFiles = ['default_pipeline_environment.yml']
|
||||
def defaultConfiguration = [:]
|
||||
|
||||
def customDefaults = parameters.customDefaults
|
||||
|
||||
if(customDefaults in String) // >> filename resolves to Map
|
||||
customDefaults = [].plus(customDefaults)
|
||||
// customDefaults is Map / null
|
||||
configurationFiles += customDefaults
|
||||
if(customDefaults in List)
|
||||
configurationFiles += customDefaults
|
||||
/*
|
||||
if(defaults instanceof Map) // >> config map
|
||||
defaults = [].plus(defaults)
|
||||
*/
|
||||
//if(configurationFiles in List) // >> list of String / Map
|
||||
for (def configFileName : configurationFiles){
|
||||
def configuration = readYaml text: libraryResource(configFileName)
|
||||
defaultConfiguration = MapUtils.merge(
|
||||
MapUtils.pruneNull(defaultConfiguration),
|
||||
defaultValues = MapUtils.merge(
|
||||
MapUtils.pruneNull(defaultValues),
|
||||
MapUtils.pruneNull(configuration))
|
||||
}
|
||||
|
||||
DefaultValueCache.createInstance(defaultConfiguration)
|
||||
DefaultValueCache.createInstance(defaultValues)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user