TASK-1 Integrating Github Jenkins and Docker
Task description:
JOB#1
If Developer push to dev branch then Jenkins will fetch from dev and deploy on dev-docker environment.
JOB#2
If Developer push to master branch then Jenkins will fetch from master and deploy on master-docke environment.
both dev-docker and master-docker environment are on different docker containers.
JOB#3
Manually the QA team will check (test) for the website running in dev-docker environment. If it is running fine then Jenkins will merge the dev branch to master branch and trigger #job 2
So lets get started.
create a github repository, copy the link of the repo. Now we will create a folder and initialize it with git, and copy the code below from the images.
After we push the html code to the GITHUB, Now lets create web hook so that the code will automatically will be downloaded by jenkins, we can do this by jenkins poll scm but it is time consuming and sometimes slows download the system.
Before we create web hook we have to expose our jenkins publically, so we are using Ngrok open source application here. you can download it from google or from the below link
Now go to github, open your repository and click on settings, go to webhooks and select on add webhook and post the link generated from ngrok application for ex: https:5b35ba2123a28.ngrok.io
Now lets create our jobs in jenkins and automate the process
Job1: This job will be download the code from github and then run in shell first it will copy the file into the folder name task1 and then it will launch new container name "master_task1" and now this website QA team will manually check.
after the job is success then we can see the output.
Job2: when Developer push to dev branch then Jenkins will fetch from dev and deploy on dev-docker environment.
The output for job2
Job3: In job3 Manually the QAT will check for the website running in dev-docker environment. If it is running fine then Jenkins will merge the dev branch to master branch.
The pipeline view for the task performed.
I should have completed this long back but I ignored and later forgot to complete this task, If you find any issue in this task then feel free to ping me up, we will try to fix together, Thanks for reading.