DevOps Culture and CICD

A.H Shahrukh khan
8 min readJan 10, 2020

--

DevOps is trending and hot in the IT world as it has been adopted by most top companies such as Amazon, Netflix over 100 million users, Facebook and NASA to name a few! Very impressive isn’t it?

So what does DevOps actually mean?

DevOps is an amazing software development methodology that combines software development (Dev) with IT operations (Ops) participating together in the entire service life-cycle, from design through the development process to production, it is a set of practices that automate the processes between software development and IT teams, in order that they can build, test, and release software faster.

In a nutshell — DevOps is a culture that bridges the gap between development and operation teams

DevOps Engineer job Market is booming right now!

Now that we have established the importance and the flourishing market of DevOps Skill set

Let’s dive into a bit more detail to discover some of the high demand DevOps practices and tools to build a very basic but exciting Pipeline using Docker and Jenkins.

DOCKER! — There is a real buzz about Containerization and Docker!

Docker is the one of the best virtualization platform to containerise your app, popularity and adoption of Docker is rapidly growing due to its incredible benefits! Top companies like ING, Paypal, ADP, and Spotify keep using Docker. Continuous Integration Efficiency with Docker enables you to build a container image and use that same image across every step of the deployment process. A huge benefit of this is the ability to separate non-dependent steps and run them in parallel, running applications in containers instead of virtual machines is gaining momentum in the IT industry.

Docker does really make it easier to create, deploy, and run applications by using containers, and containers allow a developer to package up an application with all of the parts it needs, such as libraries and dependencies, ship it all out as one package

We will learn and practice more about Docker in next steps together with Jenkins.

Let’s move on to CI — Continuous Integration and CD — Continuous Delivery and Deployment

CI CD is considered as the backbone of DevOps practices and automation, It plays vital, challenging and exciting role in DevOps culture, growing numbers of companies releasing software in minutes with the adoption of CICD practices.

Approximately 2400 companies reportedly use CICD pipelines in their tech stack, including Facebook, Netflix, and Instacart, predominantly to gain the benefits of Faster software builds, customer satisfaction by deploying the app in time, Small code changes make fault isolation simpler and quicker, are the few advantages.

Before running the demo let us understand the difference between continuous delivery and continuous development step by step?

Continuous Integration (CI): Developers merge/commit code to master branch multiple times a day, fully automated build and test process which gives feedback within few minutes, by doing so, you avoid the integration hell that usually happens when people wait for release day to merge their changes into the release branch.

Continuous Integration and Continuous Delivery:

Continuous Delivery is an extension of continuous integration to make sure that you can release new changes to your customers quickly in a sustainable way. This means that on top of having automated your testing, you also have automated your release process and you can deploy your application at any point of time by clicking on a button. In continuous Delivery the deployment is completed manually.

Continuous Integration and Continuous Deployment:

Continuous Deployment goes one step further than continuous delivery, with this practice, every change that passes all stages of your production pipeline is released to your customers, there is no human intervention, and only a failed test will prevent a new change to be deployed to production.

CICD Workflow:

How CICD Practices relate to each other: To put it simply, the continuous integration is part of both continuous delivery and continuous deployment. The main difference is the deployment step, in continuous delivery the deployment is done manually and in continuous deployment it happens automatically.

What is a CI CD Pipeline: The CI/CD pipeline is all about automation: Initiating code builds, automated testing, and automated deploying to the staging or production environments. It’s complex and exciting at the same time, but incredibly fast, if the output of any stage fails, the next stage will also fail.

Best CICD Tools to build Pipeline?

Well, there are many tools with their specific pros and cons and today we’ll talk about one of the best tool called Jenkins.

Why Jenkins? Multi Billion Dollar companies like Facebook, Netflix and Ebay have adopted Jenkins because of it’s amazing advantages, Jenkins is an open-source automation server in which the central build and CI process take place, It is a Java-based program with packages for Windows, macOS, & Linux.

Great range of plugins available, Jenkins supports building, deploying, and automating for software development projects, easy installation, simple and user-friendly interface, extensible with huge community-contributed plugin resource, easy environment configuration in user interface & supports distributed builds with master-slave architecture.

Now the most interesting part — the practical exercise:

Project outline:

Jenkins pipeline step by step — to keep it simple we’ll leave Git for next time.

Step 1 — How to create a Jenkins job —
Step 2 — How to build a pipeline in Jenkins
Step 3 — How to link the jobs

Prerequisites: Jenkins and Docker should be installed on your system

Jenkins: https://jenkins.io/doc/book/installing/

Docker: https://docs.docker.com/search/?q=install

Just for reference: This demo is run on Linux Ubuntu distribution

Step 1: Start Jenkins

Run this command from the folder where you have jenkins.war file

Command to start Jenkins: java -jar jenkins.war

Open your browser and type www.localhost:8080

If port 8080 is already in use then use java -jar jenkins.war –-httpPort=7070

(you can specify any other port number).

Login to your account:

Click on New Item

Enter name as Job1 (you can choose any name you wish)

select freestyle project then click OK

Repeat these steps to create to 2 more jobs with names Job2 and Job3

click on dashboard

Your dashboard should look like this

Now click on Job1

Click on Configure on the left menu

click on add build step

Select Execute shell

Enter this command: date

Then click on Post-build Actions and select build other projects

Enter name of Job2 then click apply and save.

Click on back to dashboard and repeat same steps as Job1:

click on Job2 then click on configure

click on add build step and select Execute shell

Enter this command: sudo docker pull ahskhan/jenkins:v1

Enter Job3 in Project to build field, apply and save.

Click on Back to dashboard

click on Job3 then click on Configure

click on Add build step and select Execute shell

Enter this command: sudo docker run ahskhan/jenkins:v1

Click apply and save.

We have built our pipeline using Jenkins!!! Its show time now!

Back to dashboard and click on Job1

Click on Build Now on the left menu above

It will build the Job1 simply by printing today’s date and trigger the next Job — Job2

To see the outcome of Job1 click on console output

You will see the outcome as below

Job1 has been successfully completed and it automatically triggered Job2

Click on Job2 on the above screen on your system then click on down arrow underneath build history and select Console output

Job2 output will pull the image from Docker hub repository as below

Job2 has successfully pulled Docker image from Docker hub repository!

Click on Job3 on the above screen on your system and repeat same steps as Job2 to view Console output for Job3

Job3 will run the image pulled by Job2 and display the message from Docker image as below

WOW!!! Congratulations! You have done it!!!.

Increase the frequency and pace of releases so you can innovate and improve your product faster. The quicker you can release new features and fix bugs, the faster you can respond to your customers’ needs and build competitive advantage. Continuous integration and continuous deliver/deployment are practices that automate the software release process, from build to deploy in DevOps culture.

In the next phase we will focus on Micro-services Architecture using Kubernetes (K8)

--

--

A.H Shahrukh khan

Senior DevOps Engineer | DevOps SME | AWS Certified Solutions Architect | Senior DevOps Trainer | Certified Kubernetes Application Developer