Skip to content

Instantly share code, notes, and snippets.

@ntakouris
Created August 21, 2017 10:49
Show Gist options
  • Save ntakouris/0f0c1a8c22e0dc0fbfe927bfd18c3253 to your computer and use it in GitHub Desktop.
Save ntakouris/0f0c1a8c22e0dc0fbfe927bfd18c3253 to your computer and use it in GitHub Desktop.
node {
try{
notifyBuild('STARTED')
bitbucketStatusNotify(buildState: 'INPROGRESS')
//..work work..
}catch (e) {
// If there was an exception thrown, the build failed
currentBuild.result = "FAILED"
bitbucketStatusNotify(buildState: 'FAILED')
throw e
} finally {
// Success or failure, always send notifications
notifyBuild(currentBuild.result)
def bs = currentBuild.result ?: 'SUCCESSFUL'
if(bs == 'SUCCESSFUL'){
bitbucketStatusNotify(buildState: 'SUCCESSFUL')
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment