A Quick Guide to CI/CD

Tags: continousintegration, continousdelivery, devops, softwaredevelopment
Published: 2020-09-28 06:51:25

**CI/CD** is a central part of software engineering. It is a well defined, automated life cycle for code integration and delivery to stakeholders(QA’s, Customers, Business heads etc). Central to this is automation. CI/CD or the lifecycle is built on automation. Software development teams usually consist of people with diverse skill sets. Such as engineering, quality, business associate, CxOs, designers, administrators etc. CI/CD as a discipline helps these diverse groups to communicate effectively by continuously integrating and delivering. 

**For e.g.**

_Are Design artefacts available in the code repository?_

Great, The CI,CD pipeline will automatically send a mail notifying the development team.

_Has the latest feature merge has broken the existing flow?_

The CI, CD pipeline will notify immediately instead of having to go through the entire test cycle

_Is there an update or a new deliverable?_

Perfect. Let's send an OTA update of the app to the CxOs phones
By automating the entire process of building, integrating and testing, bugs are detected earlier and fixed, delivery is faster and inevitably, quality is improved.

##Everything is part of a pipeline
As we saw above **CI/CD** is a series of activities that are automated. A pipeline is simply a group of such activities or events which have well built rules. The **“jobs”** in a pipeline are executed one after another or if there is no dependency, based on requirement, in parallel. In Fact it’s recommended to speed up the build, test, feedback loop, and to speed up deployments, by running parallel pipelines. Each job/event in a pipeline can generate output which will serve as an input to the next job. They can be triggered because of an external event. For ex A job in a pipeline can consist of the following events

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/1zxxcmbn5lqog6ojbylb.png)

Fetch the latest source code from the development-master branch
Start a build environment for executing the build script Link to necessary libraries and dependencies Run the test suite on the desired environment If successfully built, notify or deploy depending on result If failed to build, notify and take appropriate action This external event that runs in the pipeline is triggered by a simple code commit. Note that if the output of one stage fails, the entire process fails, thereby catching errors right at the source.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/fg1oi9zavwxkv0iydpg7.png)

_Since integrations are fast and automated, speed of development is faster._

_Every time a commit happens, if all goes well, there is a deployable version of the product._ 

_Errors are spotted at the source and hence fixed easily._

_Production deployments are almost certain free from broken code_ 

_No manual intervention, hence less scope of missing out on errors. Repeatable process_

##Role of automation
**CI/CD** is built on automation. Every job or task can be configured to run or work on a particular environment or with a certain set of variables. This is known as declarative configuration. Automation is mandatory for testing a build. There are lots of tools which integrate with various build systems and provide comprehensive coverage. Because of automation, every engineering integration passes through a reliable and comprehensive suite of test cases. These are incrementally added/updated. Hence errors and faults are far and few in between. Even when it happens, automation steps in and informs ASAP via logs, alerts, mailers. All pre configured

##CI/CD with Agile
In a dynamic project with changing requirements, and reduced time to market, CI/CD is the perfect foil for the Agile methodology. Agile is built on continuous feedback, rapid prototyping, self organising teams and fast development/deployment. CI/CD helps the agile team by removing hindrances to communication, automating deployment and testing and emphasis on cross functional compatibility. CI/CD in spirit is about the spirit of cooperation across teams to deliver a winning product. This is a perfect companion to agile’s focus on process improvement while accelerating delivery

##DevOps Culture + Agile Mindset
CI/CD is not limited to a set of automated processes to speed up delivery and improve quality. It aims to be the backbone of DevOps culture. In association with Agile process and CI/CD, DevOps bridges the gaps, complexity and differences between engineering and operations. DevOps strives to increase cross functional collaboration by sharing responsibilities and increasing communication. By defining what needs to be achieved and how it should be achieved via CI/CD, DevOps encourages working together

##Tools
There are tons of free, premium and freemium tools for all CI/CD tasks like automating builds, test suites, code scans. Some of the most popular tools we use at [CodeCraft](https://www.codecrafttech.com) for our customers and in house development are

_Jenkins, Travis, Bamboo, SonarCube, GitLab, Ansible etc.,_

and many more
Also, check out sites like
[https://stackshare.io/](https://stackshare.io/) and [http://www.devopsbookmarks.com/](http://www.devopsbookmarks.com/)
where new and latest DevOps related tools are listed every day. It also highlights the trending topics in the DevOps landscape

##Conclusion
CI/CD is no longer or rather was never a buzz word which enterprises used to throw around. It is a proven way of developing, testing, and deploying software faster. All the while keeping the focus firmly on Code quality. It syncs well with any existing software development methodology, although it’s always better to use it with an Agile process.