How to use GitLab Runner on OpenShift / CRC

I have created an example project see on gitlab.com.

My pipeline runs most stages using shared runners provided by gitlab.com. I tried moving the stages of pipeline to my own local OpenShift / CRC instance. I installed Gitlab Runner on this clusters and the pipeline does successfully connect to my OpenShift instance and tries to run stages. They all fail with messages such as

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Then I reconfigured the pipeline to run all except Test stage on shared runners. The test stage is executed by the GitLab runner in my OpenShift / CRC instance.

When I try test stage

Test:  # fails with docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock
  stage: test
  only:
    - master
  tags:
    - crc
  script:
    - docker run --rm -v $(pwd)/test/:/test --ipc=host --user pwuser registry.gitlab.com/c2platform/docker/robot:latest bash -c "robot --outputdir /tmp/output /test"

This fails with message above about Docker daemon not running. Using a “shared” runner this test would run successfully.

Is it at all possible to run this pipeline on OpenShift / CRC? How? What kind of jobs can we delegate to OpenShift using GitLab runner? What are the limitations?

When I use open source Kubernetes, would it then be possible to run my pipeline the same as using a shared runner?

1 Like