mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-14 11:03:09 +02:00
Merge pull request #181 from marcusholl/pr/streamlineScript
Streamline and fix usage of script
This commit is contained in:
commit
d3dde491f6
@ -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
|
||||
|
||||
|
@ -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\').')
|
||||
|
@ -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').")
|
||||
|
@ -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').")
|
||||
|
Loading…
Reference in New Issue
Block a user