This repository demonstrates a continuous integration (CI) workflow using IAR Build Tools, Jenkins and Gitea, all running in Docker containers. The IAR Build Tools provide command-line utilities for building and analyzing projects created with IAR Embedded Workbench in headless environments like Jenkins. Gitea is a lightweight Git server suitable for containerized deployments, while Jenkins integrates seamlessly with Git providers via plugins.
This tutorial guides you through setting up these tools in separate containers for on-premises building and analysis of embedded projects. You can customize this setup to fit your organization's requirements. Here is a visual overview:
Why this setup? Amongst the reasons for adopting it, it is worth mentioning:
- Zero manual configuration: Jenkins is pre-configured via Configuration as Code (JCasC).
- Fully containerized: No host pollution, easy to versionate and scale.
- Webhooks-triggered builds: Push to Gitea, get instant Jenkins pipeline execution.
- Dynamic Build Agents: Docker agents spawn on-demand using official IAR tool images.
- Rich feedback: integrated C-STAT analysis, warnings and pull request checks.
The information in this repository is provided as-is and may change without notice. It does not represent a commitment by IAR Systems. While useful as a reference for DevOps engineers implementing CI with IAR tools, IAR assumes no responsibility for errors, omissions, or specific implementations.
This tutorial uses public container images with the latest IAR Build Tools (CX generation) and its Cloud License Service. For the earlier BX generation, build custom Docker images following the bx-docker guide.
You'll need:
- A web browser on a Windows PC with administrative privileges.
- The PC must access the Linux server running Docker.
- Docker Engine installed on a supported x86_64/amd64 Linux environment (e.g., Ubuntu).
Install Docker if not already present:
# Update package index and install cURL
sudo apt update && sudo apt install -y curl
# Download and run the official Docker install script
curl -fsSL https://get.docker.com -o get-docker.sh
sh ./get-docker.sh
# Add current $USER to docker group
sudo usermod -aG docker $USER
# Re-login to apply group changes
sudo -ui $USERWait for 20 seconds if you are installing the Docker Engine in WSL. For further details, refer to the Docker installation guide.
Create a Docker network named jenkins for container communication:
docker network create jenkinsAll containers in this tutorial use --network jenkins and --network-alias <name> for visibility and reachability.
On your Windows PC, edit %WINDIR%\system32\drivers\etc\hosts as administrator. Add this line, replacing 192.168.1.2 with your Linux server's IP:
192.168.1.2 gitea jenkins
This allows accessing services via aliases (e.g., http://gitea:3000).
Run the Gitea container:
docker run \
--name gitea \
--network jenkins \
--network-alias gitea \
--detach \
--restart=unless-stopped \
--volume gitea-data:/data \
--volume /etc/timezone:/etc/timezone:ro \
--volume /etc/localtime:/etc/localtime:ro \
--publish 3000:3000 \
--publish 2222:2222 \
gitea/gitea:1.24Access http://gitea:3000 in your browser for initial setup:
- Under "Administrator Account Settings":
- Administrator Username:
jenkins - Email Address:
jenkins@localhost - Password:
jenkins - Confirm Password:
jenkins
- Administrator Username:
- Click "Install Gitea".
Webhooks trigger Jenkins builds on events like code pushes. Update Gitea's configuration to accept webhooks from Jenkins:
docker exec gitea bash -c "echo -e '\n[webhook]\nALLOWED_HOST_LIST=jenkins\nDISABLE_WEBHOOKS=false' >> /data/gitea/conf/app.ini"
docker restart giteaThese changes persist in the gitea-data volume.
For this tutorial, use a sample repository with a Jenkinsfile for pipeline execution. On Gitea's dashboard (top-right corner):
- Click
+→ New Migration. - Select Git as the migration type.
- Enter a repository URL (e.g., a public example repo with a Jenkinsfile). Some examples you can readily use are:
- https://github.com/iarsystems/ewp-workspaces-ci (uses
iarbuild) - https://github.com/iarsystems/riscv-board-examples (uses
cmake)
- https://github.com/iarsystems/ewp-workspaces-ci (uses
- Fill in details and migrate.
Alternatively, create a new repository and push a sample project with a appropriate Jenkinsfile-cx or Jenkinsfile-bx.
This setup uses a custom Dockerfile for automated configuration:
- Base:
jenkins/jenkins:lts-slim(Long-Term Support). - Plugins: Installed via
jenkins-plugin-clifor compatibility. - Configuration: Handled as code (JCasC) for reproducibility.
Clone this repository on the Linux server:
git clone https://github.com/iarsystems/cx-jenkins-ci.git ~/cx-jenkins-ciReview and edit configurations in ~/cx-jenkins-ci if needed. Build the image:
docker build \
--tag jenkins:jcasc \
--build-arg DOCKER_GROUP=$(getent group docker | cut -d: -f3) \
~/cx-jenkins-ciTip
If plugin compatibility issues arise, pin versions in plugins.txt (e.g., <plugin>:specific-version).
Set IAR_LMS_BEARER_TOKEN in your shell or .env and the Jenkins container:
docker run --name jenkins \
--network jenkins \
--network-alias jenkins \
--detach \
--restart unless-stopped \
--privileged \
--publish 8080:8080 \
--publish 50000:50000 \
--volume jenkins-data:/var/jenkins_home \
--volume /var/run/docker.sock:/var/run/docker.sock \
--env IAR_LMS_BEARER_TOKEN=${IAR_LMS_BEARER_TOKEN} \
jenkins:jcascAccess Jenkins at http://jenkins:8080 (default credentials: admin/admin).
- Click New Item.
- Name it (e.g.,
Organization). - Select Organization Folder →
OK.
In configuration:
- Projects → Repository Sources → Add → Gitea Organization.
- Credentials: Select "Jenkins Token".
- Owner:
jenkins(or your Gitea username). - Project Recognizers: Change to
Jenkinsfile-cx(orJenkinsfile-bx). Save.
Jenkins scans Gitea repositories using the multi-branch plugin. When it finds a matching Jenkinsfile, it executes the pipeline.
The pipeline uses a Docker agent to spawn a container (e.g., ghcr.io/iarsystems/<architecture>:<version>-<variant>) for builds:
pipeline {
agent {
docker {
image 'ghcr.io/iarsystems/arm:9.70.1-st'
args '-e VAR=VALUE'
}
}
stages {
stage('Build & Analyze') {
steps {
sh 'iarbuild MyProject.ewp -build Release -parallel 4 -log all'
sh 'iarbuild MyProject.ewp -cstat_analyze Release -parallel 4 -log all'
}
}
}
post {
always {
sh 'icstat --db Release/C-STAT/cstat.db load
recordIssues enabledForFailure: true, tools: [iar(), iarCstat()]
}
}
}Gitea webhooks notify Jenkins of changes, triggering automated builds.
In simple terms, develop in IAR Embedded Workbench, commit to Gitea while blocking bad PRs with failing checks, and get clean builds with instant compiler and MISRA/CERT feedback, using safe, reproducible, and version-controlled configuration in Jenkins.
This containerized setup is quick to deploy and reproducible. It leverages Jenkins Configuration as Code (JCasC) for YAML-based setup, ideal for validation and scaling.
Customize using the provided scripts, Dockerfile, and Jenkins documentation. Follow us on GitHub for updates.
For technical support, contact IAR Customer Support. Questions or suggestions? Check the Wiki or open an issue.
(c) 2020-2025 IAR Systems AB. This example is provided as-is for reference. Customize to fit your environment.



