*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 **![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXen-UwqyYH_OBc4igk791iqSooMiOMXaLCUe8p5KtZZmBKLv-mGTF3rhxiH-7-4SKecq9gwPijLrF8mToAIuIYoaWNm8mJ2C3RbP2YHLnuaoZwRZWxqBF7mlbru_YbZz0E-jVi3DjQyXgfe6rUO17LqWBSW?key=wCM-QJWI9fwjjl4oWyxjYg)** From the toolbar, click “+” **![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeYna_C1AddJOUWlT9wLCsjiN9_efQRvlw8cjNQrrQtj4BsOKPBvM1OKz4tH76FrS4fCfqLSkRFg4tgTQRwpzByxaCTrxAGD69rjV7PYmbfSmOjU3qqn2hSYneapH1PC2TgRO6Mf96WGZOUz_FtWxSyevOM?key=wCM-QJWI9fwjjl4oWyxjYg)** 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 **![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXd9jJ-xOJW9U_Gs0McnFwop_eYx_KCn4madD0Y6HAPwSbmMOdktd0iDfQsY4bI0rR3gjxaSun6ZAek1WY15wYH1Tsw7QuP87WFISIPY3Lg49uPe43fl9db2W2Mbe0HEqytTG-z5b_7EpKKwDueYRUysRE8?key=wCM-QJWI9fwjjl4oWyxjYg)** 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. **![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXePJD0OGMQh4hoWJMVqH2PIagtNjZwhq5eA4iuXGZ0gfypkS1ANPu0LuNAgfwshASuHtYtylvTAUd2e1fF4AayPBSVu7b0NSjCOBftKQFB0LrFef7ekQ8DSlHnwV26lifxKnLwfEYOFvra51pM3_NPFcX-J?key=wCM-QJWI9fwjjl4oWyxjYg)** **Custom Headers:** Add a header with a token field with the value that you have set in the Jenkins job. **![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXcmdz7a5eVnJgOM0Ppz7eBbsIE4nCvN2Z62TJvAfgRiQRYbWHwGw8cUGEo0o0rQBkT9HxNg-3rJwPHxfPuU69jNcHBm2quh1ouT_vAMS4tH_-wi4etEdkItTH4G6dhmqYZcQsCpttn3imeGcy5DDtBjPS_x?key=wCM-QJWI9fwjjl4oWyxjYg)** 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/)