Configuring Jenkins as an event source
Jenkins helps automate software development processes such as builds to allow continuous integration. You can set up an integration with event management to receive notifications about jobs from Jenkins projects.
Before you begin
- Run the following
openssl pkcs7 -in cert.pem -out cert.crt -print_certs
- Import your certificate to the JVM keystore as a trusted
keytool -storepass <store_password> -import -noprompt -trustcacerts -alias <certificate_alias> -keystore cacerts -file cert.crt
- Restart your Jenkins server process to pick up the new certificate.
- Ensure your Jenkins server host can resolve the domain name of your Cloud Event Management installation.
- Modify the DNS server or add the host and domain name to the hosts file.
About this task
Notifications can be sent for single job stages or all stages of a job. Configure each project separately from which you want to receive notifications. The notifications are raised in event management as events. The events are then correlated into incidents.
- Click .
- Click New integration.
- Go to the Jenkins tile and click Configure.
- Enter a name for the integration and click Copy to add the generated webhook URL to the clipboard. Ensure you save the generated webhook to make it available later in the configuration process. For example, you can save it to a file.
- Click Save.
- Log into your Jenkins server as administrator.
Ensure that the Notification Plug-in is installed on your Jenkins server.
Tip: Check first whether the plug-in is installed by clicking . Go to the Installed tab and look for the Notification plugin. If not in the list of installed plug-ins, go to the Available tab and search for Notification plugin. Select the check box for the plug-in and click Install.
Configure the Jenkins project you want to receive notifications from as follows:
- Click the project name and then click Configure.
- Click the Job Notifications tab, and click Add Endpoint.
Set up the connection as follows:
- Select JSON from the Format list.
- Select HTTP from the Protocol list.
- Select when you want to receive notifications about the job from the Event list. For example, All Events sends a notification for each job phase, while Job Finalized only triggers a notification when the job has completed, including post-build activities. Select All Events to receive detailed information about the jobs.
- Paste the webhook URL into the URL field. This is the generated URL provided by event management.
- Enter 5 in the Log field. This determines the number of lines to include from the log in the message.
- Click Save
- Repeat the steps for each project you want to receive notification from.
- To start receiving notifications about Jenkins jobs, ensure that Enable event management from this source is set to On in Cloud Event Management.