Every time a CI pipeline runs on GitLab, it downloads the git repository for your project. Often, pipeline jobs are set up to make further downloads (of dependencies or subprojects), which are also run on each job.
Assuming that you’ve built a Docker image containing all your dependencies, to minimise how often they’re re-downloaded (you really should do this, it speeds up CI a lot), you can make further improvements by:
- Limiting the clone depth of your repository in the GitLab settings: Settings ? CI/CD, and change it to use a ‘git shallow clone’ of depth 1.
--depth 1arguments to every
git clonecall you make during a CI job. Here’s an example for GLib.
depth=1to your Meson
.wrapfiles to achieve the same thing when (for example)
meson subprojects downloadis called. See the same example merge request.
For GLib, the difference between
git clone https://gitlab.gnome.org/GNOME/glib.git and
git clone --depth 1 https://gitlab.gnome.org/GNOME/glib.git is 66MB (reducing from 74MB to 8MB), or a factor of 10. It won’t be as much for younger or smaller projects, but still worthwhile.