Maven build stage status from Jenkins to Slack

Notify Slack about build stage status from a Maven Job from Jenkins. Assuming Slack incoming webhooks and few secret bindings in Jenkins are already done.
This seems to work only with Maven jobs.

Above script is entered into Post Steps of a Maven job.
Jenkins credentials and Slack webhook is stored as secrets.
Status of the build retrieved from Jenkins API and is stored in build_status. It is then used in curl to notify Slack.

--

--

DevOps, IoT and amateur radio

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store