diff --git a/vars/checkChangeInDevelopment.groovy b/vars/checkChangeInDevelopment.groovy index dc7bfeda9..f8e172789 100644 --- a/vars/checkChangeInDevelopment.groovy +++ b/vars/checkChangeInDevelopment.groovy @@ -2,6 +2,7 @@ import com.sap.piper.GitUtils import groovy.transform.Field import hudson.AbortException +import com.sap.piper.ConfigurationHelper import com.sap.piper.ConfigurationMerger import com.sap.piper.cm.ChangeManagement import com.sap.piper.cm.ChangeManagementException @@ -32,19 +33,25 @@ import com.sap.piper.cm.ChangeManagementException 'gitFormat' ] +@Field Set generalConfigurationKeys = stepConfigurationKeys + def call(parameters = [:]) { handlePipelineStepErrors (stepName: STEP_NAME, stepParameters: parameters) { - prepareDefaultValues script: this + def script = parameters.script ?: [commonPipelineEnvironment: commonPipelineEnvironment] GitUtils gitUtils = parameters?.gitUtils ?: new GitUtils() - ChangeManagement cm = parameters?.cmUtils ?: new ChangeManagement(parameters.script, gitUtils) + ChangeManagement cm = parameters?.cmUtils ?: new ChangeManagement(script, gitUtils) - Map configuration = ConfigurationMerger.merge(parameters.script, STEP_NAME, - parameters, parameterKeys, - stepConfigurationKeys) + Map configuration = ConfigurationHelper + .loadStepDefaults(this) + .mixinGeneralConfig(script.commonPipelineEnvironment, generalConfigurationKeys) + .mixinStageConfig(script.commonPipelineEnvironment, parameters.stageName?:env.STAGE_NAME, stepConfigurationKeys) + .mixinStepConfig(script.commonPipelineEnvironment, stepConfigurationKeys) + .mixin(parameters, parameterKeys) + .use() def changeId = configuration.changeDocumentId diff --git a/vars/transportRequestCreate.groovy b/vars/transportRequestCreate.groovy index f737d9d37..485ffaab6 100644 --- a/vars/transportRequestCreate.groovy +++ b/vars/transportRequestCreate.groovy @@ -1,6 +1,7 @@ import com.sap.piper.GitUtils import groovy.transform.Field +import com.sap.piper.ConfigurationHelper import com.sap.piper.ConfigurationMerger import com.sap.piper.cm.ChangeManagement import com.sap.piper.cm.ChangeManagementException @@ -24,6 +25,8 @@ import hudson.AbortException 'endpoint' ] +@Field generalConfigurationKeys = stepConfigurationKeys + def call(parameters = [:]) { handlePipelineStepErrors (stepName: STEP_NAME, stepParameters: parameters) { @@ -32,9 +35,13 @@ def call(parameters = [:]) { ChangeManagement cm = parameters.cmUtils ?: new ChangeManagement(script) - Map configuration = ConfigurationMerger.merge(parameters.script, STEP_NAME, - parameters, parameterKeys, - stepConfigurationKeys) + Map configuration = ConfigurationHelper + .loadStepDefaults(this) + .mixinGeneralConfig(script.commonPipelineEnvironment, generalConfigurationKeys) + .mixinStageConfig(script.commonPipelineEnvironment, parameters.stageName?:env.STAGE_NAME, stepConfigurationKeys) + .mixinStepConfig(script.commonPipelineEnvironment, stepConfigurationKeys) + .mixin(parameters, parameterKeys) + .use() def changeDocumentId = configuration.changeDocumentId if(!changeDocumentId) throw new AbortException('Change document id not provided (parameter: \'changeDocumentId\').') diff --git a/vars/transportRequestRelease.groovy b/vars/transportRequestRelease.groovy index 03aa7bb47..fa6899b27 100644 --- a/vars/transportRequestRelease.groovy +++ b/vars/transportRequestRelease.groovy @@ -1,6 +1,7 @@ import com.sap.piper.GitUtils import groovy.transform.Field +import com.sap.piper.ConfigurationHelper import com.sap.piper.ConfigurationMerger import com.sap.piper.cm.ChangeManagement import com.sap.piper.cm.ChangeManagementException @@ -24,6 +25,8 @@ import hudson.AbortException 'endpoint' ] +@Field Set generalConfigurationKeys = stepConfigurationKeys + def call(parameters = [:]) { handlePipelineStepErrors (stepName: STEP_NAME, stepParameters: parameters) { @@ -32,9 +35,13 @@ def call(parameters = [:]) { ChangeManagement cm = new ChangeManagement(script) - Map configuration = ConfigurationMerger.merge(script, STEP_NAME, - parameters, parameterKeys, - stepConfigurationKeys) + Map configuration = ConfigurationHelper + .loadStepDefaults(this) + .mixinGeneralConfig(script.commonPipelineEnvironment, generalConfigurationKeys) + .mixinStageConfig(script.commonPipelineEnvironment, parameters.stageName?:env.STAGE_NAME, stepConfigurationKeys) + .mixinStepConfig(script.commonPipelineEnvironment, stepConfigurationKeys) + .mixin(parameters, parameterKeys) + .use() def changeDocumentId = configuration.changeDocumentId if(!changeDocumentId) throw new AbortException("Change document id not provided (parameter: 'changeDocumentId').") diff --git a/vars/transportRequestUploadFile.groovy b/vars/transportRequestUploadFile.groovy index 8984af844..919b2b713 100644 --- a/vars/transportRequestUploadFile.groovy +++ b/vars/transportRequestUploadFile.groovy @@ -1,6 +1,7 @@ import com.sap.piper.GitUtils import groovy.transform.Field +import com.sap.piper.ConfigurationHelper import com.sap.piper.ConfigurationMerger import com.sap.piper.cm.ChangeManagement import com.sap.piper.cm.ChangeManagementException @@ -24,6 +25,8 @@ import hudson.AbortException 'endpoint' ] +@Field Set stepConfigurationKeys = generalConfigurationKeys + def call(parameters = [:]) { handlePipelineStepErrors (stepName: STEP_NAME, stepParameters: parameters) { @@ -32,9 +35,13 @@ def call(parameters = [:]) { ChangeManagement cm = parameters.cmUtils ?: new ChangeManagement(script) - Map configuration = ConfigurationMerger.merge(parameters.script, STEP_NAME, - parameters, parameterKeys, - generalConfigurationKeys) + Map configuration = ConfigurationHelper + .loadStepDefaults(this) + .mixinGeneralConfig(script.commonPipelineEnvironment, generalConfigurationKeys) + .mixinStageConfig(script.commonPipelineEnvironment, parameters.stageName?:env.STAGE_NAME, stepConfigurationKeys) + .mixinStepConfig(script.commonPipelineEnvironment, stepConfigurationKeys) + .mixin(parameters, parameterKeys) + .use() def changeDocumentId = configuration.changeDocumentId if(!changeDocumentId) throw new AbortException("Change document id not provided (parameter: 'changeDocumentId').")