1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-09-16 09:26:22 +02:00

Merge pull request #57 from marcusholl/pr/fixInvalidBackwardCompatibilityHandling

Fix wrong backward compatibility handling for deployHost, deployAccount.
This commit is contained in:
Christoph Szymanski
2018-01-30 17:18:00 +01:00
committed by GitHub
2 changed files with 42 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,21 @@ 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)
}
def credId = script.commonPipelineEnvironment.getConfigProperty('neoCredentialsId')
if(credId && !parameters.neoCredentialsId) {
echo "[WARNING][${stepName}] Deprecated parameter 'neoCredentialsId' from old configuration framework is used. This will not work anymore in future versions."
parameters.put('neoCredentialsId', credId)
}
// Backward compatibility end