April 9, 2020
Estimated Post Reading Time ~

Continuous Delivery Best Practices

Continuous Delivery is the methodology or a software strategy where code changes are automatically built, tested, and prepared for a release to production. Continuous Delivery makes the code deployment possible at any time by a single click.

Continuous Delivery takes care of the testing process before each deployment in any environment. It first runs the possible test suites which can be regression tests, integration tests, load tests, etc. to test the code and if only the tests are passed then only the code is deployed in the respective environment. We can even automate the whole process to ensure a no-outage deployment, so there’s no downtime involved and therefore no impact on the business. 

Basically, the goal of continuous delivery is to enable the continuous flow of changes in different environments via an automated software production line. Continuous Delivery enables the roll-out of new functionalities and features that are better than previous iterations, therefore gradually incorporating and refining the continuous delivery principle throughout the organization. This methodology provides rapid feedback to Agile software teams to respond to market demands and eliminate problems quickly. 



Why companies should go with continuous delivery:
1. Product quality is improved→ Since the deployment is automated it occurs more frequently which lets the development teams obtain necessary user suggestions and feedback very often and quickly. This feedbacks give the idea to work on the important features without wasting time on other unimportant features. This helps to bring the code and product quality improved and makes the right product.

2. React and respond quickly to changes→ Companies are always facing challenges when we talk about the change in the technology market. It is very difficult to keep up with technology changes. If we spend too long on anything, by the time we deliver the product, maybe there is a chance that the technology requirement is changed or new opportunities have emerged. Continuous Delivery makes it possible to react to these changes very quickly without investing a large amount of time and money. This also makes the company react to opportunities and search for new ideas and potential new revenue streams.

3. Stability and Reliability→ Since the deployment are frequent and making changes in very small increments reduces the risk of the problems being caused. Also by keeping the changes the smaller it is easier to find and fix the problem if it occurs, therefore minimizing the money and time that they have the impact on. By doing this Continuous Delivery teams can maintain code and product with great stability and reliability than before.

4. Save time→ if the organizations do not apply the continuous delivery approach, then provisioning the environments, finding bugs and resolving them is a very tedious task. Going with the CD approach above steps can be automated So there is a need to automate this process. This saves a lot of time and enables organizations to deliver more business value.

5. Strategic Impact→ All the above points gives a strategic impact on the organization's culture of making better and efficient products due to frequent user feedback, benefits of an earlier release, business innovation, reliability, and stability. That what’s the organization wants. That’s why we must go with continuous Delivery.

Best Practices to achieve Continuous Delivery:
The biggest challenge in achieving the CD is to find the best possible way to automate the build and tests in different environments in the shortest amount of time. Continuous Delivery pipeline and build pipeline is what makes it all happen. A delivery pipeline is a way to deal with this by breaking up the delivery process into various builds. Each build provides increasing confidence by providing feedback. The pipeline breaks down the delivery process in stages. Each stage is aimed at testing the quality of the code and features from a different angle to validate the new functionality and prevent errors. There are various tools that help in automating the whole process. 

1. Make the build pipeline→ Build pipeline consists of the various jobs executed in the particular environment. The next job in the build pipeline will execute after the previously executed job runs successfully otherwise the pipeline gets aborted. The whole process of jobs and build automation is managed by a CI/CD tool called Jenkins. Jenkins is an application that allows continuous integration and continuous delivery of projects, regardless of the platform you are working on. It is a free source that can handle any kind of build or continuous integration. Jenkins can also be integrated with other deployment technologies.

A. Pull the code from the BitBucket→ BitBucket is a version control software tool that helps the software teams to manage the source code over time. BitBucket keeps track of changes in code so that we can revert the changes made at any time. It allows the team members to push the code concurrently. If changes made are conflicting then it can be solved in an orderly manner without blocking the work of the rest of the team. Now we make a job that pulls the code whenever there is a change in the source code.

B. Run Unit tests → The second job which runs the unit test suites on the newer version of the application to ensure that it meets all the desired requirements. It is important that all the important aspects like functionality are verified when the newer version is uploaded.

C. Build the code → when the code is fully tested then the code is build that incorporates compiling, linking and packaging the code into a usable or executable form. For this, we use build tools which are programs that automate the creation of executable applications from source code. Using an automation tool allows the build process to be more consistent. For getting the best results we can use MAVEN or GRADLE as the build tool. The best part of using MAVEN is its life cycle. As the project relies on certain standards, with maven one can pass through the life cycle with greater ease. Build tools package the source code into WAR or JAR which is easily deployed.

D. Code Analysis→ It is very important for every project to find the quality of code in order to find potential errors or poor coding style and practices. There are various code analysis tools that use a collection of algorithms and techniques to analyze the source code. SONARQUBE is an open-source tool for the continuous inspection of the code. Sonarqube provides the facility of configuring Rules, alerts, thresholds, exclusions, settings online. Code analysis enables us to quickly uncover project components or modules that are in technical debt to fulfill or establish action plans.

E. Deployment Automation → Deployment tools make the application deployments automated on a regular basis with easier ways of changing the configurations for the applications. Tools like Ansible unites the workflow orchestration with provisioning, configuration management, and application deployment. After the deployment, we can run regression tests and use selenium to automate these tests.

F. Slack notification Channel → it is necessary to have a centralized channel over which everyone can directly access and monitors the activity of any kind by sending and getting notifications. This helps to keep in touch with the activities performed.


2. Make the delivery Pipeline → When the execution of the job is automated in an environment, then it is called a build pipeline. While when the job’s execution is automated across the various environments then it is called Delivery Pipeline. Below are the stages of continuous delivery: 

The code is tested and build in the dev environment using the build pipeline.
The artifact will be pushed to the artifact or like nexus, Jfrog.
The application will be deployed on to the stage environment and Regression tests being done on it using tools like Selenium.
The application will be deployed on the pre-production environment and Load testing is done using tools like Jmeter.
At any stage, feedback should be given to the team members, clients by using the notifications on the slack channels.
By now the code is ready to be deployed on the production environment and released.

After executing the above steps build is ready to be deployed in the production environment.

By following the above methods, you can make use of Continuous Delivery best practices in your infrastructure to make your life easier. 


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.