From e7bf3b1b0f0b406f9fe334d01b29bbf104c61a87 Mon Sep 17 00:00:00 2001 From: Alejandra Ferreiro Vidal Date: Mon, 19 Feb 2018 19:27:53 +0100 Subject: [PATCH] mtaJarLocation as step configuration --- src/com/sap/piper/ConfigurationMerger.groovy | 15 --------------- test/groovy/MTABuildTest.groovy | 6 +++--- vars/mtaBuild.groovy | 7 +------ 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/src/com/sap/piper/ConfigurationMerger.groovy b/src/com/sap/piper/ConfigurationMerger.groovy index 9f6c2c220..35360ef5c 100644 --- a/src/com/sap/piper/ConfigurationMerger.groovy +++ b/src/com/sap/piper/ConfigurationMerger.groovy @@ -46,19 +46,4 @@ class ConfigurationMerger { 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 - } } diff --git a/test/groovy/MTABuildTest.groovy b/test/groovy/MTABuildTest.groovy index 8fa35a03d..d3de58d58 100644 --- a/test/groovy/MTABuildTest.groovy +++ b/test/groovy/MTABuildTest.groovy @@ -178,13 +178,13 @@ public class MTABuildTest extends BasePipelineTest { @Test void mtaJarLocationFromCustomStepConfigurationTest() { - cpe.configuration = [general:[mtaJarLocation: '/general/mta']] + cpe.configuration = [steps:[mtaBuild:[mtaJarLocation: '/step/mta']]] mtaBuildScript.call(script: [commonPipelineEnvironment: cpe], buildTarget: 'NEO') - assert jscr.shell[1].contains('-jar /general/mta/mta.jar --mtar') - assert jlr.log.contains('[mtaBuild] MTA JAR "/general/mta/mta.jar" retrieved from configuration.') + assert jscr.shell[1].contains('-jar /step/mta/mta.jar --mtar') + assert jlr.log.contains('[mtaBuild] MTA JAR "/step/mta/mta.jar" retrieved from configuration.') } diff --git a/vars/mtaBuild.groovy b/vars/mtaBuild.groovy index 9fc1b9170..096659092 100644 --- a/vars/mtaBuild.groovy +++ b/vars/mtaBuild.groovy @@ -12,10 +12,7 @@ def call(Map parameters = [:]) { ] Set stepConfigurationKeys = [ - 'buildTarget' - ] - - Set generalConfigurationKeys = [ + 'buildTarget', 'mtaJarLocation' ] @@ -27,10 +24,8 @@ def call(Map parameters = [:]) { final Map stepConfiguration = ConfigurationLoader.stepConfiguration(script, stepName) final Map stepDefaults = ConfigurationLoader.defaultStepConfiguration(script, stepName) - final Map generalConfiguration = ConfigurationLoader.generalConfiguration(script) final Map configuration = ConfigurationMerger.merge( parameters, parameterKeys, - generalConfiguration, generalConfigurationKeys, [:], stepConfiguration, stepConfigurationKeys, stepDefaults) def mtaYaml = readYaml file: "${pwd()}/mta.yaml"