Skip to content

Commit

Permalink
Update withNotify.groovy
Browse files Browse the repository at this point in the history
  • Loading branch information
zepouet authored Feb 2, 2017
1 parent 0588304 commit 6657b8b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions vars/withNotify.groovy
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
def call(boolean notifyResult = false, myFunction) {
def call(String email, boolean notifyResult = false, myFunction) {
try {
notifyBuild('STARTED')
notifyBuild(email, 'STARTED')
myFunction()
} catch (e) {
notifyBuild("FAILED")
notifyBuild(email, "FAILED")
throw e
} finally {
if (notifyResult) notifyBuild(currentBuild.result)
if (notifyResult) notifyBuild(email, currentBuild.result)
}
}

def notifyBuild(String buildStatus = 'STARTED') {
def notifyBuild(String email, String buildStatus = 'STARTED') {
// build status of null means successful
buildStatus = buildStatus ?: 'SUCCESSFUL'

Expand All @@ -37,6 +37,6 @@ def notifyBuild(String buildStatus = 'STARTED') {
emailext (
subject: subject,
body: details,
to: emailCommiter
to: email
)
}

0 comments on commit 6657b8b

Please sign in to comment.