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
|
|
|
|
2018-10-09 17:09:55 +02:00
|
|
|
import groovy.transform.Field
|
|
|
|
|
2018-11-29 10:54:05 +02:00
|
|
|
@Field STEP_NAME = getClass().getName()
|
2018-10-09 17:09:55 +02:00
|
|
|
|
2018-08-30 16:33:07 +02:00
|
|
|
void call(Map parameters = [:]) {
|
2019-03-20 12:21:06 +02:00
|
|
|
if(!DefaultValueCache.getInstance() || parameters.customDefaults) {
|
|
|
|
def defaultValues = [:]
|
|
|
|
def configFileList = ['default_pipeline_environment.yml']
|
|
|
|
def customDefaults = parameters.customDefaults
|
2018-06-20 12:00:28 +02:00
|
|
|
|
2019-03-20 12:21:06 +02:00
|
|
|
if(customDefaults in String)
|
|
|
|
customDefaults = [customDefaults]
|
|
|
|
if(customDefaults in List)
|
|
|
|
configFileList += customDefaults
|
|
|
|
for (def configFileName : configFileList){
|
|
|
|
if(configFileList.size() > 1) echo "Loading configuration file '${configFileName}'"
|
|
|
|
def configuration = readYaml text: libraryResource(configFileName)
|
|
|
|
defaultValues = MapUtils.merge(
|
|
|
|
MapUtils.pruneNulls(defaultValues),
|
|
|
|
MapUtils.pruneNulls(configuration))
|
2017-12-06 13:03:06 +02:00
|
|
|
}
|
2019-03-20 12:21:06 +02:00
|
|
|
DefaultValueCache.createInstance(defaultValues)
|
2017-12-06 13:03:06 +02:00
|
|
|
}
|
|
|
|
}
|