-
Notifications
You must be signed in to change notification settings - Fork 3
Creating a BXARM Docker image for Jenkins
Felipe Torrezan edited this page Aug 25, 2021
·
5 revisions
⚠️ This wiki entry is obsolete since Release v2021.08 and it only exists here for historical reference.
In order to use a BXARM Docker Image based on the bxarm-docker Dockerfile with Jenkins, a image enabling the jenkins
user should be created.
- Make sure that the
jenkins
user belong to thedocker
group so it can run the Docker containers
sudo usermod -aG docker jenkins
⚠️ You might need to restart Jenkins and Docker.
- When building the image from your standard
$USER
account, use the followingdocker build
command to build theiarsystems/bxarm-8.50.6-jenkins
image:
docker build --build-arg USER_ID=$(id -u jenkins) -t iarsystems/bxarm-8.50.6-jenkins --rm=true --force-rm=true ./bxarm-docker/images
⚠️ This will create a bxarm-docker image the same way it was created for the standard user, but with all the necessary permissions set for the jenkins user to execute the build tools from the containers.
- On the Jenkins Task, go to
Build
→Execute shell
and replace the previous with the following Command:
#!/bin/bash
# Copyright (c) 2020 IAR Systems AB
# See LICENSE for detailed license information
#
# Description:
# Jenkins Shell example for building embedded software
# with the IAR Build Tools from a Docker container
set -e
# This is an internal Jenkins variable.
# We will use it as replacement for the $USER variable
echo "Workspace: $WORKSPACE"
# Set Environment variables for the jenkins user
export BXARM_DOCKER_JENKINS_IMG=iarsystems/bxarm-8.50.6-jenkins
export IAR_LMS_SETTINGS_DIR="/tmp/.lms"
# If there is no License configuration on the Host
# Create the License configuration directory and
# Request a new License to the IAR License Server
if [ ! -d "/tmp/.lms" ]; then
mkdir -p "/tmp/.lms"
docker run --rm -v "$IAR_LMS_SETTINGS_DIR:/.lms" $BXARM_DOCKER_JENKINS_IMG lightlicensemanager setup -s <IAR.License.Server.IP>
fi
# Build every project from the cloned repository
# Using the containerized IAR Build Tools
for i in $(find . -type f -name *.ewp); do
docker run --rm -v "$WORKSPACE:/build" -v "$IAR_LMS_SETTINGS_DIR:/.lms" $BXARM_DOCKER_JENKINS_IMG iarbuild $i -build "*" -log all -parallel 4
if [[ $? -ne 0 ]]; then
exit $?
fi
done
⚠️ As the usual, replace theIAR.License.Server.IP
with the appropriate address.