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

[refactoring] increase readability: deployMode

This commit is contained in:
Marcus Holl 2018-04-20 12:23:26 +02:00
parent 48b816e028
commit 39d23d29fd
2 changed files with 6 additions and 5 deletions

View File

@ -366,7 +366,7 @@ class NeoDeployTest extends BasePipelineTest {
void illegalDeployModeTest() {
thrown.expect(Exception)
thrown.expectMessage("[neoDeploy] Invalid deployMode = 'illegalMode'. Valid 'deployMode' values are: 'mta', 'warParams' and 'warPropertiesFile'")
thrown.expectMessage("[neoDeploy] Invalid deployMode = 'illegalMode'. Valid 'deployMode' values are: [mta, warParams, warPropertiesFile]")
jsr.step.call(script: [commonPipelineEnvironment: jer.env],
archivePath: warArchiveName,

View File

@ -110,11 +110,12 @@ def call(parameters = [:]) {
def runtimeVersion
def vmSize
if (deployMode != 'mta' && deployMode != 'warParams' && deployMode != 'warPropertiesFile') {
throw new Exception("[neoDeploy] Invalid deployMode = '${deployMode}'. Valid 'deployMode' values are: 'mta', 'warParams' and 'warPropertiesFile'")
def deployModes = ['mta', 'warParams', 'warPropertiesFile']
if (! (deployMode in deployModes)) {
throw new Exception("[neoDeploy] Invalid deployMode = '${deployMode}'. Valid 'deployMode' values are: ${deployModes}.")
}
if (deployMode == 'warPropertiesFile' || deployMode == 'warParams') {
if (deployMode in ['warPropertiesFile', 'warParams']) {
warAction = utils.getMandatoryParameter(configuration, 'warAction')
if (warAction != 'deploy' && warAction != 'rolling-update') {
throw new Exception("[neoDeploy] Invalid warAction = '${warAction}'. Valid 'warAction' values are: 'deploy' and 'rolling-update'.")
@ -138,7 +139,7 @@ def call(parameters = [:]) {
}
}
if (deployMode.equals('mta') || deployMode.equals('warParams')) {
if (deployMode in ['mta','warParams']) {
deployHost = utils.getMandatoryParameter(configuration, 'host')
deployAccount = utils.getMandatoryParameter(configuration, 'account')
}