11

We're running Jenkins with the Slack Notification Plugin. Is there a way to send the custom message only on completion, not on start? To be clear, I don't want to disable the build started message, I'd just like the custom text to only show on completion (success).

Use case is jobs like delete stack. We use the custom message to make it clear which stack the job deleted, but you end up with slack messages like (paraphrased)

Delete job started
  Deleted Alex stack

Delete job finished
  Deleted Alex stack

Obviously you can see where this causes confusion. I'd rather get

Delete job started

Delete job finished
  Deleted Alex stack

"It can't be done" is an acceptable answer if that's the case. I know I can do a pipelines workaround but I'd love a quick fix for the jobs we haven't converted yet.

1
  • Best bet I could say is: fork the plugin and tweak this line to remove the custom message on start. I assume opening an issue as feature request could be an idea also, I didn't saw a way to disble the custom message on specific steps only.
    – Tensibai
    Commented Apr 6, 2017 at 14:45

1 Answer 1

7

As far as I was able to tell it's not possible.

We solved this by using Pipeline putting the custom messages in the Jenkinsfile.

The flexibility gained by having the Jenkinsfile in the git repo really helped our developers have a better understanding of the build process, and allowed them to make necessary changes to the build commands without the communications headache.

It's a nice excuse to move over to Pipeline.

It also happens to be very easy to do:

slackSend (color: colorCode, message: customMessage)

1
  • 1
    yeah, we're slowly moving over to pipelines so that'll solve it long term, just wondered if there was a shortterm solution. Thanks!
    – Alex
    Commented Apr 7, 2017 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.