> For the complete documentation index, see [llms.txt](https://nasi-chaudari.gitbook.io/devops-on-aws/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nasi-chaudari.gitbook.io/devops-on-aws/continuos-integration-with-github-and-jenkins.md).

# Continuos Integration with GitHub and Jenkins

Everytime your developer makes changes to the code in Github Repository will you login to Jenkins and click "Build Now" all the time??

In previous section we have successfully created **Ansible playbook** and automatically deployed our application on **Tomcat** server but we have to click <img src="https://2593464885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3DMI85ymmo2BqduKTK9p%2Fuploads%2F7CQFhLNYIHsHaix5H0Wo%2Fimage.png?alt=media&amp;token=b5e67bb9-fb30-476d-8aa9-e2bd89008897" alt="" data-size="line"> everytime we wanted a build file.

What if I say we can automate that too! :relaxed: Let us do something so that if there is any change in the code **Jenkins** should detect it and Build new file, pass it to ANSIBLE, which will create our container and move the file in it & BOOM!!! our application is live.

1. Sign into your **GitHub** account and select your repository&#x20;
2. Go to settings option >> Choose ![](https://2593464885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3DMI85ymmo2BqduKTK9p%2Fuploads%2FQyAw823VfEoMDdAR3V7O%2Fimage.png?alt=media\&token=6c121d1e-06da-42a3-8762-0b52f3272561)>> click on Add Webhook (provide password, if asked)
3. You will be asked to enter **Payload** URL, you will get this from Jenkins.
   1. Login to Jenkins

      1. Manage Jenkins >> Configure system
      2. Search for "GitHub" <img src="https://2593464885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3DMI85ymmo2BqduKTK9p%2Fuploads%2FKNpp7ZynQzLeBmFetl2W%2Fimage.png?alt=media&amp;token=259e1714-50ea-4279-aa97-6ca27dce7152" alt="" data-size="original"> >> Click on Advanced and tick the "specify another hook URL for GitHub Configuration" >> Copy the link and paste it in Github Payload URL section.

      ![](https://2593464885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3DMI85ymmo2BqduKTK9p%2Fuploads%2F97kCePvSlSJErN08zXvW%2Fimage.png?alt=media\&token=7e4370ae-9621-45c4-b603-5c832a61e86d)
   2. After putting the url scroll down and select on
   3. ![](https://2593464885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3DMI85ymmo2BqduKTK9p%2Fuploads%2FO6gYz7rqDHx6jOBqZf00%2Fimage.png?alt=media\&token=c5b5cdda-e71f-4d4e-ae0e-caf92d4c0ea7)
   4. Add webhook

You have successfully created your webhooks Now go to your Depoyment Job and do these settings

1. Select your Job>> Configure.
2. In build section tick the GitHub hook trigger option and APPLY & Save

![](https://2593464885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3DMI85ymmo2BqduKTK9p%2Fuploads%2FzY87ntQa33HuWXIFib5F%2Fimage.png?alt=media\&token=a27a25b5-6b3f-49cc-846b-ccb9ec0a2aca)

THAT'S ALL!! We have successfully implemented **Continuos Integration** Let's Try it out my making some changes in the code.&#x20;

I wil change the background color from green to blue and let's see if JENKINS can detect and build it or not!!

![](https://2593464885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3DMI85ymmo2BqduKTK9p%2Fuploads%2FhanauI90ldbzsPZUiHDx%2Fimage.png?alt=media\&token=f61697f4-b43b-459c-b282-81e66fa12b13)

Hooray!! We have Completed our project "Learn DevOps on AWS - using GIT, Maven, Jenkins, Docker and Ansible. "
