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

Merge pull request #468 from SAP/remove-compatability

Remove compatibility for neoDeploy
This commit is contained in:
Marcus Holl 2019-03-12 16:54:47 +01:00 committed by GitHub
commit e9b7075630
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 333 deletions

View File

@ -9,25 +9,23 @@ class NeoCommandHelper {
private Script step
private DeployMode deployMode
private Map deploymentConfiguration
private String pathToNeoExecutable
private String user
private String password
private String source
//Warning: Commands generated with this class can contain passwords and should only be used within the step withCredentials
NeoCommandHelper(Script step, DeployMode deployMode, Map deploymentConfiguration, String pathToNeoExecutable,
NeoCommandHelper(Script step, DeployMode deployMode, Map deploymentConfiguration,
String user, String password, String source) {
this.step = step
this.deployMode = deployMode
this.deploymentConfiguration = deploymentConfiguration
this.pathToNeoExecutable = pathToNeoExecutable
this.user = user
this.password = password
this.source = source
}
private String prolog() {
return "\"${pathToNeoExecutable}\""
return 'neo.sh'
}
String statusCommand() {

View File

@ -115,9 +115,11 @@ class FioriOnCloudPlatformPipelineTest extends BasePiperTest {
.commonPipelineEnvironment
.configuration = [steps:
[neoDeploy:
[ host: 'hana.example.com',
account: 'myTestAccount',
]
[neo:
[ host: 'hana.example.com',
account: 'myTestAccount',
]
]
]
]
@ -139,7 +141,7 @@ class FioriOnCloudPlatformPipelineTest extends BasePiperTest {
// the neo deploy call:
Assert.assertThat(shellRule.shell,
new CommandLineMatcher()
.hasProlog("\"/opt/sap/neo/tools/neo.sh\" deploy-mta")
.hasProlog("neo.sh deploy-mta")
.hasSingleQuotedOption('host', 'hana\\.example\\.com')
.hasSingleQuotedOption('account', 'myTestAccount')
.hasSingleQuotedOption('password', 'terceSpot')

View File

@ -84,109 +84,10 @@ class NeoDeployTest extends BasePiperTest {
helper.registerAllowedMethod('dockerExecute', [Map, Closure], null)
helper.registerAllowedMethod('fileExists', [String], { s -> return new File(workspacePath, s).exists() })
helper.registerAllowedMethod('pwd', [], { return workspacePath })
mockShellCommands()
nullScript.commonPipelineEnvironment.configuration = [steps: [neoDeploy: [neo: [host: 'test.deploy.host.com', account: 'trialuser123']]]]
}
@Test
void straightForwardTestCompatibilityConfiguration(){
shellRule.setReturnValue(JenkinsShellCallRule.Type.REGEX, '.* status .*', 'Status: STARTED')
nullScript.commonPipelineEnvironment.configuration = [
steps: [
neoDeploy: [
host: 'test.deploy.host.com',
account: 'trialuser123',
neoCredentialsId: 'myCredentialsId'
]]]
stepRule.step.neoDeploy(script: nullScript,
archivePath: warArchiveName,
deployMode: 'warParams',
applicationName: 'testApp',
runtime: 'neo-javaee6-wp',
runtimeVersion: '2.125',
warAction: 'rolling-update',
vmSize: 'lite')
Assert.assertThat(shellRule.shell,
new CommandLineMatcher().hasProlog("\"/opt/neo/tools/neo.sh\" rolling-update")
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
.hasSingleQuotedOption('account', 'trialuser123')
.hasSingleQuotedOption('application', 'testApp')
.hasSingleQuotedOption('runtime', 'neo-javaee6-wp')
.hasSingleQuotedOption('runtime-version', '2\\.125')
.hasSingleQuotedOption('size', 'lite')
.hasSingleQuotedOption('user', 'anonymous')
.hasSingleQuotedOption('password', '\\*\\*\\*\\*\\*\\*\\*\\*')
.hasSingleQuotedOption('source', '.*\\.war'))
}
@Test
void straightForwardTestConfigViaConfigProperties() {
boolean buildStatusHasBeenSet = false
boolean notifyOldConfigFrameworkUsed = false
nullScript.commonPipelineEnvironment.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
nullScript.commonPipelineEnvironment.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
nullScript.commonPipelineEnvironment.configuration = [:]
nullScript.currentBuild = [setResult: { buildStatusHasBeenSet = true }]
def utils = new Utils() {
void pushToSWA(Map parameters, Map config) {
notifyOldConfigFrameworkUsed = parameters.stepParam4
}
}
stepRule.step.neoDeploy(script: nullScript,
source: archiveName,
neo: [credentialsId: 'myCredentialsId'],
utils: utils
)
Assert.assertThat(shellRule.shell,
new CommandLineMatcher().hasProlog("\"/opt/neo/tools/neo.sh\" deploy-mta")
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
.hasSingleQuotedOption('account', 'trialuser123')
.hasOption('synchronous', '')
.hasSingleQuotedOption('user', 'anonymous')
.hasSingleQuotedOption('password', '\\*\\*\\*\\*\\*\\*\\*\\*')
.hasSingleQuotedOption('source', '.*'))
assert !buildStatusHasBeenSet
assert notifyOldConfigFrameworkUsed
}
@Test
void testConfigViaConfigPropertiesSetsBuildToUnstable() {
def buildStatus = 'SUCCESS'
nullScript.commonPipelineEnvironment.setConfigProperty('DEPLOY_HOST', 'test.deploy.host.com')
nullScript.commonPipelineEnvironment.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
nullScript.commonPipelineEnvironment.configuration = [:]
nullScript.currentBuild = [setResult: { r -> buildStatus = r }]
System.setProperty('com.sap.piper.featureFlag.buildUnstableWhenOldConfigFrameworkIsUsedByNeoDeploy',
Boolean.TRUE.toString())
try {
stepRule.step.neoDeploy(script: nullScript,
source: archiveName,
neo:[credentialsId: 'myCredentialsId'],
utils: utils
)
} finally {
System.clearProperty('com.sap.piper.featureFlag.buildUnstableWhenOldConfigFrameworkIsUsedByNeoDeploy')
}
assert buildStatus == 'UNSTABLE'
}
@Test
void straightForwardTestConfigViaConfiguration() {
@ -205,7 +106,7 @@ class NeoDeployTest extends BasePiperTest {
)
Assert.assertThat(shellRule.shell,
new CommandLineMatcher().hasProlog("\"/opt/neo/tools/neo.sh\" deploy-mta")
new CommandLineMatcher().hasProlog("neo.sh deploy-mta")
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
.hasSingleQuotedOption('account', 'trialuser123')
.hasOption('synchronous', '')
@ -231,7 +132,7 @@ class NeoDeployTest extends BasePiperTest {
)
Assert.assertThat(shellRule.shell,
new CommandLineMatcher().hasProlog("\"/opt/neo/tools/neo.sh\" deploy-mta")
new CommandLineMatcher().hasProlog("neo.sh deploy-mta")
.hasSingleQuotedOption('host', 'configuration-frwk\\.deploy\\.host\\.com')
.hasSingleQuotedOption('account', 'configurationFrwkUser123')
.hasOption('synchronous', '')
@ -246,7 +147,7 @@ class NeoDeployTest extends BasePiperTest {
stepRule.step.neoDeploy(script: nullScript)
Assert.assertThat(shellRule.shell,
new CommandLineMatcher().hasProlog("\"/opt/neo/tools/neo.sh\" deploy-mta")
new CommandLineMatcher().hasProlog("neo.sh deploy-mta")
.hasSingleQuotedOption('source', 'archive.mtar'))
}
@ -257,7 +158,7 @@ class NeoDeployTest extends BasePiperTest {
source: "archive.mtar")
Assert.assertThat(shellRule.shell,
new CommandLineMatcher().hasProlog("\"/opt/neo/tools/neo.sh\" deploy-mta")
new CommandLineMatcher().hasProlog("neo.sh deploy-mta")
.hasSingleQuotedOption('source', 'archive.mtar'))
}
@ -282,7 +183,7 @@ class NeoDeployTest extends BasePiperTest {
)
Assert.assertThat(shellRule.shell,
new CommandLineMatcher().hasProlog("\"/opt/neo/tools/neo.sh\" deploy-mta")
new CommandLineMatcher().hasProlog("neo.sh deploy-mta")
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
.hasSingleQuotedOption('account', 'trialuser123')
.hasOption('synchronous', '')
@ -292,69 +193,6 @@ class NeoDeployTest extends BasePiperTest {
)
}
@Test
void neoHomeNotSetTest() {
mockHomeVariablesNotSet()
stepRule.step.neoDeploy(script: nullScript,
source: archiveName
)
assert shellRule.shell.find { c -> c.contains('"neo.sh" deploy-mta') }
assert loggingRule.log.contains('SAP Cloud Platform Console Client is on PATH.')
assert loggingRule.log.contains("Using SAP Cloud Platform Console Client 'neo.sh'.")
}
@Test
void neoHomeAsParameterTest() {
mockHomeVariablesNotSet()
stepRule.step.neoDeploy(script: nullScript,
source: archiveName,
neo:[credentialsId: 'myCredentialsId'],
neoHome: '/param/neo'
)
assert shellRule.shell.find { c -> c = "\"/param/neo/tools/neo.sh\" deploy-mta" }
assert loggingRule.log.contains("SAP Cloud Platform Console Client home '/param/neo' retrieved from configuration.")
assert loggingRule.log.contains("Using SAP Cloud Platform Console Client '/param/neo/tools/neo.sh'.")
}
@Test
void neoHomeFromEnvironmentTest() {
stepRule.step.neoDeploy(script: nullScript,
source: archiveName
)
assert shellRule.shell.find { c -> c.contains("\"/opt/neo/tools/neo.sh\" deploy-mta") }
assert loggingRule.log.contains("SAP Cloud Platform Console Client home '/opt/neo' retrieved from environment.")
assert loggingRule.log.contains("Using SAP Cloud Platform Console Client '/opt/neo/tools/neo.sh'.")
}
@Test
void neoHomeFromCustomStepConfigurationTest() {
mockHomeVariablesNotSet()
nullScript.commonPipelineEnvironment.configuration = [steps: [neoDeploy: [neo: [host: 'test.deploy.host.com', account: 'trialuser123'], neoHome: '/config/neo']]]
stepRule.step.neoDeploy(script: nullScript,
source: archiveName
)
assert shellRule.shell.find { c -> c = "\"/config/neo/tools/neo.sh\" deploy-mta" }
assert loggingRule.log.contains("SAP Cloud Platform Console Client home '/config/neo' retrieved from configuration.")
assert loggingRule.log.contains("Using SAP Cloud Platform Console Client '/config/neo/tools/neo.sh'.")
}
@Test
void archiveNotProvidedTest() {
@ -392,7 +230,7 @@ class NeoDeployTest extends BasePiperTest {
stepRule.step.neoDeploy(script: nullScript, source: archiveName, deployMode: 'mta')
Assert.assertThat(shellRule.shell,
new CommandLineMatcher().hasProlog("\"/opt/neo/tools/neo.sh\" deploy-mta")
new CommandLineMatcher().hasProlog("neo.sh deploy-mta")
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
.hasSingleQuotedOption('account', 'trialuser123')
.hasOption('synchronous', '')
@ -417,7 +255,7 @@ class NeoDeployTest extends BasePiperTest {
source: warArchiveName)
Assert.assertThat(shellRule.shell,
new CommandLineMatcher().hasProlog("\"/opt/neo/tools/neo.sh\" deploy")
new CommandLineMatcher().hasProlog("neo.sh deploy")
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
.hasSingleQuotedOption('account', 'trialuser123')
.hasSingleQuotedOption('application', 'testApp')
@ -448,7 +286,7 @@ class NeoDeployTest extends BasePiperTest {
)
Assert.assertThat(shellRule.shell,
new CommandLineMatcher().hasProlog("\"/opt/neo/tools/neo.sh\" rolling-update")
new CommandLineMatcher().hasProlog("neo.sh rolling-update")
.hasSingleQuotedOption('host', 'test\\.deploy\\.host\\.com')
.hasSingleQuotedOption('account', 'trialuser123')
.hasSingleQuotedOption('application', 'testApp')
@ -478,7 +316,7 @@ class NeoDeployTest extends BasePiperTest {
Assert.assertThat(shellRule.shell,
new CommandLineMatcher()
.hasProlog("\"/opt/neo/tools/neo.sh\" deploy")
.hasProlog("neo.sh deploy")
.hasSingleQuotedOption('application', 'testApp'))
}
@ -541,7 +379,7 @@ class NeoDeployTest extends BasePiperTest {
)
Assert.assertThat(shellRule.shell,
new CommandLineMatcher().hasProlog("\"/opt/neo/tools/neo.sh\" deploy")
new CommandLineMatcher().hasProlog("neo.sh deploy")
.hasArgument("config.properties")
.hasSingleQuotedOption('user', 'defaultUser')
.hasSingleQuotedOption('password', '\\*\\*\\*\\*\\*\\*\\*\\*')
@ -566,7 +404,7 @@ class NeoDeployTest extends BasePiperTest {
])
Assert.assertThat(shellRule.shell,
new CommandLineMatcher().hasProlog("\"/opt/neo/tools/neo.sh\" rolling-update")
new CommandLineMatcher().hasProlog("neo.sh rolling-update")
.hasArgument('config.properties')
.hasSingleQuotedOption('user', 'defaultUser')
.hasSingleQuotedOption('password', '\\*\\*\\*\\*\\*\\*\\*\\*')
@ -654,57 +492,4 @@ class NeoDeployTest extends BasePiperTest {
size: 'lite'
])
}
@Test
void deployHostProvidedAsDeprecatedParameterTest() {
nullScript.commonPipelineEnvironment.setConfigProperty('CI_DEPLOY_ACCOUNT', 'configPropsUser123')
stepRule.step.neoDeploy(script: nullScript,
source: archiveName,
deployHost: "my.deploy.host.com"
)
assert loggingRule.log.contains("[WARNING][neoDeploy] Deprecated parameter 'deployHost' is used. This will not work anymore in future versions. Use parameter 'host' instead.")
}
@Test
void deployAccountProvidedAsDeprecatedParameterTest() {
nullScript.commonPipelineEnvironment.setConfigProperty('CI_DEPLOY_ACCOUNT', 'configPropsUser123')
stepRule.step.neoDeploy(script: nullScript,
source: archiveName,
neo: [
host: "my.deploy.host.com",
],
deployAccount: "myAccount"
)
assert loggingRule.log.contains("Deprecated parameter 'deployAccount' is used. This will not work anymore in future versions. Use parameter 'account' instead.")
}
private mockShellCommands() {
String javaVersion = '''openjdk version \"1.8.0_121\"
OpenJDK Runtime Environment (build 1.8.0_121-8u121-b13-1~bpo8+1-b13)
OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)'''
shellRule.setReturnValue(Type.REGEX, '.*java -version.*', javaVersion)
String neoVersion = '''SAP Cloud Platform Console Client
SDK version : 3.39.10
Runtime : neo-java-web'''
shellRule.setReturnValue(Type.REGEX, '.*neo.sh version.*', neoVersion)
shellRule.setReturnValue(Type.REGEX, '.*JAVA_HOME.*', '/opt/java')
shellRule.setReturnValue(Type.REGEX, '.*NEO_HOME.*', '/opt/neo')
shellRule.setReturnValue(Type.REGEX, '.*which java.*', 0)
shellRule.setReturnValue(Type.REGEX, '.*which neo.*', 0)
}
private mockHomeVariablesNotSet() {
shellRule.setReturnValue(Type.REGEX, '.*JAVA_HOME.*', '')
shellRule.setReturnValue(Type.REGEX, '.*NEO_HOME.*', '')
shellRule.setReturnValue(Type.REGEX, '.*which java.*', 0)
shellRule.setReturnValue(Type.REGEX, '.*which neo.*', 0)
}
}

View File

@ -34,7 +34,6 @@ class NeoCommandHelperTest extends BasePiperTest {
String source = (deployMode == DeployMode.MTA) ? 'file.mta' : 'file.war'
String username = 'username'
String password = 'password'
String neoExecutable = '/path/tools/neo.sh';
nullScript.STEP_NAME="neoDeploy"
@ -42,7 +41,6 @@ class NeoCommandHelperTest extends BasePiperTest {
nullScript,
deployMode,
deploymentConfiguration,
neoExecutable,
username,
password,
source
@ -52,7 +50,7 @@ class NeoCommandHelperTest extends BasePiperTest {
@Test
void testStatusCommand() {
String actual = getTestFixture(DeployMode.WAR_PARAMS).statusCommand()
String expected = "\"/path/tools/neo.sh\" status --host 'host_value' --account 'account_value' " +
String expected = "neo.sh status --host 'host_value' --account 'account_value' " +
"--application 'application_value' --user 'username' --password 'password'"
Assert.assertEquals(expected, actual)
}
@ -60,14 +58,14 @@ class NeoCommandHelperTest extends BasePiperTest {
@Test
void testStatusCommandForProperties() {
String actual = getTestFixture(DeployMode.WAR_PROPERTIES_FILE).statusCommand()
String expected = "\"/path/tools/neo.sh\" status file.properties --user 'username' --password 'password'"
String expected = "neo.sh status file.properties --user 'username' --password 'password'"
Assert.assertEquals(expected, actual)
}
@Test
void testRollingUpdateCommand() {
String actual = getTestFixture(DeployMode.WAR_PARAMS).rollingUpdateCommand()
String basicCommand = "\"/path/tools/neo.sh\" rolling-update --host 'host_value' --account 'account_value' " +
String basicCommand = "neo.sh rolling-update --host 'host_value' --account 'account_value' " +
"--application 'application_value' --user 'username' --password 'password' --source 'file.war'"
Assert.assertTrue(actual.contains(basicCommand))
@ -81,14 +79,14 @@ class NeoCommandHelperTest extends BasePiperTest {
@Test
void testRollingUpdateCommandForProperties() {
String actual = getTestFixture(DeployMode.WAR_PROPERTIES_FILE).rollingUpdateCommand()
String expected = "\"/path/tools/neo.sh\" rolling-update file.properties --user 'username' --password 'password' --source 'file.war' "
String expected = "neo.sh rolling-update file.properties --user 'username' --password 'password' --source 'file.war' "
Assert.assertEquals(expected, actual)
}
@Test
void testDeployCommand() {
String actual = getTestFixture(DeployMode.WAR_PARAMS).deployCommand()
String basicCommand = "\"/path/tools/neo.sh\" deploy --host 'host_value' --account 'account_value' " +
String basicCommand = "neo.sh deploy --host 'host_value' --account 'account_value' " +
"--application 'application_value' --user 'username' --password 'password' --source 'file.war'"
Assert.assertTrue(actual.contains(basicCommand))
@ -102,14 +100,14 @@ class NeoCommandHelperTest extends BasePiperTest {
@Test
void testDeployCommandForProperties() {
String actual = getTestFixture(DeployMode.WAR_PROPERTIES_FILE).deployCommand()
String expected = "\"/path/tools/neo.sh\" deploy file.properties --user 'username' --password 'password' --source 'file.war' "
String expected = "neo.sh deploy file.properties --user 'username' --password 'password' --source 'file.war' "
Assert.assertEquals(expected, actual)
}
@Test
void testRestartCommand() {
String actual = getTestFixture(DeployMode.WAR_PARAMS).restartCommand()
String expected = "\"/path/tools/neo.sh\" restart --synchronous --host 'host_value' --account 'account_value' " +
String expected = "neo.sh restart --synchronous --host 'host_value' --account 'account_value' " +
"--application 'application_value' --user 'username' --password 'password'"
Assert.assertEquals(expected, actual)
}
@ -117,14 +115,14 @@ class NeoCommandHelperTest extends BasePiperTest {
@Test
void testRestartCommandForProperties() {
String actual = getTestFixture(DeployMode.WAR_PROPERTIES_FILE).restartCommand()
String expected = "\"/path/tools/neo.sh\" restart --synchronous file.properties --user 'username' --password 'password'"
String expected = "neo.sh restart --synchronous file.properties --user 'username' --password 'password'"
Assert.assertEquals(expected, actual)
}
@Test
void deployMta() {
String actual = getTestFixture(DeployMode.MTA).deployMta()
String expected = "\"/path/tools/neo.sh\" deploy-mta --synchronous --host 'host_value' --account 'account_value' " +
String expected = "neo.sh deploy-mta --synchronous --host 'host_value' --account 'account_value' " +
"--user 'username' --password 'password' --source 'file.mta'"
Assert.assertEquals(expected, actual)
}

View File

@ -1,6 +1,5 @@
import com.sap.piper.ConfigurationHelper
import com.sap.piper.Utils
import com.sap.piper.tools.ToolDescriptor
import com.sap.piper.tools.neo.DeployMode
import com.sap.piper.tools.neo.NeoCommandHelper
import com.sap.piper.tools.neo.WarAction
@ -25,21 +24,6 @@ import static com.sap.piper.Prerequisites.checkScript
'warAction'
])
@Field Map CONFIG_KEY_COMPATIBILITY = [
neo : [
host : 'host',
account : 'account',
application : 'applicationName',
credentialsId : 'neoCredentialsId',
propertiesFile: 'propertiesFile',
runtime : 'runtime',
runtimeVersion: 'runtimeVersion',
size : 'vmSize'
],
source: 'archivePath'
]
void call(parameters = [:]) {
handlePipelineStepErrors(stepName: STEP_NAME, stepParameters: parameters) {
@ -49,17 +33,14 @@ void call(parameters = [:]) {
prepareDefaultValues script: script
Map stepCompatibilityConfiguration = handleCompatibility(script, parameters)
// load default & individual configuration
Map configuration = ConfigurationHelper.newInstance(this)
.loadStepDefaults()
.mixinGeneralConfig(script.commonPipelineEnvironment, GENERAL_CONFIG_KEYS)
.mixin(stepCompatibilityConfiguration)
.mixinStepConfig(script.commonPipelineEnvironment, STEP_CONFIG_KEYS, CONFIG_KEY_COMPATIBILITY)
.mixinStageConfig(script.commonPipelineEnvironment, parameters.stageName ?: env.STAGE_NAME, STEP_CONFIG_KEYS, CONFIG_KEY_COMPATIBILITY)
.mixinStepConfig(script.commonPipelineEnvironment, STEP_CONFIG_KEYS)
.mixinStageConfig(script.commonPipelineEnvironment, parameters.stageName ?: env.STAGE_NAME, STEP_CONFIG_KEYS)
.addIfEmpty('source', script.commonPipelineEnvironment.getMtarFilePath())
.mixin(parameters, PARAMETER_KEYS, CONFIG_KEY_COMPATIBILITY)
.mixin(parameters, PARAMETER_KEYS)
.withMandatoryProperty('neo')
.withMandatoryProperty('source')
.withMandatoryProperty('neo/credentialsId')
@ -74,12 +55,8 @@ void call(parameters = [:]) {
stepParam2: configuration.warAction == 'rolling-update'?'blue-green':'standard', // ['deploy', 'deploy-mta', 'rolling-update']
stepParamKey3: 'scriptMissing',
stepParam3: parameters?.script == null,
stepParamKey4: 'legacyConfig',
stepParam4: !stepCompatibilityConfiguration.isEmpty(),
], configuration)
ToolDescriptor neo = new ToolDescriptor('SAP Cloud Platform Console Client', 'NEO_HOME', 'neoHome', '/tools/', 'neo.sh', null, 'version')
ToolDescriptor java = new ToolDescriptor('Java', 'JAVA_HOME', '', '/bin/', 'java', '1.8.0', '-version 2>&1')
withCredentials([usernamePassword(
credentialsId: configuration.neo.credentialsId,
@ -94,19 +71,12 @@ void call(parameters = [:]) {
dockerEnvVars: configuration.dockerEnvVars,
dockerOptions: configuration.dockerOptions
) {
neo.verify(this, configuration)
java.verify(this, configuration)
String neoExecutable = neo.getToolExecutable(script, configuration)
DeployMode deployMode = DeployMode.fromString(configuration.deployMode)
NeoCommandHelper neoCommandHelper = new NeoCommandHelper(
this,
deployMode,
configuration.neo,
neoExecutable,
NEO_USERNAME,
NEO_PASSWORD,
configuration.source
@ -165,61 +135,6 @@ private boolean isAppRunning(NeoCommandHelper commandHelper) {
return status.contains('Status: STARTED')
}
private handleCompatibility(script, parameters) {
final Map neoCompatibilityConfiguration = [:]
// Backward compatibility: ensure old configuration is taken into account
// The old configuration in not stage / step specific
def defaultDeployHost = script.commonPipelineEnvironment.getConfigProperty('DEPLOY_HOST')
if (defaultDeployHost) {
echo "[WARNING][${STEP_NAME}] A deprecated configuration framework is used for configuring parameter 'DEPLOY_HOST'. This configuration framework will be removed in future versions."
neoCompatibilityConfiguration.put('host', defaultDeployHost)
}
def defaultDeployAccount = script.commonPipelineEnvironment.getConfigProperty('CI_DEPLOY_ACCOUNT')
if (defaultDeployAccount) {
echo "[WARNING][${STEP_NAME}] A deprecated configuration framework is used for configuring parameter 'DEPLOY_ACCOUNT'. This configuration framekwork will be removed in future versions."
neoCompatibilityConfiguration.put('account', defaultDeployAccount)
}
if (parameters.deployHost && !parameters.host) {
echo "[WARNING][${STEP_NAME}] Deprecated parameter 'deployHost' is used. This will not work anymore in future versions. Use parameter 'host' instead."
parameters.put('host', parameters.deployHost)
}
if (parameters.deployAccount && !parameters.account) {
echo "[WARNING][${STEP_NAME}] 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][${STEP_NAME}] Deprecated parameter 'neoCredentialsId' from old configuration framework is used. This will not work anymore in future versions."
parameters.put('neoCredentialsId', credId)
}
if (!neoCompatibilityConfiguration.isEmpty()) {
echo "[WARNING][$STEP_NAME] You are using a deprecated configuration framework. This will be removed in " +
'futureVersions.\nAdd snippet below to \'./pipeline/config.yml\' and remove ' +
'file \'.pipeline/configuration.properties\'.\n' +
"""|steps:
| neoDeploy:
| neo:
| host: ${neoCompatibilityConfiguration.get('host', '<Add host here>')}
| account: ${neoCompatibilityConfiguration.get('account', '<Add account here>')}
""".stripMargin()
if (Boolean.getBoolean('com.sap.piper.featureFlag.buildUnstableWhenOldConfigFrameworkIsUsedByNeoDeploy')) {
script.currentBuild.setResult('UNSTABLE')
echo "[WARNING][$STEP_NAME] Build has been set to unstable since old config framework is used."
}
return [neo: neoCompatibilityConfiguration]
}
return [:]
}
private assertPasswordRules(String password) {
if (password.startsWith("@")) {
error("Your password for the deployment to SAP Cloud Platform contains characters which are not " +