Skip to content
Permalink
Browse files

Add Virtualbox cleanup to error handling.

  • Loading branch information
Mason Packard
Mason Packard committed Sep 14, 2016
1 parent 9d078c0 commit 097561b765a5c275aaa34cbbb13827fdf799dde6
Showing with 6 additions and 2 deletions.
  1. +6 −2 Jenkinsfile
@@ -75,15 +75,19 @@ def performBuild(String project){
}

catch (err) {
handleError("BUILD ERROR: There was a problem with ${project} Appliance. ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL} |Open>) \n\n ${err}")
handleError("BUILD ERROR: There was a problem with ${project} Appliance. ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL} |Open>) \n\n ${err}", "${project}-appliance-centos7-xfs")
}
}

def handleError(String message){
def handleError(String message, String appliance_name){
echo "${message}"
currentBuild.setResult("FAILED")
slackSend color: 'danger', message: "${message}"
//step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'chris.bynum@levvel.io', sendToIndividuals: true])

sh "VBoxManage controlvm ${appliance_name} poweroff"

sh "VboxManage unregistervm ${appliance_name} --delete"

sh 'exit 1'
}

0 comments on commit 097561b

Please sign in to comment.
You can’t perform that action at this time.