Skip to content

CI/CD

Remote run

We are using the same gitlab runner as Kamea Project.

Local run

If there are changes in the pipelines, or you want to verify that there is no error in the pipelines, so as not to overload the runner, you can install a utility to run the pipeline locally.

Installation

```

Install docker

Add docker repository

echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update

Install docker tools

sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Verify that the installation is successful by running the hello-world image

sudo docker run hello-world

Create docker group

sudo groupadd docker

Add your user to the docker group

sudo usermod -aG docker $USER

Activate changes to groups

newgrp docker

Install gitlab-ci-local

sudo apt install gitlab-ci-local

Variables

touch .env

Copy this into .env

CI_REGISTRY_IMAGE=local_image_store CI_LOCAL_RUNNER=true CI_JOB_TOKEN= SONAR_URL=https://sonarcloud.io SONAR_TOKEN= SONAR_ORG=adeneo-embedded SONAR_PROJECT=b0000-witekio-klas ```

Build image docker

Inside the Dockerfile, we run the install-toolchains script to install the SDKs inside the image for cross-compiling the project.
This script requires an ACCESS TOKEN to download the SDK installers from the GitLab package repository.

Inside the pipeline, the CI_JOB_TOKEN is automatically injected.
But if you want to build the Docker image locally, you can use this command line:

(You need to be at the root of the project to have the correct context.)

docker build --build-arg CI_JOB_TOKEN=<your-access-token-here> --build-arg CI_DEBUG=true -t local_image_store/klas-devtools -f dev-tools/Dockerfile .

Usage

gitlab-ci-local --variables-file .env --cwd .