Integrate Docker With CI/CD Pipelines

Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

Integrate Docker

with CI/CD
Pipelines
CI/CD Pipeline
◦ A CI/CD Pipeline implementation, or Continuous Integration/Continuous Deployment, is the backbone
of the modern DevOps environment. It bridges the gap between development and operations teams by
automating the building, testing, and deployment of applications. In this blog, we will learn what a CI/CD
pipeline is and how it works.

◦ Before moving onto the CI/CD pipeline, let's start by understanding DevOps.
DevOps
DevOps
◦ DevOps is a software development approach which involves continuous development, continuous
testing, continuous integration, continuous deployment, and continuous monitoring of the software
throughout its development lifecycle.
◦ This is the process adopted by all the top companies to develop high-quality software and shorter
development lifecycles, resulting in greater customer satisfaction, something that every company wants.
◦ Your understanding of DevOps is incomplete without learning about its lifecycle
◦ .Let us now look at the DevOps lifecycle and explore how it is related to the software development
stages.
Pipeline lifecycle
◦ CI stands for Continuous Integration and CD stands for Continuous Delivery/Continuous Deployment.
◦ You can think of it as a process similar to a software development lifecycle.

◦ The above pipeline is a logical demonstration of how software will move along the various stages in this
lifecycle before it is delivered to the customer or before it is live in production.
Pipeline lifecycle
◦ Let's take a scenario of a CI/CD Pipeline.
◦ Imagine you're going to build a web application which is going to be deployed on live web servers.
◦ You will have a set of developers responsible for writing the code, who will further go on and build the
web application.
◦ Next, it goes through the build phase, which is the first phase of the pipeline, where developers put in
their code and then again the code goes to the version control system with a proper version tag.
Pipeline lifecycle
◦ Suppose we have Java code and it needs to be compiled before execution.
◦ Through the version control phase, it again goes to the build phase, where it is compiled.
◦ You get all the features of that code from various branches of the repository, which merge them and
finally use a compiler to compile it.
◦ This whole process is called the build phase.
Pipeline lifecycle
◦ Once the build phase is over, then you move on to the testing phase.
◦ In this phase, we have various kinds of testing.
◦ One of them is the unit test (where you test the chunk/unit of software or for its sanity test).
Pipeline lifecycle
◦ When the test is completed, you move on to the deploy phase, where you deploy it into a staging or a
test server.
◦ Here, you can view the code or you can view the app in a simulator.
Pipeline lifecycle
◦ Once the code is deployed successfully, you can run another sanity test.
◦ If everything is accepted, then it can be deployed to production.
Pipeline lifecycle
◦ Meanwhile, in every step, if there is an error, you can shoot an email back to the development team so
that they can fix it.
◦ Then they will push it into the version control system and it goes back into the pipeline.

◦ Once again, if there is any error reported during testing, the feedback goes to the dev team again, where
they fix it and the process reiterates if required.
Pipeline lifecycle
◦ This lifecycle continues until we get code/a product which can be deployed to the production server
where we measure and validate the code.
CI Tool and Its Importance in the CI/CD
Pipeline
◦ Our task is to automate the entire process, from the time the development team gives us the code and
commits it to the time we get it into production.
◦ We will automate the pipeline in order to make the entire software development lifecycle in
DevOps/automated mode.
◦ For this, we will need automation tools.
◦ Jenkins
CI/CD Pipeline Tool
◦ Jenkins provides us with various interfaces and tools in order to automate the entire process.

◦ We have a Git repository where the development team will commit the code. Then, Jenkins takes over from
there, a front-end tool where you can define your entire job or the task. Our job is to ensure the continuous
integration and delivery process for that particular tool or for the particular application.

◦ From Git, Jenkins pulls the code and then Jenkins moves it into the commit phase, where the code is
committed from every branch. The build phase is where we compile the code. If it is Java code, we use tools
like maven in Jenkins and then compile that code, which can be deployed to run a series of tests. These test
cases are overseen by Jenkins again.

◦ Then, it moves on to the staging server to deploy it using Docker. After a series of unit tests or sanity tests, it
moves on to production.
CI/CD Pipeline Tool
Try Out
◦ Pull Jenkins Image
◦ Install and configure
◦ Explore the interface
The END of DAY 3

You might also like