Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add Virtualbox cleanup to error handling.
Mason Packard committed Sep 14, 2016
1 parent 9d078c0 commit 097561b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions 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.