*Version: 1.0 | Last Updated: 14/10/2024*
## Overview
- **Integration Name:** Jenkins
- **Purpose:** Trigger a Jenkins job via MoovingON AI webhook
- **Audience:** Developers, DevOps, Support team, TAM
- **Prerequisites:** Administrator role in MoovingON AI
---
## Table of Contents
- [[#Setup Instructions]]
- [[#Configuration]]
- [[#Testing the Integration]]
- [[#FAQs]]
- [[#Related Links]]
---
## Setup Instructions
From the left side of the UI, click on Operation > Webhook management
****
From the toolbar, click “+”
****
Fill out the required fields on the right side of the screen as follows:
---
## Configuration
**Fill out the required fields on the right side of the screen as follows:**
1. **Name: Choose a relevant name for the webhook.**
2. **Method: Choose the “Post” method to make a post request to PagerDuty.**
3. **Content Type: Choose the convenient option for you, usually “JSON” is used
As it is the most common option to use.**
4. **URL: To invoke a job, use the following URL:
[http://JENKINS_URL/generic-webhook-trigger/invoke](http://jenkins_url/generic-webhook-trigger/invoke) Note: replace JENKINS_URL with your Jenkins URL instance.\
5. **Payload**: Insert the parameters that you want to send to the Jenkins job.
The below example shows a payload with specific parameters such as subject: content, locale, labels, etc
****
In order to catch these parameters in Jenkins, parameters should be added in Jenkins in the General section by enabling “This project is parameterized” as in the example below.
****
**Custom Headers:** Add a header with a token field with the value that you have set in the Jenkins job.
****
Then click “Save.”
---
## Testing the Integration
To run the webhook automatically when the alert is fetched to MoovingON AI, add to the alert guideline a webhook
1. **Go to Operations > Guidelines.**
2. **Choose an existing guideline or create a new one.**
3. **Click on “Add Step”, then choose Webhook.**
4. **In the “Choose Webhook” dropdown, choose the webhook that you have created**
5. **Save your changes.**
---
## FAQs
- **Q:** **What are some common use cases for using webhooks to trigger Jenkins jobs?**
**A:** **Common use cases include:**
1. **Continuous Integration (CI)**: Automatically trigger a Jenkins build whenever code is pushed to a repository (e.g., using GitHub or GitLab webhooks).
2. **Deployment Automation**: Deploy applications to different environments (e.g., dev, staging, or production) after passing certain conditions in your pipeline.
3. **Monitoring and Alerts**: Integrate with services like PagerDuty or monitoring tools to trigger remediation jobs or health checks in response to incidents or alerts.
---
## Related Links
- **Internal Links:** [[06.08 Templating]], [[06.02 Guidelines]]
- **External Resources:** [Jenkins Documentation](https://www.jenkins.io/doc/)