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.
- Adding
--branch
,--no-tags
and--depth 1
arguments to everygit clone
call you make during a CI job. Here’s an example for GLib. - Adding
depth=1
to your Meson.wrap
files to achieve the same thing when (for example)meson subprojects download
is 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.
Useful info! The info at http://who-t.blogspot.com/2020/03/its-templates-all-way-down.html seems to be specific to gitlab.freedesktop.org, is there a way to use it on gitlab.gnome.org as well?
I’ve not actually tried; the CI image system put together for GLib predates it. I just remembered the blog post and thought it looked like a neater way of doing things. YMMV!
Thanks, this was a great idea. (It took me several months to actually get around to implementing it in GJS, but nonetheless it will show up soon.)