CI/CD is a development method for delivering software solutions in a safe, reliable and regular manner. It involves a continuous and automatic process for building, testing and deploying to meet a team’s code quality and software security standards. Traditionally when we talk about CI/CD, we think of deploying web or mobile apps, but CI/CD can also have a profound impact on developing IoT devices. In this blog, we will explore how CI/CD can benefit the IoT, the challenges faced by developers and how to overcome these challenges with a modern IoT approach to CI/CD.
CI/CD is known as a DevOps (Development Operations) practise and combines two different techniques CI (Continuous Integration) and CD (Continuous Deployment). Continuous Integration is the process of automatically building and testing code. It involves the constant integration of small code changes to a shared code repository that tracks these changes and provides version control. The code is regularly and automatically built and tested. The result is a software package that is ready to be distributed across servers or devices.
What makes CI powerful is the ability to integrate all team members code together in a single system. Members can make contributions without fear of code conflicting or introducing more bugs. If errors are introduced, the system can detect them and alert the user before it is deployed live. Fixes can then be made quickly before bugs proliferate and become costly to fix.
Continuous Deployment is the technique of distributing the software package that has been created by the CI. It is rare for an application to only be run on a single device or server and instead must be distributed across multiple different environments. Continuous deployment automates this process where it is simple for developers to release new solutions and updates in minutes rather than manually releasing which could take days.
The Internet of Things is the concept of having devices connected through the internet to form a giant network. It can use sensors as input, communicate with other devices and interact with the external world. Everything from smart cameras through to refrigerators and automobiles are expected to become IoT devices. It is now forcing engineers to rethink how the electronics embedded in these devices, known as embedded systems, are being developed.
Traditionally, embedded systems were explicitly thought to have limited connections to other devices. Now, however, embedded systems are expected to become a distributed intelligence across the IoT. Embedded software engineers need to understand how their devices can securely receive, process and transmit information in a much larger network. This has put enormous strain on developers and teams that are expected to add the additional functionality of the IoT as well as deal with the added safety and security concerns.
By embracing CI/CD embedded developers can keep embedded system development on track due to:
One of the greatest benefit of CI/CD is that it can improve development speed and quality simultaneously which leads to cost savings. Using CI/CD encourages teams to work together and solves conflicts when their code is merged early. It makes finding and tracking bugs much faster and solves them at the beginning of the process rather than letting them slip into later stages of the process where they are much more expensive to solve.
When we are concerned about safety, traceability is key. We need to know exactly what tests were run on what version of the code and who was responsible for that code. CI/CD provides that traceability in the form of logs that provide a step by step overview of how the project is evolving. Code and functional coverage are often used as safety targets and through CI/CD we can monitor the development of our devices to see how those goals are progressing.
Security is more of a concern than ever before. In the past IoT devices have been left unsecure with not even passwords to protect them. This is no longer an acceptable standard when it comes to the devices gathering data about our lives. CI/CD can include automated tasks for reviewing, auditing, scanning and testing for security issues.
The IoT is not only changing how we design embedded systems, but we are developing them as well. The connectivity of the IoT opens a wide range of possibilities for regular and fully automated builds and tests. However, there are fundamental differences between regular CI/CD used for deploying to web servers and CI/CD for the IoT. Building flows for the IoT is much more complex process because:
Before we look at how to solve the issues of using CI/CD for the IoT, let’s look at a standard CI/CD flow. Figure 1 shows a standard CI/CD flow for a web application. Code is taken from the version control system such as Git and placed on a staging server that performs the continuous integration. It will compile and test the code before packaging up for deployment. The package is then taken to the deployment servers to be run.
Figure 2 shows how we can modify that standard flow to meet the challenges of automating the IoT process:
Many organisations are concerned about adopting CI/CD because they believe that the effort needed to develop a great CI/CD for the IoT will outweigh the benefits. If we are not careful, maintaining and managing the CI/CD can become a serious burden. BeetleboxCI is a CI/CD designed specifically to solve the development issues of the IoT and is simple enough for the entire team to use. Our solution is tool, software and connection agnostic, so it can be used automate your existing workflows. No additional software is needed to be installed on devices.
Thanks to the advancement of CI/CD tools, building automated flows for IoT has become far easier. Whilst a traditional CI/CD setup would consist of building, testing and deploying across web servers, IoT requires both virtual platforms and hardware in the loop testing. Using these techniques, we can overcome the issues of requiring large amount of hardware, whilst still being able to test across the entire hardware stack. By adopting CI/CD, IoT developers can enjoy increased security and safety as well as a more efficient development process.