2017-12-06 13:03:06 +02:00
|
|
|
import com.sap.piper.DefaultValueCache
|
2018-06-20 10:51:48 +02:00
|
|
|
import com.sap.piper.MapUtils
|
2017-12-06 13:03:06 +02:00
|
|
|
|
|
|
|
def call(Map parameters = [:]) {
|
|
|
|
handlePipelineStepErrors (stepName: 'prepareDefaultValues', stepParameters: parameters) {
|
2018-06-20 10:51:48 +02:00
|
|
|
if(!DefaultValueCache.getInstance() || parameters.customDefaults) {
|
2018-06-20 11:16:45 +02:00
|
|
|
def defaultValues = [:]
|
2018-06-20 10:51:48 +02:00
|
|
|
def configurationFiles = ['default_pipeline_environment.yml']
|
|
|
|
def customDefaults = parameters.customDefaults
|
2018-06-20 12:00:28 +02:00
|
|
|
|
|
|
|
if(customDefaults in String)
|
2018-06-20 10:51:48 +02:00
|
|
|
customDefaults = [].plus(customDefaults)
|
2018-06-20 11:16:45 +02:00
|
|
|
if(customDefaults in List)
|
|
|
|
configurationFiles += customDefaults
|
2018-06-20 10:51:48 +02:00
|
|
|
for (def configFileName : configurationFiles){
|
2018-06-20 12:00:28 +02:00
|
|
|
if(configurationFiles.size() > 1) echo "Loading configuration file '${}'"
|
2018-06-20 10:51:48 +02:00
|
|
|
def configuration = readYaml text: libraryResource(configFileName)
|
2018-06-20 11:16:45 +02:00
|
|
|
defaultValues = MapUtils.merge(
|
2018-06-20 11:45:42 +02:00
|
|
|
MapUtils.pruneNulls(defaultValues),
|
|
|
|
MapUtils.pruneNulls(configuration))
|
2018-06-07 09:15:35 +02:00
|
|
|
}
|
2018-06-20 11:16:45 +02:00
|
|
|
DefaultValueCache.createInstance(defaultValues)
|
2017-12-06 13:03:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|