Day 24 of #90DaysOfDevops || Complete Jenkins CI/CD Project

Day 24 of #90DaysOfDevops || Complete Jenkins CI/CD Project

·

3 min read

Task:

  • Build a jenkins pipeline with github integration

  • Put Dockerfile in project

  • Use webhooks to integrate github with jenkins

  • Build and deploy containerized application

  1. First we will choose github project. For this we are going to take social media application. Now clone this repo to your instance.

  2. Now we will move to jenkins platform. For installation of jenkins visit this blog.

  3. On Jenkins portal we will create new item. Put title and choose freestyle project for now.

  4. Here we put description and in github project we put the link to project repo

  5. Next we select source code management as git and put link.

  6. Give repository URL and in credentials we have to create a credentials. So for that we create keys in instance.

  7. Now we will copy the public key from here and got to github and in github settings and provide SSH keys over there.

  1. As we setup here public key. Now we move to jenkins platform. We setup here credentials and for credentials we are using ssh keys and username.

  2. Put private key generated on instance and set username as github username on it

  1. Now we use execute shell and in shell we will write executing commands for docker compose as the project contains docker compose file already for complete containerization process visit here

Now we will update some code and execute git and see if the build automates. For now it is not working

To execute the github push we have to configure github hook trigger for GITScm polling. Save and apply.

Now push some updated code to it. Also we need one plugin installed called github integration

After the installation restart the jenkins.

Now go to github project repo and in the project go to settings

Over there we can see webhooks. Choose it and new window will appear

Here we create a new webhook, put name to it

Now we provide payload URL of jenkins as <url>/github-webhooks/

Also select content type application json.

Nowe we will wait for webhook to configure over jenkins network.

Then after green tick visible on webhook we move further and make chnages to code and push those changes to github and pipeline will automatically build the project.

Here we can access the application deployed on instance with CI/CD pipeline.

End of Post.


Reach me on:

  1. Github-> github.com/Hrmn97

  2. Twitter -> twitter.com/Harman9765

  3. LinkedIn -> linkedin.com/in/chetan-harman-56310424a

  4. Website -> devhrmn.netlify.app