Project using Jenkins CI/CD with GitHub integration

Table of contents

Project Description

The project aims to automate the building, testing, and deployment process of a web application using Jenkins and GitHub. The Jenkins pipeline will be triggered automatically by GitHub webhook integration when changes are made to the code repository. The pipeline will include stages such as building, testing, and deploying the application, with notifications and alerts for failed builds or deployments.

Steps:

Step 1: Go to the AWS console and launch an EC2 instance.

EC2 is launched and running

Connect to the EC2 instance using SSH client

You can check docker is installed and running

sudo systemctl status docker

For Jenkins

we need to allow all traffic on port 8080 in the instance security group and edit inbound rules.

  • Step 5:

1.Browse instance Public-IP:8080

  • Jenkins window is open

2.Go to terminal and use command for password

cat /var/lib/jenkins/secrets/initialAdminPassword

3. Paste above password in Administrator Password and click on Continue

4. Install suggested plugin

5. Plugin installation is getting started

6. Create first user

7. Jenkins setup is completed and Jenkins is ready to use

Jenkins Dashboard

Step 6: Create freestyle project

1. Click on 'New Item' button

2. Enter an item name and select “Freestyle project” as the project type and click OK

3. In Configure, Add description

4. In source code management, Write your GitHub repository URL

5. Add credentials for jenkins

6. Add private key which we created using ssh-keygen command

7. In the Build steps select 'Execute shell'

Click on add SSH key

Key is added

Step 2: For GitHub-Webhook

1.Go to your GitHub repository and click on Settings.

2.Click on webhooks (leftside ) then add webhook on right

3. In the ‘Payload URL’ field, paste your Jenkins environment URL. At the end of this URL add /github-webhook/. In the ‘Content type’ select: ‘application/json’.

Step 3: For Installing GitHub Integration plugin in Jenkins

  1. Open your jenkins dashboard

Step 4: Configuring Jenkins

1. build Triggers, select 'Github hook trigger for GITScm polling'

2. Do some changes in the code

Browse public IP address with port no.8000

Thanks for reading !!