2022-02-17 18:33:12 +02:00
|
|
|
import groovy.transform.Field
|
2020-06-23 15:56:56 +02:00
|
|
|
import com.cloudbees.groovy.cps.NonCPS
|
|
|
|
import com.sap.piper.GenerateStageDocumentation
|
|
|
|
import groovy.transform.Field
|
2022-02-17 18:33:12 +02:00
|
|
|
import com.sap.piper.Utils
|
|
|
|
import com.sap.piper.ConfigurationHelper
|
|
|
|
import com.sap.piper.ConfigurationLoader
|
2020-06-23 15:56:56 +02:00
|
|
|
|
|
|
|
import static com.sap.piper.Prerequisites.checkScript
|
|
|
|
|
|
|
|
@Field String STEP_NAME = getClass().getName()
|
|
|
|
@Field Set GENERAL_CONFIG_KEYS = []
|
|
|
|
@Field STAGE_STEP_KEYS = [
|
2022-05-03 12:52:44 +02:00
|
|
|
/** Creates Communication Arrangements for ABAP Environment instance via the cloud foundry command line interface */
|
|
|
|
'cloudFoundryCreateServiceKey',
|
2020-06-23 15:56:56 +02:00
|
|
|
/** Starts an ATC check run on the ABAP Environment instance */
|
2022-02-17 18:33:12 +02:00
|
|
|
'abapEnvironmentRunATCCheck',
|
|
|
|
/** Creates/Updates ATC System Configuration */
|
|
|
|
'abapEnvironmentPushATCSystemConfig',
|
|
|
|
/** Parameter for ATC System Configuration json */
|
2022-05-03 12:52:44 +02:00
|
|
|
'atcSystemConfigFilePath',
|
|
|
|
/** Parameter for host config */
|
|
|
|
'host'
|
2020-06-23 15:56:56 +02:00
|
|
|
]
|
|
|
|
@Field Set STEP_CONFIG_KEYS = GENERAL_CONFIG_KEYS.plus(STAGE_STEP_KEYS)
|
|
|
|
@Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS
|
|
|
|
/**
|
2022-02-17 18:33:12 +02:00
|
|
|
* This stage runs the ATC Checks & create/update ATC System Configuration before in case File Location provided
|
2020-06-23 15:56:56 +02:00
|
|
|
*/
|
|
|
|
void call(Map parameters = [:]) {
|
|
|
|
def script = checkScript(this, parameters) ?: this
|
|
|
|
def stageName = parameters.stageName?:env.STAGE_NAME
|
|
|
|
|
2022-02-17 18:33:12 +02:00
|
|
|
// load default & individual configuration
|
|
|
|
Map config = ConfigurationHelper.newInstance(this)
|
|
|
|
.loadStepDefaults([:], stageName)
|
|
|
|
.mixin(ConfigurationLoader.defaultStageConfiguration(script, stageName))
|
|
|
|
.mixinGeneralConfig(script.commonPipelineEnvironment, GENERAL_CONFIG_KEYS)
|
|
|
|
.mixinStepConfig(script.commonPipelineEnvironment, STEP_CONFIG_KEYS)
|
|
|
|
.mixinStageConfig(script.commonPipelineEnvironment, stageName, STEP_CONFIG_KEYS)
|
|
|
|
.mixin(parameters, PARAMETER_KEYS)
|
|
|
|
.use()
|
|
|
|
|
2020-06-23 15:56:56 +02:00
|
|
|
piperStageWrapper (script: script, stageName: stageName, stashContent: [], stageLocking: false) {
|
2022-05-03 08:27:32 +02:00
|
|
|
if (!config.host) {
|
|
|
|
cloudFoundryCreateServiceKey script: parameters.script
|
|
|
|
}
|
2022-02-17 18:33:12 +02:00
|
|
|
if (config.atcSystemConfigFilePath) {
|
|
|
|
abapEnvironmentPushATCSystemConfig script: parameters.script
|
|
|
|
}
|
2020-06-23 15:56:56 +02:00
|
|
|
abapEnvironmentRunATCCheck script: parameters.script
|
|
|
|
}
|
|
|
|
}
|