In this article you will see how we can integrate Jenkins with Git and GitHub, which makes developer and operational team automatic.
To start with article first we understand the little background of Git, GitHub and Jenkins.
Jenkins :
Jenkins is one of the most powerful tool in DevOps world. Jenkins can do continuous development and continuous deployment automatically this makes Jenkins very special. Jenkins power comes from plugins.
GitHub:
GitHub is a system which provide centralized data sharing for remote world. GitHub works on centralized version control system (CVCS). GitHub require Network connectivity. GitHub have graphical user interface.
Git:
Git is a system which provide local data sharing. Git works on decentralized version control system (DVCS). Git don't require network connectivity when it work locally. If you have network connectivity in your local system you can pull (download) or push (upload) your file from GitHub.Git have command line interface.Let see some basic Git command :
- mkdir project
(It create a workspace in local system for developer)
- ls
(It shows file list of dictionary)
- git init
(It initialize local git repository)
- notepad web.html
(write program/code in notepad)
- git status
(It shows the file info.)
- git add web.html
(file go into staging area and now git will track the file)
- git commit web.html - "first"
(Copy this file in commit area and create a version of file)
- git log
(If any changes or editing done log will keep info. with version Id)
- git remote add origin "GitHub URL"
(giving GitHub URL to Git so that it will push the file at this location)
- git remote -v
(It check remote connectivity)
- git push --set-upstream origin master
(Finally file pushed on GitHub)
Setup :
So for practical I am using Linux OS and windows OS. Using virtualization I installed linux OS on top of windows OS. Linux OS will act as a webserver where I am going to upload a file/project for client and I will use my windows OS for client to access the webserver.
I installed Jenkins in Linux OS. Here I started my webserver service and Jenkins. I stopped my systems firewall for client, to access my webserver. It is very critical if we stop firewall but for practical you can do it. When your practical is done you can enable firewall.
I installed ngrok software in my Linux OS so that I can make my private IP to public IP. Why I am doing this? As we know that from Private IP you can access Public IP but from Public IP you can't accesss private IP. Jenkins is running on private IP and Github is running on public ip so to give access of our Jenkins to GitHub we have to make our systems IP public. So for this the tunnel we use is ngrok. That's why we give ngrok url in webhook. you can see red color highlighter is my systems public IP.
WorkFlow of our practical :










Supperb work bro
ReplyDeletedo we need to paste complete url till configure in webhook url??
ReplyDeleteyou have to copy till ngrok.io
ReplyDelete