mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-18 05:18:24 +02:00
Merge branch 'master' into CCFenner-patch-2
This commit is contained in:
commit
2c2700f10a
@ -100,7 +100,7 @@ class NeoDeployTest extends BasePiperTest {
|
|||||||
)
|
)
|
||||||
|
|
||||||
Assert.assertThat(jscr.shell,
|
Assert.assertThat(jscr.shell,
|
||||||
new CommandLineMatcher().hasProlog("#!/bin/bash neo.sh deploy-mta")
|
new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy-mta")
|
||||||
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
|
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
|
||||||
.hasSingleQuotedOption('account', 'trialuser123')
|
.hasSingleQuotedOption('account', 'trialuser123')
|
||||||
.hasOption('synchronous', '')
|
.hasOption('synchronous', '')
|
||||||
@ -118,7 +118,7 @@ class NeoDeployTest extends BasePiperTest {
|
|||||||
)
|
)
|
||||||
|
|
||||||
Assert.assertThat(jscr.shell,
|
Assert.assertThat(jscr.shell,
|
||||||
new CommandLineMatcher().hasProlog("#!/bin/bash neo.sh deploy-mta")
|
new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy-mta")
|
||||||
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
|
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
|
||||||
.hasSingleQuotedOption('account', 'trialuser123')
|
.hasSingleQuotedOption('account', 'trialuser123')
|
||||||
.hasOption('synchronous', '')
|
.hasOption('synchronous', '')
|
||||||
@ -142,7 +142,7 @@ class NeoDeployTest extends BasePiperTest {
|
|||||||
)
|
)
|
||||||
|
|
||||||
Assert.assertThat(jscr.shell,
|
Assert.assertThat(jscr.shell,
|
||||||
new CommandLineMatcher().hasProlog("#!/bin/bash neo.sh deploy-mta")
|
new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy-mta")
|
||||||
.hasSingleQuotedOption('host', 'configuration-frwk\\.deploy\\.host\\.com')
|
.hasSingleQuotedOption('host', 'configuration-frwk\\.deploy\\.host\\.com')
|
||||||
.hasSingleQuotedOption('account', 'configurationFrwkUser123')
|
.hasSingleQuotedOption('account', 'configurationFrwkUser123')
|
||||||
.hasOption('synchronous', '')
|
.hasOption('synchronous', '')
|
||||||
@ -173,7 +173,7 @@ class NeoDeployTest extends BasePiperTest {
|
|||||||
)
|
)
|
||||||
|
|
||||||
Assert.assertThat(jscr.shell,
|
Assert.assertThat(jscr.shell,
|
||||||
new CommandLineMatcher().hasProlog("#!/bin/bash neo.sh deploy-mta")
|
new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy-mta")
|
||||||
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
|
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
|
||||||
.hasSingleQuotedOption('account', 'trialuser123')
|
.hasSingleQuotedOption('account', 'trialuser123')
|
||||||
.hasOption('synchronous', '')
|
.hasOption('synchronous', '')
|
||||||
@ -183,6 +183,68 @@ class NeoDeployTest extends BasePiperTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void neoHomeNotSetTest() {
|
||||||
|
|
||||||
|
helper.registerAllowedMethod('sh', [Map], { Map m -> getVersionWithPath(m) })
|
||||||
|
|
||||||
|
jsr.step.call(script: nullScript,
|
||||||
|
archivePath: archiveName
|
||||||
|
)
|
||||||
|
|
||||||
|
assert jscr.shell.find { c -> c.contains('"neo.sh" deploy-mta') }
|
||||||
|
assert jlr.log.contains('SAP Cloud Platform Console Client is on PATH.')
|
||||||
|
assert jlr.log.contains("Using SAP Cloud Platform Console Client 'neo.sh'.")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void neoHomeAsParameterTest() {
|
||||||
|
|
||||||
|
helper.registerAllowedMethod('sh', [Map], { Map m -> getVersionWithPath(m) })
|
||||||
|
|
||||||
|
jsr.step.call(script: nullScript,
|
||||||
|
archivePath: archiveName,
|
||||||
|
neoCredentialsId: 'myCredentialsId',
|
||||||
|
neoHome: '/param/neo'
|
||||||
|
)
|
||||||
|
|
||||||
|
assert jscr.shell.find{ c -> c = "\"/param/neo/tools/neo.sh\" deploy-mta" }
|
||||||
|
assert jlr.log.contains("SAP Cloud Platform Console Client home '/param/neo' retrieved from configuration.")
|
||||||
|
assert jlr.log.contains("Using SAP Cloud Platform Console Client '/param/neo/tools/neo.sh'.")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void neoHomeFromEnvironmentTest() {
|
||||||
|
|
||||||
|
jsr.step.call(script: nullScript,
|
||||||
|
archivePath: archiveName
|
||||||
|
)
|
||||||
|
|
||||||
|
assert jscr.shell.find { c -> c.contains("\"/opt/neo/tools/neo.sh\" deploy-mta")}
|
||||||
|
assert jlr.log.contains("SAP Cloud Platform Console Client home '/opt/neo' retrieved from environment.")
|
||||||
|
assert jlr.log.contains("Using SAP Cloud Platform Console Client '/opt/neo/tools/neo.sh'.")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void neoHomeFromCustomStepConfigurationTest() {
|
||||||
|
|
||||||
|
helper.registerAllowedMethod('sh', [Map], { Map m -> getVersionWithPath(m) })
|
||||||
|
|
||||||
|
nullScript.commonPipelineEnvironment.configuration = [steps:[neoDeploy: [host: 'test.deploy.host.com', account: 'trialuser123', neoHome: '/config/neo']]]
|
||||||
|
|
||||||
|
jsr.step.call(script: nullScript,
|
||||||
|
archivePath: archiveName
|
||||||
|
)
|
||||||
|
|
||||||
|
assert jscr.shell.find { c -> c = "\"/config/neo/tools/neo.sh\" deploy-mta"}
|
||||||
|
assert jlr.log.contains("SAP Cloud Platform Console Client home '/config/neo' retrieved from configuration.")
|
||||||
|
assert jlr.log.contains("Using SAP Cloud Platform Console Client '/config/neo/tools/neo.sh'.")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void archiveNotProvidedTest() {
|
void archiveNotProvidedTest() {
|
||||||
|
|
||||||
@ -221,7 +283,7 @@ class NeoDeployTest extends BasePiperTest {
|
|||||||
jsr.step.call(script: nullScript, archivePath: archiveName, deployMode: 'mta')
|
jsr.step.call(script: nullScript, archivePath: archiveName, deployMode: 'mta')
|
||||||
|
|
||||||
Assert.assertThat(jscr.shell,
|
Assert.assertThat(jscr.shell,
|
||||||
new CommandLineMatcher().hasProlog("#!/bin/bash neo.sh deploy-mta")
|
new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy-mta")
|
||||||
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
|
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
|
||||||
.hasSingleQuotedOption('account', 'trialuser123')
|
.hasSingleQuotedOption('account', 'trialuser123')
|
||||||
.hasOption('synchronous', '')
|
.hasOption('synchronous', '')
|
||||||
@ -244,7 +306,7 @@ class NeoDeployTest extends BasePiperTest {
|
|||||||
archivePath: warArchiveName)
|
archivePath: warArchiveName)
|
||||||
|
|
||||||
Assert.assertThat(jscr.shell,
|
Assert.assertThat(jscr.shell,
|
||||||
new CommandLineMatcher().hasProlog("#!/bin/bash neo.sh deploy")
|
new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy")
|
||||||
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
|
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
|
||||||
.hasSingleQuotedOption('account', 'trialuser123')
|
.hasSingleQuotedOption('account', 'trialuser123')
|
||||||
.hasSingleQuotedOption('application', 'testApp')
|
.hasSingleQuotedOption('application', 'testApp')
|
||||||
@ -270,7 +332,7 @@ class NeoDeployTest extends BasePiperTest {
|
|||||||
vmSize: 'lite')
|
vmSize: 'lite')
|
||||||
|
|
||||||
Assert.assertThat(jscr.shell,
|
Assert.assertThat(jscr.shell,
|
||||||
new CommandLineMatcher().hasProlog("#!/bin/bash neo.sh rolling-update")
|
new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" rolling-update")
|
||||||
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
|
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
|
||||||
.hasSingleQuotedOption('account', 'trialuser123')
|
.hasSingleQuotedOption('account', 'trialuser123')
|
||||||
.hasSingleQuotedOption('application', 'testApp')
|
.hasSingleQuotedOption('application', 'testApp')
|
||||||
@ -296,7 +358,7 @@ class NeoDeployTest extends BasePiperTest {
|
|||||||
vmSize: 'lite')
|
vmSize: 'lite')
|
||||||
|
|
||||||
Assert.assertThat(jscr.shell,
|
Assert.assertThat(jscr.shell,
|
||||||
new CommandLineMatcher().hasProlog("#!/bin/bash neo.sh deploy")
|
new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy")
|
||||||
.hasArgument("config.properties")
|
.hasArgument("config.properties")
|
||||||
.hasSingleQuotedOption('user', 'defaultUser')
|
.hasSingleQuotedOption('user', 'defaultUser')
|
||||||
.hasSingleQuotedOption('password', '\\*\\*\\*\\*\\*\\*\\*\\*')
|
.hasSingleQuotedOption('password', '\\*\\*\\*\\*\\*\\*\\*\\*')
|
||||||
@ -317,7 +379,7 @@ class NeoDeployTest extends BasePiperTest {
|
|||||||
vmSize: 'lite')
|
vmSize: 'lite')
|
||||||
|
|
||||||
Assert.assertThat(jscr.shell,
|
Assert.assertThat(jscr.shell,
|
||||||
new CommandLineMatcher().hasProlog("#!/bin/bash neo.sh rolling-update")
|
new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" rolling-update")
|
||||||
.hasArgument('config.properties')
|
.hasArgument('config.properties')
|
||||||
.hasSingleQuotedOption('user', 'defaultUser')
|
.hasSingleQuotedOption('user', 'defaultUser')
|
||||||
.hasSingleQuotedOption('password', '\\*\\*\\*\\*\\*\\*\\*\\*')
|
.hasSingleQuotedOption('password', '\\*\\*\\*\\*\\*\\*\\*\\*')
|
||||||
@ -474,8 +536,12 @@ class NeoDeployTest extends BasePiperTest {
|
|||||||
|
|
||||||
if(m.script.contains('JAVA_HOME')) {
|
if(m.script.contains('JAVA_HOME')) {
|
||||||
return '/opt/java'
|
return '/opt/java'
|
||||||
|
} else if(m.script.contains('NEO_HOME')) {
|
||||||
|
return '/opt/neo'
|
||||||
} else if (m.script.contains('which java')) {
|
} else if (m.script.contains('which java')) {
|
||||||
return 0
|
return 0
|
||||||
|
} else if (m.script.contains('which neo')) {
|
||||||
|
return 0
|
||||||
} else {
|
} else {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -485,8 +551,12 @@ class NeoDeployTest extends BasePiperTest {
|
|||||||
|
|
||||||
if(m.script.contains('JAVA_HOME')) {
|
if(m.script.contains('JAVA_HOME')) {
|
||||||
return ''
|
return ''
|
||||||
|
} else if(m.script.contains('NEO_HOME')) {
|
||||||
|
return ''
|
||||||
} else if (m.script.contains('which java')) {
|
} else if (m.script.contains('which java')) {
|
||||||
return 0
|
return 0
|
||||||
|
} else if (m.script.contains('which neo')) {
|
||||||
|
return 0
|
||||||
} else {
|
} else {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ def call(parameters = [:]) {
|
|||||||
'dockerOptions',
|
'dockerOptions',
|
||||||
'host',
|
'host',
|
||||||
'neoCredentialsId',
|
'neoCredentialsId',
|
||||||
|
'neoHome',
|
||||||
'propertiesFile',
|
'propertiesFile',
|
||||||
'runtime',
|
'runtime',
|
||||||
'runtimeVersion',
|
'runtimeVersion',
|
||||||
@ -35,7 +36,8 @@ def call(parameters = [:]) {
|
|||||||
'dockerImage',
|
'dockerImage',
|
||||||
'dockerOptions',
|
'dockerOptions',
|
||||||
'host',
|
'host',
|
||||||
'neoCredentialsId'
|
'neoCredentialsId',
|
||||||
|
'neoHome'
|
||||||
]
|
]
|
||||||
|
|
||||||
handlePipelineStepErrors (stepName: stepName, stepParameters: parameters) {
|
handlePipelineStepErrors (stepName: stepName, stepParameters: parameters) {
|
||||||
@ -146,22 +148,26 @@ def call(parameters = [:]) {
|
|||||||
deployAccount = utils.getMandatoryParameter(configuration, 'account')
|
deployAccount = utils.getMandatoryParameter(configuration, 'account')
|
||||||
}
|
}
|
||||||
|
|
||||||
def neoCmdArgs = """${warAction} \
|
def neo = new ToolDescriptor('SAP Cloud Platform Console Client', 'NEO_HOME', 'neoHome', '/tools/', 'neo.sh', null, 'version')
|
||||||
|
def neoExecutable = neo.getToolExecutable(this, configuration)
|
||||||
|
def neoDeployScript = """#!/bin/bash
|
||||||
|
"${neoExecutable}" ${warAction} \
|
||||||
--source "${archivePath}" \
|
--source "${archivePath}" \
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if (deployMode in ['mta', 'warParams']) {
|
if (deployMode in ['mta', 'warParams']) {
|
||||||
neoCmdArgs +=
|
neoDeployScript +=
|
||||||
"""--host '${deployHost}' \
|
"""--host '${deployHost}' \
|
||||||
--account '${deployAccount}' \
|
--account '${deployAccount}' \
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deployMode == 'mta') {
|
if (deployMode == 'mta') {
|
||||||
neoCmdArgs += "--synchronous"
|
neoDeployScript += "--synchronous"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deployMode == 'warParams') {
|
if (deployMode == 'warParams') {
|
||||||
neoCmdArgs +=
|
neoDeployScript +=
|
||||||
"""--application '${applicationName}' \
|
"""--application '${applicationName}' \
|
||||||
--runtime '${runtime}' \
|
--runtime '${runtime}' \
|
||||||
--runtime-version '${runtimeVersion}' \
|
--runtime-version '${runtimeVersion}' \
|
||||||
@ -169,7 +175,7 @@ def call(parameters = [:]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (deployMode == 'warPropertiesFile') {
|
if (deployMode == 'warPropertiesFile') {
|
||||||
neoCmdArgs +=
|
neoDeployScript +=
|
||||||
"""${propertiesFile}"""
|
"""${propertiesFile}"""
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,11 +192,12 @@ def call(parameters = [:]) {
|
|||||||
dockerEnvVars: configuration.get('dockerEnvVars'),
|
dockerEnvVars: configuration.get('dockerEnvVars'),
|
||||||
dockerOptions: configuration.get('dockerOptions')) {
|
dockerOptions: configuration.get('dockerOptions')) {
|
||||||
|
|
||||||
|
neo.verify(this, configuration)
|
||||||
|
|
||||||
def java = new ToolDescriptor('Java', 'JAVA_HOME', '', '/bin/', 'java', '1.8.0', '-version 2>&1')
|
def java = new ToolDescriptor('Java', 'JAVA_HOME', '', '/bin/', 'java', '1.8.0', '-version 2>&1')
|
||||||
java.verify(this, configuration)
|
java.verify(this, configuration)
|
||||||
|
|
||||||
sh """#!/bin/bash
|
sh """${neoDeployScript} \
|
||||||
neo.sh ${neoCmdArgs} \
|
|
||||||
${credentials}
|
${credentials}
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user