Chapter 4. Notifications and Reports
One of the core uses of Jenkins is implementing automation. In addition to repeatable processing that is triggered by some event, we also rely on being automatically notified when processes have completed, and of their overall status. Additionally, many plugins and steps produce useful reports as part of their processing.
The pipeline DSL contains steps that help with notifications. In this chapter, we’ll look at what it takes to configure Jenkins and implement code to leverage some common notification methods and services.
Starting out, we’ll look at some of the types of notifications that Jenkins can send—from basic and extended email to using services such as Slack and HipChat.
Then we’ll move on to how to surface reports that are generated by pipeline processing to a more convenient location.
With these tools, you should be equipped to get the information you need from Jenkins and share it with other users.
Notifications
In this section, we’ll look at notifications—that is, informing users of some status, event, or piece of information that we want them to be aware of. For most cases, this will happen in the “post-processing” parts of a pipeline. In a Scripted Pipeline, this usually entails using a try-catch-finally construct if you want to always do post-processing (as described in Chapter 3). For Declarative Pipelines, we have the more straightforward post section that we can use.
Regardless of where you employ notifications, users today ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access