mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-18 05:18:24 +02:00
Merge pull request #229 from rodibrin/pr/neoimage
Remove tool descriptor from neo deploy and config the neo docker image
This commit is contained in:
commit
770657d963
@ -93,6 +93,7 @@ steps:
|
||||
buildTarget: 'NEO'
|
||||
mtaJarLocation: 'mta.jar'
|
||||
neoDeploy:
|
||||
dockerImage: 's4sdk/docker-neo-cli'
|
||||
deployMode: 'mta'
|
||||
warAction: 'deploy'
|
||||
vmSize: 'lite'
|
||||
|
@ -100,7 +100,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
)
|
||||
|
||||
Assert.assertThat(jscr.shell,
|
||||
new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy-mta")
|
||||
new CommandLineMatcher().hasProlog("#!/bin/bash neo.sh deploy-mta")
|
||||
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
|
||||
.hasSingleQuotedOption('account', 'trialuser123')
|
||||
.hasOption('synchronous', '')
|
||||
@ -118,7 +118,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
)
|
||||
|
||||
Assert.assertThat(jscr.shell,
|
||||
new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy-mta")
|
||||
new CommandLineMatcher().hasProlog("#!/bin/bash neo.sh deploy-mta")
|
||||
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
|
||||
.hasSingleQuotedOption('account', 'trialuser123')
|
||||
.hasOption('synchronous', '')
|
||||
@ -142,7 +142,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
)
|
||||
|
||||
Assert.assertThat(jscr.shell,
|
||||
new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy-mta")
|
||||
new CommandLineMatcher().hasProlog("#!/bin/bash neo.sh deploy-mta")
|
||||
.hasSingleQuotedOption('host', 'configuration-frwk\\.deploy\\.host\\.com')
|
||||
.hasSingleQuotedOption('account', 'configurationFrwkUser123')
|
||||
.hasOption('synchronous', '')
|
||||
@ -173,7 +173,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
)
|
||||
|
||||
Assert.assertThat(jscr.shell,
|
||||
new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy-mta")
|
||||
new CommandLineMatcher().hasProlog("#!/bin/bash neo.sh deploy-mta")
|
||||
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
|
||||
.hasSingleQuotedOption('account', 'trialuser123')
|
||||
.hasOption('synchronous', '')
|
||||
@ -183,68 +183,6 @@ 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
|
||||
void archiveNotProvidedTest() {
|
||||
|
||||
@ -283,7 +221,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
jsr.step.call(script: nullScript, archivePath: archiveName, deployMode: 'mta')
|
||||
|
||||
Assert.assertThat(jscr.shell,
|
||||
new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy-mta")
|
||||
new CommandLineMatcher().hasProlog("#!/bin/bash neo.sh deploy-mta")
|
||||
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
|
||||
.hasSingleQuotedOption('account', 'trialuser123')
|
||||
.hasOption('synchronous', '')
|
||||
@ -306,7 +244,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
archivePath: warArchiveName)
|
||||
|
||||
Assert.assertThat(jscr.shell,
|
||||
new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy")
|
||||
new CommandLineMatcher().hasProlog("#!/bin/bash neo.sh deploy")
|
||||
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
|
||||
.hasSingleQuotedOption('account', 'trialuser123')
|
||||
.hasSingleQuotedOption('application', 'testApp')
|
||||
@ -332,7 +270,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
vmSize: 'lite')
|
||||
|
||||
Assert.assertThat(jscr.shell,
|
||||
new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" rolling-update")
|
||||
new CommandLineMatcher().hasProlog("#!/bin/bash neo.sh rolling-update")
|
||||
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
|
||||
.hasSingleQuotedOption('account', 'trialuser123')
|
||||
.hasSingleQuotedOption('application', 'testApp')
|
||||
@ -358,7 +296,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
vmSize: 'lite')
|
||||
|
||||
Assert.assertThat(jscr.shell,
|
||||
new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy")
|
||||
new CommandLineMatcher().hasProlog("#!/bin/bash neo.sh deploy")
|
||||
.hasArgument("config.properties")
|
||||
.hasSingleQuotedOption('user', 'defaultUser')
|
||||
.hasSingleQuotedOption('password', '\\*\\*\\*\\*\\*\\*\\*\\*')
|
||||
@ -379,7 +317,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
vmSize: 'lite')
|
||||
|
||||
Assert.assertThat(jscr.shell,
|
||||
new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" rolling-update")
|
||||
new CommandLineMatcher().hasProlog("#!/bin/bash neo.sh rolling-update")
|
||||
.hasArgument('config.properties')
|
||||
.hasSingleQuotedOption('user', 'defaultUser')
|
||||
.hasSingleQuotedOption('password', '\\*\\*\\*\\*\\*\\*\\*\\*')
|
||||
@ -536,12 +474,8 @@ class NeoDeployTest extends BasePiperTest {
|
||||
|
||||
if(m.script.contains('JAVA_HOME')) {
|
||||
return '/opt/java'
|
||||
} else if(m.script.contains('NEO_HOME')) {
|
||||
return '/opt/neo'
|
||||
} else if (m.script.contains('which java')) {
|
||||
return 0
|
||||
} else if (m.script.contains('which neo')) {
|
||||
return 0
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
@ -551,12 +485,8 @@ class NeoDeployTest extends BasePiperTest {
|
||||
|
||||
if(m.script.contains('JAVA_HOME')) {
|
||||
return ''
|
||||
} else if(m.script.contains('NEO_HOME')) {
|
||||
return ''
|
||||
} else if (m.script.contains('which java')) {
|
||||
return 0
|
||||
} else if (m.script.contains('which neo')) {
|
||||
return 0
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ def call(parameters = [:]) {
|
||||
'dockerOptions',
|
||||
'host',
|
||||
'neoCredentialsId',
|
||||
'neoHome',
|
||||
'propertiesFile',
|
||||
'runtime',
|
||||
'runtimeVersion',
|
||||
@ -36,8 +35,7 @@ def call(parameters = [:]) {
|
||||
'dockerImage',
|
||||
'dockerOptions',
|
||||
'host',
|
||||
'neoCredentialsId',
|
||||
'neoHome'
|
||||
'neoCredentialsId'
|
||||
]
|
||||
|
||||
handlePipelineStepErrors (stepName: stepName, stepParameters: parameters) {
|
||||
@ -148,26 +146,22 @@ def call(parameters = [:]) {
|
||||
deployAccount = utils.getMandatoryParameter(configuration, 'account')
|
||||
}
|
||||
|
||||
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} \
|
||||
def neoCmdArgs = """${warAction} \
|
||||
--source "${archivePath}" \
|
||||
"""
|
||||
|
||||
"""
|
||||
if (deployMode in ['mta', 'warParams']) {
|
||||
neoDeployScript +=
|
||||
neoCmdArgs +=
|
||||
"""--host '${deployHost}' \
|
||||
--account '${deployAccount}' \
|
||||
"""
|
||||
}
|
||||
|
||||
if (deployMode == 'mta') {
|
||||
neoDeployScript += "--synchronous"
|
||||
neoCmdArgs += "--synchronous"
|
||||
}
|
||||
|
||||
if (deployMode == 'warParams') {
|
||||
neoDeployScript +=
|
||||
neoCmdArgs +=
|
||||
"""--application '${applicationName}' \
|
||||
--runtime '${runtime}' \
|
||||
--runtime-version '${runtimeVersion}' \
|
||||
@ -175,7 +169,7 @@ def call(parameters = [:]) {
|
||||
}
|
||||
|
||||
if (deployMode == 'warPropertiesFile') {
|
||||
neoDeployScript +=
|
||||
neoCmdArgs +=
|
||||
"""${propertiesFile}"""
|
||||
}
|
||||
|
||||
@ -192,12 +186,11 @@ def call(parameters = [:]) {
|
||||
dockerEnvVars: configuration.get('dockerEnvVars'),
|
||||
dockerOptions: configuration.get('dockerOptions')) {
|
||||
|
||||
neo.verify(this, configuration)
|
||||
|
||||
def java = new ToolDescriptor('Java', 'JAVA_HOME', '', '/bin/', 'java', '1.8.0', '-version 2>&1')
|
||||
java.verify(this, configuration)
|
||||
|
||||
sh """${neoDeployScript} \
|
||||
sh """#!/bin/bash
|
||||
neo.sh ${neoCmdArgs} \
|
||||
${credentials}
|
||||
"""
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user