mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-06 04:13:55 +02:00
11a7b24ce8
Asserts that each step (modulo whitelist) comes with a STEP_NAME field.
30 lines
1.2 KiB
Groovy
30 lines
1.2 KiB
Groovy
import com.sap.piper.DefaultValueCache
|
|
import com.sap.piper.MapUtils
|
|
|
|
import groovy.transform.Field
|
|
|
|
@Field STEP_NAME = 'prepareDefaultValues'
|
|
|
|
def call(Map parameters = [:]) {
|
|
handlePipelineStepErrors (stepName: 'prepareDefaultValues', stepParameters: parameters) {
|
|
if(!DefaultValueCache.getInstance() || parameters.customDefaults) {
|
|
def defaultValues = [:]
|
|
def configFileList = ['default_pipeline_environment.yml']
|
|
def customDefaults = parameters.customDefaults
|
|
|
|
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))
|
|
}
|
|
DefaultValueCache.createInstance(defaultValues)
|
|
}
|
|
}
|
|
}
|