# Jenkins Integration

This documentation will help you integrate Jenkins Build Job with Squadcast.

With this, you will be able to bring in your build updates, such as success and failure statuses as incidents on Squadcast.

### Integrate with the Jenkins Plugin

* Log into your Jenkins account
* Install [Post build task plugin](https://wiki.jenkins.io/display/JENKINS/Post+build+task) in Jenkins
* Create a user in Jenkins

{% hint style="info" %}
**Note:**\
This user will be used with curl command to fetch the Jenkins job status.
{% endhint %}

In Squadcast:

* Navigate to **Services** -> **Service Overview** -> select or search for your Service. Expand the accordion -> In the Alert Sources section, click **Add**.

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-4fbd74e7ca0b30173c47a1d58ed6a0804a0465aa%2FAlert_Sources.png?alt=media\&token=aaca6610-9d18-4dd4-9cf5-320042f326f1)

* Select **Jenkins**. Copy the displayed **Webhook URL** to configure it within **Jenkins.** Finish by clicking **Add Alert Source** -> **Done.**

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-a61e17e5e70cf0936f2703ec44da480a9a94c69f%2FJenkins.png?alt=media\&token=cadcebf7-687d-481e-808b-f36765c26d60)

{% hint style="warning" %}
**Important:**

When an alert source turns Active, it’ll show up under Configured Alert Sources, you can either generate a test alert from the integration or wait for a real-time alert to be generated by the Alert Source. An Alert Source is active if there is a recorded incident via that Alert Source for the Service.
{% endhint %}

* Add a Post-build task and run the following command in the Script text box.
* Replace the API URL here with the API Webhook URL you see on Squadcast for the created service.
* Replace username and password with your Jenkins username and password.

```
curl https://raw.githubusercontent.com/SquadcastHub/Integration-scripts/master/jenkins/send-data-to-squadcast.py | python3 - --url *EnterSquadcastAPIURLHere* --username *EnterYourJenkinsUsername* --password *TypeYourJenkinsPassword*
```

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-40106716fe7311c0de00160e0b00c42f3177b446%2Fjenkins_2.png?alt=media\&token=65924e17-3857-4d1a-a2bb-b694852839a4)

{% hint style="info" %}
**What we recommend:**

We highly recommend cloning this repo and using your repo link in the above curl call. This will allow you to customize your incident description.
{% endhint %}

### Sample incident created in Squadcast-App

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-47bcde382d20514ddd9bf6149f637fe0b825b21b%2Fjenkins_3.png?alt=media\&token=8c58b0bb-fce7-4574-baeb-abd958c3d314)

*Have any questions?* [*Ask the community*](https://community.squadcast.com/view/home)*.*
