1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-20 05:19:40 +02:00

Add deployment to performance tests stage and enable stage (#2370)

Co-authored-by: Kevin Hudemann <kevin.hudemann@sap.com>
This commit is contained in:
Florian Wilhelm 2020-11-13 16:31:45 +01:00 committed by GitHub
parent 3e3a29ffd2
commit 647e1ef0bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 2 deletions

View File

@ -70,7 +70,16 @@ stages:
- 'userTokenCredentialsId'
- 'whitesource/userTokenCredentialsId'
- 'whitesourceUserTokenCredentialsId'
Performance: {}
Performance:
stepConditions:
multicloudDeploy:
configKeys:
- 'cfTargets'
- 'neoTargets'
gatlingExecuteTests:
filePatternFromConfig: 'pomPath'
configKeys:
- 'appUrls'
Compliance: {}
Promote:
stepConditions:

View File

@ -27,6 +27,12 @@ Acceptance:
- deployDescriptor
stashes: []
Performance:
unstash:
- source
- buildResult
stashes: []
Release:
unstash:
- buildResult

View File

@ -37,6 +37,10 @@ class PiperPipelineStagePerformanceTest extends BasePiperTest {
stepsCalled.add('gatlingExecuteTests')
stepParameters.gatlingExecuteTests = m
})
helper.registerAllowedMethod('multicloudDeploy', [Map.class], {m ->
stepsCalled.add('multicloudDeploy')
stepParameters.multicloudDeploy = m
})
}
@Test
@ -45,7 +49,7 @@ class PiperPipelineStagePerformanceTest extends BasePiperTest {
script: nullScript,
juStabUtils: utils,
)
assertThat(stepsCalled, not(anyOf(hasItems('gatlingExecuteTests'))))
assertThat(stepsCalled, not(anyOf(hasItems('gatlingExecuteTests', 'multicloudDeploy'))))
}
@Test
@ -58,4 +62,15 @@ class PiperPipelineStagePerformanceTest extends BasePiperTest {
assertThat(stepsCalled, hasItems('gatlingExecuteTests'))
assertNotNull(stepParameters.gatlingExecuteTests)
}
@Test
void testMulticloudDeployTests() {
jsr.step.piperPipelineStagePerformance(
script: nullScript,
juStabUtils: utils,
multicloudDeploy: true
)
assertThat(stepsCalled, hasItems('multicloudDeploy'))
assertNotNull(stepParameters.multicloudDeploy)
}
}

View File

@ -13,6 +13,8 @@ import static com.sap.piper.Prerequisites.checkScript
@Field STAGE_STEP_KEYS = [
/** Executes Gatling performance tests */
'gatlingExecuteTests',
/** Can perform both to cloud foundry and neo targets. Preferred over cloudFoundryDeploy and neoDeploy, if configured. */
'multicloudDeploy',
]
@Field Set STEP_CONFIG_KEYS = GENERAL_CONFIG_KEYS.plus(STAGE_STEP_KEYS)
@Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS
@ -34,6 +36,7 @@ void call(Map parameters = [:]) {
.mixinGeneralConfig(script.commonPipelineEnvironment, GENERAL_CONFIG_KEYS)
.mixinStageConfig(script.commonPipelineEnvironment, stageName, STEP_CONFIG_KEYS)
.mixin(parameters, PARAMETER_KEYS)
.addIfEmpty('multicloudDeploy', script.commonPipelineEnvironment.configuration.runStep?.get(stageName)?.multicloudDeploy)
.addIfEmpty('gatlingExecuteTests', script.commonPipelineEnvironment.configuration.runStep?.get(stageName)?.gatlingExecuteTests)
.use()
@ -42,6 +45,12 @@ void call(Map parameters = [:]) {
// telemetry reporting
utils.pushToSWA([step: STEP_NAME], config)
if (config.multicloudDeploy) {
durationMeasure(script: script, measurementName: 'deploy_performance_multicloud_duration') {
multicloudDeploy(script: script, stage: stageName)
}
}
if (config.gatlingExecuteTests) {
durationMeasure(script: script, measurementName: 'gatling_duration') {
gatlingExecuteTests script: script