On Mon, Mar 30, 2020 at 07:31:03PM +0200, Andrea Bolognani wrote:
Setting CC="ccache cc" works in most cases, but sometimes
it will
break the build: in particular, we have experienced issues in the
past with that approach when using cgo to build our Go bindings.
A more robust approach is to have a directory containing symlinks
from the compiler name to the ccache binary: in that case, ccache
itself will invoke the compiler, and the build system will be none
the wiser.
Since libvirt-jenkins-ci commit 2563aebb6c5c, container images
contain a suitable symlink directory, so all that's needed to
enable the new approach is to add this directory to $PATH.
Since we're touching this anyway, we make a few more changes:
$CCACHE_DIR is no longer created manually, because ccache will
take care of creating it for us if it doesn't already exist; the
I could have sworn I had a build failure when I didn't have the
mkdir present when originally doing this recipe. It might have
been from gitlab itself, rather than ccache, eg when unpacking
the cache archive to the non-existant dir. But assuming the
CI pipeline works for you...
ccache setup is moved out of the job template and into
script_variables, removing unnecessary duplication; a limit is
set on the size of the cache (500 MB, which is twice the amount
used by a fresh build on my Fedora 31 machine).
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
.gitlab-ci.yml | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange(a)redhat.com>
Regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|