1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00

Fix wrong backward compatibility handling for deployHost, deployAccount.

This commit is contained in:
Marcus Holl 2018-01-29 12:50:59 +01:00
parent 437abcf225
commit f52cbbe36a
2 changed files with 35 additions and 6 deletions

View File

@ -468,4 +468,31 @@ class NeoDeploymentTest extends BasePipelineTest {
warAction: 'illegalWARAction',
vmSize: 'lite')
}
@Test
void deployHostProvidedAsDeprecatedParameterTest() {
new File(workspacePath, archiveName) << "dummy archive"
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'configPropsUser123')
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
archivePath: archiveName,
deployHost: "my.deploy.host.com"
)
assert jlr.log.contains("[WARNING][neoDeploy] Deprecated parameter 'deployHost' is used. This will not work anymore in future versions. Use parameter 'host' instead.")
}
@Test
void deployAccountProvidedAsDeprecatedParameterTest() {
new File(workspacePath, archiveName) << "dummy archive"
cpe.setConfigProperty('CI_DEPLOY_ACCOUNT', 'configPropsUser123')
neoDeployScript.call(script: [commonPipelineEnvironment: cpe],
archivePath: archiveName,
host: "my.deploy.host.com",
deployAccount: "myAccount"
)
assert jlr.log.contains("Deprecated parameter 'deployAccount' is used. This will not work anymore in future versions. Use parameter 'account' instead.")
}
}

View File

@ -11,6 +11,8 @@ def call(parameters = [:]) {
'applicationName',
'archivePath',
'account',
'deployAccount', //deprecated, replaced by parameter 'account'
'deployHost', //deprecated, replaced by parameter 'host'
'deployMode',
'dockerEnvVars',
'dockerImage',
@ -60,14 +62,14 @@ def call(parameters = [:]) {
stepConfiguration.put('account', defaultDeployAccount)
}
if(parameters.DEPLOY_HOST && !parameters.host) {
echo "[WARNING][${stepName}] Deprecated parameter 'DEPLOY_HOST' is used. This will not work anymore in future versions. Use parameter 'host' instead."
parameters.put('host', parameters.DEPLOY_HOST)
if(parameters.deployHost && !parameters.host) {
echo "[WARNING][${stepName}] Deprecated parameter 'deployHost' is used. This will not work anymore in future versions. Use parameter 'host' instead."
parameters.put('host', parameters.deployHost)
}
if(parameters.CI_DEPLOY_ACCOUNT && !parameters.account) {
echo "[WARNING][${stepName}] Deprecated parameter 'CI_DEPLOY_ACCOUNT' is used. This will not work anymore in future versions. Use parameter 'account' instead."
parameters.put('account', parameters.CI_DEPLOY_ACCOUNT)
if(parameters.deployAccount && !parameters.account) {
echo "[WARNING][${stepName}] Deprecated parameter 'deployAccount' is used. This will not work anymore in future versions. Use parameter 'account' instead."
parameters.put('account', parameters.deployAccount)
}
// Backward compatibility end