Basic Automation With Jenkins

Kritika Shah
4 min readJul 16, 2020

--

Introduction to continous integration Continuous delivery is an ongoing DevOps practice of building, testing, and delivering improvements to software code and user environments with the help of automated tools. The key outcome of the continuous delivery (CD) paradigm is code that is always in a deployable state.

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-docker 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

Prerequisite:

  1. Docker Installed and Configured in Your VM.
  2. pull httpd image in your base OS from hub.docker.com
  3. Jenkins Installed and Setup in your System.
  4. Configure Sudo Privileges to Jenkins.
  5. Git bash Installed on Your System.
  6. ngrok ( to create a tunnel for network to connect IP’s outside the Private Network to local running service ).
  7. Create Empty and Un-Initialized Github Repository.

Step 1-

  1. we will create a local repository using Gitbash .Then with the use of git init command we will add our files to folder nd then we will make it a local repository.

2. After creating repository,add your files . Then, Create a hook for post-commit and post-merge so the developer need not to be manually push the code every time he commits

3. After that we will create an empty repository in github and push our files.

4 . Then we will create a developer branch and make some changes in it.

# git branch dev

#git checkout dev

Then again after adding and commiting we will push our files in git repository in dev branch.

Now you can see changes in your git repository.

Job 1 in jenkins: We will create a job1 whose task is to If Developer push to dev branch then Jenkins will fetch from dev and deploy on dev-docker environment. We will provide here Github repo link so that it can fetch files.

Here we will also specify the branch on which we will work which here is dev.

Job 2 in jenkins:

we will create a job 2 whose task is If Developer push to master branch then Jenkins will fetch from master and deploy on master-docker environment.

Job 3 in jenkins: Job 3 task is 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.

Firstly we will add the Github repo URL.Then specify branch to dev branch and merge it with master branch.

We can also see the changes in Github after merge of master and dev.

Thankyou!!!!

--

--

Kritika Shah
Kritika Shah

No responses yet