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

control flow: Replace if with case

This commit is contained in:
Marcus Holl 2019-02-07 09:08:31 +01:00
parent a4f879ea62
commit 5aecea02b6

View File

@ -256,41 +256,47 @@ public class ChangeManagement implements Serializable {
else else
shArgs.put('returnStatus', true) shArgs.put('returnStatus', true)
if(type == BackendType.RFC) { def result = 1
shArgs.script = command switch(type) {
args = args.plus([ case BackendType.RFC:
"--env ABAP_DEVELOPMENT_SERVER=${endpoint}",
"--env ABAP_DEVELOPMENT_USER=${script.username}",
"--env ABAP_DEVELOPMENT_PASSWORD=${script.password}"])
dockerOptions = dockerOptions.plus(args) shArgs.script = command
def result = 1 args = args.plus([
"--env ABAP_DEVELOPMENT_SERVER=${endpoint}",
"--env ABAP_DEVELOPMENT_USER=${script.username}",
"--env ABAP_DEVELOPMENT_PASSWORD=${script.password}"])
script.dockerExecute(script: script, dockerOptions = dockerOptions.plus(args)
dockerImage: dockerImage,
dockerOptions: dockerOptions ) {
script.dockerExecute(script: script,
dockerImage: dockerImage,
dockerOptions: dockerOptions ) {
result = script.sh(shArgs)
}
break
case BackendType.SOLMAN:
case BackendType.CTS:
shArgs.script = getCMCommandLine(type, endpoint, script.username, script.password,
command, args,
clientOpts)
// user and password are masked by withCredentials
script.echo """[INFO] Executing command line: "${shArgs.script}"."""
result = script.sh(shArgs) result = script.sh(shArgs)
} break
return result
} else {
def cmScript = getCMCommandLine(type, endpoint, script.username, script.password,
command, args,
clientOpts)
shArgs.script = cmScript
// user and password are masked by withCredentials
script.echo """[INFO] Executing command line: "${cmScript}"."""
return script.sh(shArgs)
} }
return result
} }
} }