gitlab-ci-local: Source files missing from service container

Is your feature request related to a problem? Please describe. According to the docs, GitLab runners mount the $CI_PROJECT_DIR (/builds/group-name/project-name/) to both job containers and service containers. This allows docker-in-docker jobs like browser_performance to share files between the job container and the dind service container. It seems that gitlab-ci-local does not mount the build directory to service containers, which leads to the issue described in this older gitlab issue.

Describe the solution you’d like Mount the same build volume that is generated for each job (gcl-job_name-xxxxxx-build) in all service containers

Describe alternatives you’ve considered Might be able to use the --volume argument to mount something in .gitlab-ci-local/builds to be shared by both job and service containers?

Additional context Example of the browser_performance job failing:

---
include:
  - template: Verify/Browser-Performance.gitlab-ci.yml

browser_performance:
  variables:
    URL: https://example.com

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 29 (19 by maintainers)

Most upvoted comments

Just to double check, I created a test repo to verify.

Here is the job with gitlab-ci-local:

$ gitlab-ci-local 
parsing and downloads finished in 42 ms
dind_service starting docker:stable (test)
dind_service started service image: docker:stable-dind with aliases: docker in 1.24 s
dind_service service image: docker:stable-dind healthcheck passed in 2.32 s
dind_service copied to container in 140 ms
dind_service $ printenv CI_PROJECT_DIR
dind_service > /gcl-builds
dind_service $ pwd
dind_service > /gcl-builds
dind_service $ touch newfile
dind_service $ echo "Project files and 'newfile' on the job container:"
dind_service > Project files and 'newfile' on the job container:
dind_service $ ls -a
dind_service > .
dind_service > ..
dind_service > .git
dind_service > README.md
dind_service > newfile
dind_service $ echo "Project files and 'newfile' on the service container:"
dind_service > Project files and 'newfile' on the service container:
dind_service $ docker run --rm -v $(pwd):/work --workdir /work alpine ls -a
dind_service > Unable to find image 'alpine:latest' locally
dind_service > latest: Pulling from library/alpine
dind_service > 213ec9aee27d: Pulling fs layer
dind_service > 213ec9aee27d: Verifying Checksum
dind_service > 213ec9aee27d: Download complete
dind_service > 213ec9aee27d: Pull complete
dind_service > Digest: sha256:bc41182d7ef5ffc53a40b044e725193bc10142a1243f395ee852a8d9730fc2ad
dind_service > Status: Downloaded newer image for alpine:latest
dind_service > .
dind_service > ..
dind_service finished in 11 s

 PASS  dind_service
pipeline finished in 11 s

And here is the gitlab pipeline: https://gitlab.com/hseitz/dind-service-example/-/jobs/3164209642

I don’t have private DIND Gitlab runners, so I haven’t confirmed myself that the build directory is shared. But at the bottom of this section is reads:

The service container is not providing any networking service, but it’s doing something with the job’s directory (all services have the job directory mounted as a volume under /builds). In that case, the service does its job, and because the job is not trying to connect to it, it does not fail.