I am using gitlab-runner with Docker on my MacBook Pro. I'm using gitlab.com to host my git repositories. I have configured one repository to execute a pipeline whenever a commit has been pushed to the repo. The pipeline has two jobs: display some information, and clone a separate repository as a dependency.
Here is the output from the first job:
Running with gitlab-runner 12.2.0 (a987417a)
on old_gen_runner 6fsjs96e
Using Docker executor with image gcc-arm_4_7-2013q3:3.0 ...
Using docker image sha256:5d4741a428654beb44a3c004822e4d2ceededc88f22ec1ec7f45dedf707a0302 for gcc-arm_4_7-2013q3:3.0 ...
Running on runner-6fsjs96e-project-13664495-concurrent-0 via my_laptop.local...
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/staging-fw/my-project/.git/
Created fresh repository.
From https://gitlab.com/staging-fw/my-project
* [new branch] master -> origin/master
Checking out 722c2c38 as master...
Skipping Git submodules setup
$ python /scripts/info.py
Printing job info...
Builds dir: /builds
Commit Message:
Modified yml file.
Branch: master
Project dir: /builds/staging-fw/my-project
$ ls /builds
my-project
Here is the output from the second job:
Running with gitlab-runner 12.2.0 (a987417a)
on old_gen_runner 6fsjs96e
Using Docker executor with image gcc-arm_4_7-2013q3:3.0 ...
Using docker image sha256:5d4741a428654beb44a3c004822e4d2ceededc88f22ec1ec7f45dedf707a0302 for gcc-arm_4_7-2013q3:3.0 ...
Running on runner-6fsjs96e-project-13664495-concurrent-0 via my_laptop.local...
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/staging-fw/my-project/.git/
Checking out 722c2c38 as master...
Skipping Git submodules setup
$ git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/staging-fw/my-dependencies.git /builds/dependencies
Cloning into '/builds/dependencies'...
Job succeeded
As you can see, the first time the pipeline is created, it is successful.
If I run it again by pushing new changes, here is the output from the first job:
Running with gitlab-runner 12.2.0 (a987417a)
on old_gen_runner 6fsjs96e
Using Docker executor with image gcc-arm_4_7-2013q3:3.0 ...
Using docker image sha256:5d4741a428654beb44a3c004822e4d2ceededc88f22ec1ec7f45dedf707a0302 for gcc-arm_4_7-2013q3:3.0 ...
Running on runner-6fsjs96e-project-13664495-concurrent-0 via my_laptop.local...
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/staging-fw/my-project/.git/
From https://gitlab.com/staging-fw/my-project
722c2c3..f321b75 master -> origin/master
Checking out f321b75f as master...
Skipping Git submodules setup
$ python /scripts/info.py
Printing job info...
Builds dir: /builds
Commit Message:
Modified yml file.
Branch: master
Project dir: /builds/staging-fw/my-project
$ ls /builds
my-project
dependencies
Job succeeded
As you can see, the dependencies folder is still there? Not only that, but instead of saying Initialized empty Git repository
as it did in the first run of the first job, it now says Reinitialized existing Git repository
.
Here is what happens on the second job during the second run:
Running with gitlab-runner 12.2.0 (a987417a)
on old_gen_runner 6fsjs96e
Using Docker executor with image gcc-arm_4_7-2013q3:3.0 ...
Using docker image sha256:5d4741a428654beb44a3c004822e4d2ceededc88f22ec1ec7f45dedf707a0302 for gcc-arm_4_7-2013q3:3.0 ...
Running on runner-6fsjs96e-project-13664495-concurrent-0 via my_laptop.local...
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/staging-fw/my-project/.git/
Checking out f321b75f as master...
Skipping Git submodules setup
$ git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/staging-fw/my-dependencies.git /builds/dependencies
fatal: destination path '/builds/dependencies' already exists and is not an empty directory.
ERROR: Job failed: exit code 1
My questions are:
Is the
/builds
directory created for each individual container in Docker? This was my original understanding, that each container within Docker would have its own separate /builds directory.Is the
/builds
directory shared for all Docker containers? I cannot find any information on this.
2a. If the /builds
directory is shared for all Docker containers, then where is it and who created it?