mirror of
https://github.com/SAP/jenkins-library.git
synced 2026-06-19 22:58:55 +02:00
cloudFoundryDeploy: return proper error message on deploy error (#651)
* return proper error message on deploy error * fix typo * provide meaningful error messages * Update cloudFoundryDeploy.groovy * Update cloudFoundryDeploy.groovy * Update neoDeploy.groovy * Update neoDeploy.groovy
This commit is contained in:
@@ -163,7 +163,7 @@ def deployCfNative (config) {
|
||||
}
|
||||
}
|
||||
|
||||
sh """#!/bin/bash
|
||||
def returnCode = sh returnStatus: true, script: """#!/bin/bash
|
||||
set +x
|
||||
set -e
|
||||
export HOME=${config.dockerWorkspace}
|
||||
@@ -171,6 +171,9 @@ def deployCfNative (config) {
|
||||
cf plugins
|
||||
cf ${deployCommand} ${config.cloudFoundry.appName ?: ''} ${blueGreenDeployOptions} -f '${config.cloudFoundry.manifest}' ${config.smokeTest}
|
||||
"""
|
||||
if(returnCode != 0){
|
||||
error "[ERROR][${STEP_NAME}] The execution of the deploy command failed, see the log for details."
|
||||
}
|
||||
stopOldAppIfRunning(config)
|
||||
sh "cf logout"
|
||||
}
|
||||
@@ -228,7 +231,7 @@ def deployMta (config) {
|
||||
usernameVariable: 'username'
|
||||
)]) {
|
||||
echo "[${STEP_NAME}] Deploying MTA (${config.mtaPath}) with following parameters: ${config.mtaExtensionDescriptor} ${config.mtaDeployParameters}"
|
||||
sh """#!/bin/bash
|
||||
def returnCode = sh returnStatus: true, script: """#!/bin/bash
|
||||
export HOME=${config.dockerWorkspace}
|
||||
set +x
|
||||
set -e
|
||||
@@ -236,6 +239,9 @@ def deployMta (config) {
|
||||
cf login -u ${username} -p '${password}' -a ${config.cloudFoundry.apiEndpoint} -o \"${config.cloudFoundry.org}\" -s \"${config.cloudFoundry.space}\"
|
||||
cf plugins
|
||||
cf ${deployCommand} ${config.mtaPath} ${config.mtaDeployParameters} ${config.mtaExtensionDescriptor}"""
|
||||
if(returnCode != 0){
|
||||
error "[ERROR][${STEP_NAME}] The execution of the deploy command failed, see the log for details."
|
||||
}
|
||||
sh "cf logout"
|
||||
}
|
||||
}
|
||||
|
||||
+12
-3
@@ -128,15 +128,24 @@ private deploy(script, utils, Map configuration, NeoCommandHelper neoCommandHelp
|
||||
echo "Link to the application dashboard: ${neoCommandHelper.cloudCockpitLink()}"
|
||||
|
||||
if (warAction == WarAction.ROLLING_UPDATE) {
|
||||
sh neoCommandHelper.rollingUpdateCommand()
|
||||
def returnCodeRollingUpdate = sh returnStatus: true, script: neoCommandHelper.rollingUpdateCommand()
|
||||
if(returnCodeRollingUpdate != 0){
|
||||
error "[ERROR][${STEP_NAME}] The execution of the deploy command failed, see the log for details."
|
||||
}
|
||||
} else {
|
||||
sh neoCommandHelper.deployCommand()
|
||||
def returnCodeDeploy = sh returnStatus: true, script: neoCommandHelper.deployCommand()
|
||||
if(returnCodeDeploy != 0){
|
||||
error "[ERROR][${STEP_NAME}] The execution of the deploy command failed, see the log for details."
|
||||
}
|
||||
sh neoCommandHelper.restartCommand()
|
||||
}
|
||||
|
||||
|
||||
} else if (deployMode == DeployMode.MTA) {
|
||||
sh neoCommandHelper.deployMta()
|
||||
def returnCodeMTA = sh returnStatus: true, script: neoCommandHelper.deployMta()
|
||||
if(returnCodeMTA != 0){
|
||||
error "[ERROR][${STEP_NAME}] The execution of the deploy command failed, see the log for details."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user