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=
Build image docker
Inside the Dockerfile, we run the install-toolchains script and install Pluma to support integration tests.
Both operations require access to private GitLab/Bitbucket resources.
Credentials are passed via Docker build secrets (not build args)
so they are never baked into any image layer.
In the pipeline the secrets file is created automatically from CI variables.
To build the image locally, create the secrets file first:
bash
echo "CI_JOB_TOKEN=<gitlab-access-token>" > /tmp/klas-secrets
echo "CI_PROJECT_PATH=<klas-project-path>" >> /tmp/klas-secrets
echo "CI_SERVER_FQDN=gitlab.com" >> /tmp/klas-secrets
echo "CI_SERVER_PROTOCOL=https" >> /tmp/klas-secrets
echo "CI_DEBUG=true" >> /tmp/klas-secrets
Then build the image:
(You need to be at the root of the project to have the correct context.)
bash
DOCKER_BUILDKIT=1 docker build \
--secret id=secrets,src=/tmp/klas-secrets \
--build-arg CI_DEBUG=true \
-t local_image_store/klas-devtools \
-f dev-tools/Dockerfile .
Usage
gitlab-ci-local --variables-file .env --cwd .