In this post, we are going to focus on concepts of Continuous Integration (CI) and Continuous Deployment/Delivery (CD) methods in DevOps. Before going to details of CI/CD, we must go through and understand DevOps. I hope you have already gone through our earlier posts on DevOps.
What is DevOps?
Let’s start with understanding DevOps first, different people define it differently. If you are into DevOps or reading through, trying to understand or implement, you might have heard many different versions of its definition.
A Developer writes code for many different tasks like – Code for New Applications or products, Bug fixes, security updates etc. When this comes to deploy in the actual environment (Production environment) where users can use it, a developer needs to wait for days or weeks. Reason would the bandwidth for Operations team finishing up their huge pile of work before they take up new. This delay causes delay in products availability in market also on the other hand it becomes difficult for developers to manage the multiple versions of code, one that is pending to push to production and other on which he has to work on next. Moreover, when the code gets deployed into Production environment, occasionally unforeseen errors occurs. This happens because, developer writes code for their development environment which is not similar to the production environment. This ultimately increases work for the operations team to manage the environment and making sure systems are up and running. Operations team has to do lots of massaging on every new code that comes to production and continuously diagnose to ensure a stable environment. Any issue that occurs due to code, leads to many different issues in production environment and delay in availability of product in market.
To overcome this major issue in Software Development Life Cycle (SDLC), it is critical that Developer and Operation work together and share responsibilities. Basically, it’s about changing mindset and culture on how Development and Operations work.
So, DevOps is a phrase in SDLC, mean to Change and Improve the work relationship between Development and Operations Teams thereby improving collaboration and productivity by automating infrastructure, workflows, Continuous testing and Continuously measuring application performance.
What is CI/CD?
You must have seen this picture multiple times now, Lets try to understand this. Every time you ask someone about DevOps or CI or CD, they will immediately bring out this picture. We will use the same to avoid adding more confusions if any.
Conventional or traditions approach of developing software is becoming obsolete rapidly. While Agile was focusing to deploy software in monthly, quarterly or bi-annual releases, DevOps focuses to deploy software in weekly, daily or sometimes multiple releases in a day. Shortened Delivery Cycles and Automation across the processes makes it really happen. CI/CD focuses on such automation in place which makes DevOps exist.
Once we are done with the Planning, there are two phases Continuous Integration and Continuous Deployment (CICD). We as Test Automation Developers, we will be focussing more on Continuous Integration. So, on a high-level (and we will go in details for each of these in upcoming posts), Post planning phase development teams develops the Code. Which is being kept in source code repository such as GIT. As soon as the build (using Maven or Gradle etc) is triggered, automated tests get executed. This usually happens with Integration tools like Jenkins, TeamCity etc. This test execution gives us a clear picture of the code/build, whether it is perfectly fine or if there are certain issues. If there are any issues or discrepancies, then the whole process gets repeated and continues till the build is perfectly fine to move ahead. This whole process is called Continuous Integration. Continuous delivery is actually an extension of CI, in which the software delivery process is automated further to enable easy and confident deployments into production —at any time. CD depends centrally on a deployment pipeline by which the team automates the testing and deployment processes. This pipeline is an automated system that executes a progressive set of test suites against the build. CD is highly automatable—and in some cloud-computing environments—easily configurable.
Continuous Deployment extends Continuous Delivery. Let’s Consider the above scenario where build is perfectly fine after we are done with all necessary testing. As next step in pipeline, build automatically goes for deployment where automated environment/instance gets created, builds get deployed and rolled out to production. In, Continuous deployment, there is no need for a person to decide when and what goes into production. The last step in a CI/CD system will automatically deploy whatever build components/packages successfully exit the delivery pipeline.
A typical CI/CD pipeline example by Pega Community
- Developers Commit the Code
- CI Pipeline
- Unit Tests
- Integration Tests
- Automated Regression, UAT Tests
- CD Pipeline
- Early Detection of Bugs
- Enables Continuous Deployment
- Emphasize Test Automation
- Helps in determining Code Quality / Code Breaks
- Faster Development Cycle
- Improved Quality of the Product
There are many open source and commercial tools available in the market and I have listed the popular ones.
|Continuous Integration Server||Jenkins
kubernetes (container management)