I love Jenkins, and I love Slack. But the stock Slack build message is boring as hell. If you feel the same way, here's how to get a fun message to follow the notification:
- Install Jenkins, the Slack notification plugin, and importantly the EnvInject plugin.
- Configure job to notify slack on build success, failure, etc.
- Add an "Execute Shell" build step, which runs your witty command writes it to a file as an environment variable.
Tip: Surround your message with ``` to format it nicely in Slack. - Add an "Inject env variables" build step to pull in the file created in the previous step.
- Add the environment variable to the Jenkins Slack custom message.
There you go! Here's what those steps look like. I'm using the UNIX fortune command for these:
This Jenkins setup populates an environment variable with a fun message. |
This publishes the environment variable to Slack. |
0 comments:
Post a Comment
Share your thoughts!