gitlab: Enable improved ccache usage
gitlab: Enable improved ccache usage

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-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
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 <3ada0bee826c753786fdbba72243dfba997094cf@redhat.com>
Reviewed-by: Daniel P. Berrangé <bb938cf255e055ff3507f2627d214e8e62118fcf@redhat.com>

fabianfreyer/libvirt,nertpinx/libvirt,libvirt/libvirt,fabianfreyer/libvirt,crobinso/libvirt,libvirt/libvirt,zippy2/libvirt,jfehlig/libvirt,nertpinx/libvirt,jfehlig/libvirt,jfehlig/libvirt,fabianfreyer/libvirt,libvirt/libvirt,libvirt/libvirt,nertpinx/libvirt,zippy2/libvirt,jardasgit/libvirt,nertpinx/libvirt,zippy2/libvirt,nertpinx/libvirt,olafhering/libvirt,olafhering/libvirt,crobinso/libvirt,jardasgit/libvirt,crobinso/libvirt,olafhering/libvirt,jardasgit/libvirt,crobinso/libvirt,fabianfreyer/libvirt,jardasgit/libvirt,olafhering/libvirt,fabianfreyer/libvirt,jfehlig/libvirt,zippy2/libvirt,jardasgit/libvirt