Hello SAP community! I would like to share with you insights on how easy is to configure SAP Alert Notification service on SAP BTP in a way so that you can get instant notifications for potential disruptions in your system and more specifically – failed builds on SAP Continuous Integration and Delivery.
This blog-post is also an extension to What’s going on in your CI/CD pipeline? created by Christoph Szymanski so also credits to Christoph for the initial setup.
To be frank, I was inspired to write also this blog-post as the integration between Alert Notification service and SAP Continuous Integration and Delivery indeed is quite intuitive. All you need to do is to create the needed credentials, enable a toggle button available in SAP Continuous Integration and D and configure the needed alerts! If you are interested to learn more about it – all details are provided underneath.
The main concept for this use case is setting up a reliable and instant alerting in SAP Business Technology Platform (SAP BTP) for sending instant notifications in case a build in SAP Continuous Integration and Delivery has been failed. To meet these expectations I have implemented SAP Alert Notification service in a way so that in case there is a failed job – an instant notification is sent out to the responsible DevOps / SRE team.
As a first step you need to authenticate your SAP Continuous Integration and Delivery pipeline to the SAP Alert Notification service. To do so, you need to create a Service Key credentials for the
Alert Notification service as shown below:
1. Go Alert Notification service instance in your SAP BTP account, navigate the to the “Service Keys” section and click on the “Create” button.
2. Specify the “Service Key Name” (free text) and click on the “Create” button.
3. You will see that the service key creation has been started.
4. Once the service key has been created, please view and copied it over as a JSON format:
1. Navigate to SAP Continuous Integration and Delivery and access the “Credentials” section. Once that’s done, please click on the “+” button to provided the needed credentials details:
Now, after you have created all the needed credentials, you need to enable the notifications so that SAP Continuous Integration and Delivery can start ingesting notifications to SAP Alert Notification service for the relevant pipeline events . To do so, please follow these steps:
1. Access to the pipeline you want to start monitoring and click on the “Edit” button.
2. Click on the Build Notifications to access the relevant section and enable the notifications for the given pipeline:
Your pipeline is configured to send notifications to the Alert Notification service.
Now it is time to configure the Alert Notification service itself and see it in actions.
In order to be able filter and act on the events ingested into the Alert Notification service it is needed to create:
The configuration of Alert Notification service in this use case is to notify our DevOps team in case of failed CID jobs. There are various of available parameters to be considered when the condition within the Alert Notification service is to be set – you can check out the available event properties here.
Nevertheless, I have decided to go with two conditions:
eventType = end
body CONTAINS Build has finished with 'FAILURE'
NOTE: Mandatory conditions are those that must always be met within the subscriptions where they are used. For the second condition I have enabled the mandatory condition so that I will receive notification only the ended builds that have been failed.
As an action I have created two actions that will be triggered in parallel:
Of course, as already mentioned, it is needed to setup the relevant subscription where I have picked up both conditions and both actions already configured.
As an end result, as expected, in case my pipeline fails, I get an instant notification delivered by the Alert Notification service over email and also in the relevant Microsoft Teams channel. The details included in these notifications are ingested directly from SAP Continuous Integration and Delivery (see below).
In addition the described use case (as also shown in the solution diagram) it is also possible Alert Notification service to trigger automatically a remediation action executed by SAP Automation Pilot. This is not covered in the current blog-post but in case you are interested in, please feel free to check out these resources:
Another aspect of this use case is that the Alert Notification service can be integrated further into the SAP Cloud ALM for Operations that provides a central entry point to operate your complete SAP landscape running on different technologies (including SAP BTP).
I hope this blog-post is useful and in case of any questions / comments, please do not hesitate add a comment and / or reach out to me.