CI/CD Examples
CI/CD Examples
GitHub Self-Hosted Runner
To integrate the Cuica into a cloud-based GitHub CI/CD pipeline, a self-hosted runner must be instantiated on an on-premises server with network access to both GitHub and the Cuica. For this example, Docker Compose is used to instantiate the runner.
All placeholder values are enclosed below with <>
.
Prerequisites are:
- Both
docker
and thecompose
plugin are installed on the on-premises machine - A GitHub repository has been created and the actions configured to use a self-hosted runner
- A token has been generated for the Cuica and the token registered as a GitHub secret
- The Cuica hostname has been registered as a GitHub secret
- The GitHub runner token is stored in a secret file located in
.secrets/runner_token
- An actual device-under-test (DUT) is connected electrically to the Cuica via either the Squeak Board or the 20-pin directly
- The deployment configuration is set on the Cuica
The following files illustrate how Docker Compose can be used to run the runner service on the on-premises machine.
In this example Dockerfile, the build environment for an RP2040 application
is installed, the cuica
CLI application installed, a custom Root CA
installed, and the GitHub runner installed.
To build and run the service, Docker Compose is used. This compose file mounts the GitHub runner token secret to provide the container access, enhances security, and mounts volumes for the build workspace
This entrypoint.sh
is what starts the GitHub runner. It uses
the named mount in the docker-compose.yml file to persist the
runner configuration between service runs. Otherwise, GitHub will
generate a new token each time because the runner appears as a new instance.
Finally, once the GitHub runner is running, this GitHub build script builds the embedded software, bundles up the Binary Image with a Test Script into a Test Suite, runs the Test Suite, and lastly archives the test results.
Jenkins Agent
To integrate the Cuica into an on-premises Jenkins CI/CD pipeline, a Jenkins agent must be running on a server with network access to both Jenkins and the Cuica.
Prerequisites are:
- The Jenkins Docker plugin has been installed and the Jenkins agent configured
- The
<CUICA_API_TOKEN_CREDENTIALS_ID>
has been registered as a secret with Jenkins - The code to build this example exists in
<REGISTRY_URL>
- A build environment docker image containing both the toolchain and
cuica
CLI application has been pushed to the<REGISTRY_URL>
docker registry (see Dockerfile for example) - An actual DUT is connected electrically to the Cuica via either the Squeak Board or the 20-pin directly
- The deployment configuration is set on the Cuica
The following Jenkinsfile illustrates how a build and testing of a bundle against a target DUT would be done.
The following Dockerfile is essentially the same as the GitHub sans the
installation of the runner. It simply provides the toolchain for building
the Binary Image and installs the cuica
CLI Application.