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:
parent
c56f7f4b59
commit
8c72f6c169
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user