Gitlab fetch: start from empty or existing

Git fetch start from empty or existing ?

How do the runners store the repository data ? We have multiple runners configured for one project (repository). The gitlab CI/CD strategy is set to fetch. But sometimes I see the runner is “re-using” the existing clone and sometime it needs to start from an empty. The reusing is what I expect but many times I do see the initialized empty …

Fetching changes... Initialized empty Git repository in /builds/...

Fetching changes.. Reinitialized existing Git repository in /builds/...

  • How does gitlab runner decide if it needs a fresh clone or not ?
  • Where is the checked out date (BUILD_DIR) stored on the server ?
  • How does this mechanism works ?

Solved:

  • We are using docker executors for our runners, so the builddir is placed inside the container.
  • We had a script running which was cleaning the docker containers on regular base