1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00

Merge pull request #91 from alejandraferreirovidal/mtaJarLocationStepConfig

mtaJarLocation as step configuration
This commit is contained in:
Alejandra Ferreiro Vidal 2018-02-20 12:08:44 +01:00 committed by GitHub
commit 9205187631
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 24 deletions

View File

@ -46,19 +46,4 @@ class ConfigurationMerger {
return merged return merged
} }
@NonCPS
def static merge(
Map parameters, Set parameterKeys,
Map generalConfigurationMap, Set generalConfigurationKeys, Map generalConfigurationDefaults,
Map stepConfigurationMap, Set stepConfigurationKeys, Map stepConfigurationDefaults=[:]
){
Map merged
Map mergedStepConfiguration = merge(stepConfigurationMap, stepConfigurationKeys, stepConfigurationDefaults)
Map mergedGeneralConfiguration = merge(generalConfigurationMap, generalConfigurationKeys, generalConfigurationDefaults)
merged = merge(mergedGeneralConfiguration, null, mergedStepConfiguration)
merged = merge(parameters, parameterKeys, merged)
return merged
}
} }

View File

@ -178,13 +178,13 @@ public class MTABuildTest extends BasePipelineTest {
@Test @Test
void mtaJarLocationFromCustomStepConfigurationTest() { void mtaJarLocationFromCustomStepConfigurationTest() {
cpe.configuration = [general:[mtaJarLocation: '/general/mta']] cpe.configuration = [steps:[mtaBuild:[mtaJarLocation: '/step/mta']]]
mtaBuildScript.call(script: [commonPipelineEnvironment: cpe], mtaBuildScript.call(script: [commonPipelineEnvironment: cpe],
buildTarget: 'NEO') buildTarget: 'NEO')
assert jscr.shell[1].contains('-jar /general/mta/mta.jar --mtar') assert jscr.shell[1].contains('-jar /step/mta/mta.jar --mtar')
assert jlr.log.contains('[mtaBuild] MTA JAR "/general/mta/mta.jar" retrieved from configuration.') assert jlr.log.contains('[mtaBuild] MTA JAR "/step/mta/mta.jar" retrieved from configuration.')
} }

View File

@ -12,10 +12,7 @@ def call(Map parameters = [:]) {
] ]
Set stepConfigurationKeys = [ Set stepConfigurationKeys = [
'buildTarget' 'buildTarget',
]
Set generalConfigurationKeys = [
'mtaJarLocation' 'mtaJarLocation'
] ]
@ -27,10 +24,8 @@ def call(Map parameters = [:]) {
final Map stepConfiguration = ConfigurationLoader.stepConfiguration(script, stepName) final Map stepConfiguration = ConfigurationLoader.stepConfiguration(script, stepName)
final Map stepDefaults = ConfigurationLoader.defaultStepConfiguration(script, stepName) final Map stepDefaults = ConfigurationLoader.defaultStepConfiguration(script, stepName)
final Map generalConfiguration = ConfigurationLoader.generalConfiguration(script)
final Map configuration = ConfigurationMerger.merge( final Map configuration = ConfigurationMerger.merge(
parameters, parameterKeys, parameters, parameterKeys,
generalConfiguration, generalConfigurationKeys, [:],
stepConfiguration, stepConfigurationKeys, stepDefaults) stepConfiguration, stepConfigurationKeys, stepDefaults)
def mtaYaml = readYaml file: "${pwd()}/mta.yaml" def mtaYaml = readYaml file: "${pwd()}/mta.yaml"