1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-18 05:18:24 +02:00

add ConfigLoader

This commit is contained in:
Christopher Fenner 2018-03-12 22:21:48 +01:00 committed by GitHub
parent c56f7f4b59
commit 8c72f6c169
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,34 @@
package com.sap.piper
class ConfigurationHelper implements Serializable {
static class ConfigLoader implements Serializable {
private Map config
private String name
ConfigLoader(Script step){
if(!step.STEP_NAME)
throw new IllegalArgumentException('Step has no public name property!')
name = step.STEP_NAME
step.prepareDefaultValues()
config = ConfigurationLoader.defaultStepConfiguration(step, name)
}
ConfigLoader mixinStepConfig(stepWithEnv, Set filter = null){
Map stepConfiguration = ConfigurationLoader.stepConfiguration(stepWithEnv, name)
return mixin(stepConfiguration, filter)
}
ConfigLoader mixin(Map parameters, Set filter = null){
config = ConfigurationMerger.merge(parameters, filter, config)
return this
}
Map use(){ return config }
}
static def loadStepDefaults(Script step){
return new ConfigLoader(step)
}
private final Map config