Towards Production Ready CI/CD of Cloud Robotics

What is CI/CD?

As per Red Hat, “CI/CD is a method to frequently deliver apps to customers by introducing automation into the stages of app development. The main concepts attributed to CI/CD are continuous integration, continuous delivery, and continuous deployment. CI/CD is a solution to the problems integrating new code can cause for the development and operations teams.”

Situation of CI/CD in robotics

Deploying your code in continuous fashion is hard in non-robotics applications as such, and with robotics comes the hard part of testing with different parameters, setting up simulation environments, and deploying this code on real robots. 

In this post, we will demonstrate how you can integrate rapyuta.io to help build, run simulations and deploy these applications on real robots reliably.

What is rapyuta.io?

rapyuta.io is a Platform-as-a-Service providing managed cloud services that solve technical and production challenges of building, provisioning, running, and iterating on distributed robotic applications.

Introduction to rapyuta.io Build

The rapyuta.io platform takes the responsibility of building and delivering the software across the cloud and device.

Under the hood, rapyuta.io solves the hard problems of native arm compiles, software versioning, artifact delivery, transactional upgrades and provisioning.

We convert your code into docker images, based on two types of recipes we provide:

  1. Catkin
    1. This recipe allows a user to build ROS based source code using catkin into a container image. We allow our users to add any valid catkin parameters in this recipe.
  2. Docker
    1. This recipe builds source code using Dockerfile into a container image. The Dockerfile is usually saved in your git repository.

We use builds in defining your application in terms of package, which you can deploy on cloud or device depending on runtime.

You can use triggers and rollbacks on build, to deploy latest code in real environment or rollback to previous software code if something goes wrong in new code.

Integrating rapyuta.io to achieve a step towards CI/CD

Let’s first define our git branching model. The source code repository should hold two main branches with  infinite lifetime

  1. Master
    1. The source code at HEAD should always contain production/production ready code. 
  2. Develop
    1. The source code at HEAD should contain code for the features of the next release. Every time changes are merged back into origin/master, this is a new production release by definition

Each feature should be made from develop, a separate branch and merged to develop.

Once we have our branching model ready, let’s define a similar setup on rapyuta.io

Let’s create two projects

  1. Ros-prod
  2. Ros-devel

In each project, we can make build resource on rapyuta.io platform

Here, you can mention about details of your repository, like URL of the repository, build recipe, architecture, catkin parameters, branch name etc Once we have all this information, we will build this repository into a docker image which can be later used at the time of deployment in real robot or in simulation.

We encourage people to keep their ROS code separate from parameters, which allows them to be changed without changing the code/build. You can use configuration parameters on rapyuta.io to achieve this.

We also encourage you to keep launch files of simulation and rest of your application separately and not tightly coupled, please go through our documentation for more information on this.

We can choose any of the existing tools like Travis CI or Jenkins to define our pipeline, where we run unit tests first, and then choose rapyuta.io SDK to trigger a new build and deploy either simulation application or production application depending on if a new commit is logged in develop or prod.

Both projects should have similar package builds, which we will use to integrate in our pipeline.

Whenever a new commit is pushed

  1. Develop
    1. Run unit tests in pipeline
    2. Will operate on Ros-devel project in rapyuta.io
      1. Use SDK to trigger a new build
      2. This project will have configuration to deploy in simulation
      3. Deploy
      4. Your QA team should do basic testing in gazebo, and verify if all tests passed using logs
      5. Once the basic testing is done, you can merge this code to master.
  2. Master
    1. Run unit tests in pipeline
    2. Will operate on Ros-master project in rapyuta.io
      1. Use SDK to trigger a new build
      2. This project will have configuration to deploy your code in real world
      3. Deploy on real devices

<<<<Sample code using sdk to build, and deploy>>>>>

from rapyuta_io import Client

client = Client(auth_token=’auth_token’, project=’project_guid_of_ros_devel’)

build = client.get_build(‘build_guid_of_ros_devel’)

build.trigger()

build.poll_build_till_ready()

package = client.get_package(‘test_package_id’)

package_provision_config = package.get_provision_configuration(‘test_plan_id’)

package.provision(deployment_name, package_provision_config)

This short post gives you an introduction on how we can use rapyuta.io in building, deploying code in simulation and in real robots by integrating in your existing or new CI pipelines. 

We are working on features which will help you collect ROSbags in simulation deployment, which you can later replay locally to reproduce bugs/scenarios. In future, we will share more information for continuous delivery to these real robots.

Write to us at support@rapyuta-robotics for any queries, feedback or suggestions.

Enquire now

Give us a call or fill in the form below and we will contact you. We endeavor to answer all inquiries within 24 hours on business days.