Continuous Delivery Best Practices

22 / Dec / 2016 by Shivam Agrawal 1 comments

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 the continuous delivery is to enable the continuous flow of changes on the different environments via 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 the rapid feedback to Agile software teams to respond to market demands and eliminate problems quickly.

Continuous Delivery

Why companies should go with continuous delivery:

1.Product quality is improved→ Since the deployment is automated it occurs more frequently which let the development teams obtains necessary user suggestions and feedback very often and quickly. These 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 company to react to opportunities and search for new ideas and potential new revenue streams.

3.Stability and Reliability→ Since the deployment is 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 CD approach above steps can be automated So there is a need to automate this process. This saves a lot of time and enables the organizations to deliver more business value.

5.Strategic Impact→ All the above points gives the strategic impact on the organization 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 on 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 feedbacks. 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 the various tools which 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 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 which 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 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 which use a collection of algorithms and techniques to analyze the source code. SONARQUBE is 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 to quickly uncover project components or modules that are in technical debt to fulfill or establish action plans.

E. Deployment Automation → Deployment tools makes the application deployments automated on the 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.

 

slack notification channel

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

  1. The code is tested and build in the dev environment using the build pipeline.
  2. The artifact will be pushed to the artifact or like nexus, Jfrog.
  3. The application will be deployed on to the stage environment and Regression tests being done on it using tools like Selenium.
  4. The application will be deployed on the pre-production environment and Load testing being done using tools like Jmeter.
  5. 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.

Production environment

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.

I would like to mention my special acknowledgments to Rakesh Mahajan for sharing his vast knowledge and helping me out in writing this blog.

In my next blog, I’ll be writing about the Continuous Deployment best practices.

FOUND THIS USEFUL? SHARE IT

comments (1 “Continuous Delivery Best Practices”)

  1. Alexander Kus

    Hi Shivam, nice work on picking up the pieces and arranging them in one coherent article. What I miss is some diversity in the tooling propose, especially that Jenkins may be cumbersome to CI/CD newcomers.

    We made that tool specifically to lower the entry threshold to continuous development. It supports all steps from your article + uses isolated Docker container for builds.

    Keep up the good work and stay awesome!

    Reply

Leave a comment -