Setting up Jenkins for Embedded the right way (or not at all)

Jenkins CI

Embracing continuous integration (CI) practices and tools makes embedded development smoother. Jenkins isn’t always the best choice for Embedded CI, but if you follow the 3 CI principles laid out in this article, you’ll start off well!

Continuous Integration. Improves your embedded life.

Is your embedded product releasable right now? How long would it take for all the software changes to be merged, release candidate (RC) binaries to be created, and the RC to be tested?

Continuous Integration is a practice that challenges you to keep your product releasable continuously. To achieve this lofty goal, you need:

  1. code merged across the team frequently (think daily!)
  2. rapid, automated feedback from your automated build, test, and release steps

In web development, this can be as extreme as teams that practice trunk-based development and continuous deployment (passing CI causes at least a partial rollout of the changes directly to production). Your embedded environment will have unique challenges vs. web (execution environment controlled by end-users, testing challenges, history of manual testing, tooling support). Still, the concepts of CI are being adopted by modern embedded teams. Embedded CI practices and tools provide improvements in feedback that lead to less stressful software development.

Book a Call with Dojo Five Embedded Experts

CI tool principles

While the practices of CI are critical, many people immediately jump to Jenkins when they think CI. Jenkins is “The leading open source automation server“, but before I try to convince you to not use Jenkins, let’s review why you want an “automation server” (called CI server from now on).

You want feedback from your build and tests when you check in code changes. A CI server is a web application that integrates with your version control (typically git) tool. The CI server detects the code changes, runs your automated processes on connected computers, notifies you of the results, and provides you logs and saved artifacts.

Principle: CI servers are commodities

Jenkins is one of many available CI servers that fulfill all or at least most of the functions described above. In addition, with the intentional design of your automated processes, you will be able to move between CI servers with low risk and low effort – more on this later.

Principle: Automated scripts should be runnable locally and on your CI server

Nothing is more frustrating than your CI build failing and either not being able to replicate it locally or, even worse, not being able to execute it locally. The exception to this principle is for things like creating release packages that are signed or uploaded to protected areas – you still want to be able to exercise this code locally, but without all the keys 😉

Principle: Leverage off-the-shelf tooling for your automation system

Embedded does not require innovation from your chosen CI server. Embedded developers typically do not enjoy the challenge of operating delivery critical web applications – installation, updates, security, etc. Engineering management even less likes the idea of embedded developers operating a delivery critical web application. On your CI journey, embedded developers’ skills can be leveraged much better by developing solid build scripts, or unit tests.

Don’t use Jenkins

Ok, so I’ve jabbed some at Jenkins already and provided 3 CI tool principles. Let’s dig into some more detail on Jenkins.

Jenkins, the good

Jenkins is fast and free to set up for piloting on your local computer. You can run both the web application and the build-runner on your local computer (although you shouldn’t: “Builds should not be executed on the built-in node“). Since you’re running everything on your computer, your IT person or department might not care or at least notice the web server you’ve set up.

Jenkins, the bad (or what’s a better choice)

Operating an up-to-date (Jenkins application & plugins), backed up, and secure Jenkins server requires time and expertise that a typical embedded developer doesn’t have. However, SaaS alternatives like Github, Bitbucket, and Gitlab all provide best-in-class CI capabilities at a reasonable per-developer cost.

Additionally, these SaaS services are evolving and competing by providing “batteries included” features like version control hosting (git), issue management, container-based build execution capacity, code review workflows, etc.

If you insist on Jenkins

If you still choose to start your Embedded CI journey with Jenkins here are 3 tips that will minimize the pain (and set you up to migrate later ;-))

Keep your CI pipelines simple and in source control.

Your CI pipeline defines the scripts to run when you make code changes. Jenkins has many options on how to set this up, but just use a Jenkinsfile stored alongside your code in version control (see Using a Jenkinsfile). Keeping the pipeline file in version control gives visibility locally to what will run on the CI system.

Also, keep that Jenkinsfile simple! Any logic or processing you need to do should be outside the Jenkinsfile in a platform-independent script (python, makefile, etc.).

Do not use plugins.

Jenkins plugins seem great – there’s one for anything you want, so you install anything that sounds interesting and turn it on for your project. Unfortunately, the next time you upgrade Jenkins and/or the plugins (you’re doing that at least monthly for security updates, right?), at least one plugin will likely have a breaking config change or is deprecated/orphaned.

Also, the more valuable the plugin is, the more you violate the principle of builds providing the same feedback in both CI and local environments.

Minimize the manual setup of your build runner.

While SaaS CI servers use containerized environments for job execution, Jenkins allows you to build directly on your local computer. This is a speedup, but your build environment is not fully managed and defined.

Do not set up Jenkins on your personal development computer. Instead, start with a new computer and completely automate or document everything you need to have installed or configured (environment variables) to for your build. This process will also help your new developer setup time and repeatability.

As you consider automation related to build dependencies, keep in mind how you can leverage container-based builds in the future.

Final Thoughts

Improving your development flow with Continuous Integration practices and tools is a journey that can be incrementally advanced. While Jenkins is a helpful tool, consider SaaS alternatives and use the CI principles when choosing your next move.

Dojo Five brings modern tools, techniques, and best practices from the web and mobile development environments, paired with leading-edge innovations in firmware to our customers to help them build successful products and successful clients.
We have talented engineers on hand ready to help you with all aspects of your EmbedOps journey. You can Book a Call with us to discuss your embedded project, or sign up for free for our EmbedOps CI and build management product.

Sign up to get our content updates!

Unlock the full potential of your embedded projects with our expert insights! Dive into our comprehensive resources to stay ahead in firmware development. Subscribe now to get the latest best practices and guides delivered straight to your inbox.

Sign Up for Updates

Discover why Dojo Five EmbedOps is the embedded enterprise choice for build tool and test management.

Sign up to receive a free account to the EmbedOps platform and start building with confidence..

  • Connect a repo
  • Use Dev Containers with your Continuous Integration (CI) provider
  • Analyze memory usage
  • Integrate and visualize static analysis results
  • Perform Hardware-in-the-Loop (HIL) tests
  • Install the Command Line Interface for a developer-friendly experience

Subscribe to our Monthly Newsletter

Subscribe to our monthly newsletter for development insights delivered straight to your inbox.

Interested in learning more?

Best-in-class embedded firmware content, resources and best practices

Laptop with some code on screen

I want to write my first embedded program. Where do I start?

The boom in the Internet of Things (IoT) commercial devices and hobbyist platforms like the Raspberry Pi and Arduino have created a lot of options, offering inexpensive platforms with easy to use development tools for creating embedded projects. You have a lot of options to choose from. An embedded development platform is typically a microcontroller chip mounted on a circuit board designed to show off its features. There are typically two types out there: there are inexpensive versions, sometimes called

Read More »
Medical device monitoring vitals

IEC-62304 Medical Device Software – Software Life Cycle Processes Primer – Part 1

IEC-62304 Software Lifecycle requires a lot of self-reflection to scrutinize and document your development processes. There is an endless pursuit of perfection when it comes to heavily regulated industries. How can you guarantee something will have zero defects? That’s a pretty hefty task. The regulatory approach for the medical device industry is process control. The concept essentially states that if you document how every step must be completed, and provide checks to show every step has been completed properly, you

Read More »
Operating room filled with medical devices

IEC-62304 Medical Device Software – Software Life Cycle Processes Primer – Part II

Part I provides some background to IEC-62304. Part II provides a slightly more in-depth look at some of the specifics. The IEC 62304 Medical Device Software – Software Lifecycle Processes looks into your development processes for creating and maintaining your software. The standard is available for purchase here. So what activities does the standard look at? Here are some of the major topics. For any given topic, there will be a lot more specifics. This will look at a few

Read More »