I have a two-stage CI flow which will build code automatically and run the unit test.
The first stage works well but I got an error in stage two.
Any hint for this?
Suppose the container remains exist in the second stage, and it can access cloned branch and built files there.
gitlab-ci.yml:
stages:
- build
- test
build-code:
stage: build
tags:
- docker
script:
- echo "Current working directory:"
- pwd
- cd cpp
- mkdir -p build
- cd build
- cmake ..
- make -j12
cache:
paths:
- cpp/build
run-unittest:
stage: test
tags:
- docker
script:
- git clone https://github.com/google/googletest/
- cd googletest
- mkdir build
- cd build
- cmake ..
- make -j12
- sudo make install
- ls
docker-compose:
version: '3'
services:
gitlab-runner:
image: gitlab/gitlab-runner:latest
container_name: gitlab-runner
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /etc/gitlab-runner/config.toml:/etc/gitlab-runner/config.toml
According to this post:
Just add this line manually in the config.toml
helper_image = "registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-bd40e3da"