Message ID | 20210414081907.871437-6-thuth@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Use ccache in the gitlab-CI | expand |
On 4/14/21 10:19 AM, Thomas Huth wrote: > Ccache can speed up the compilation in some cases, so enable it for > our cross-compilation CI builds, too. > > Signed-off-by: Thomas Huth <thuth@redhat.com> > --- > .gitlab-ci.d/crossbuilds.yml | 28 ++++++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) > > diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml > index 017731a894..dee327a936 100644 > --- a/.gitlab-ci.d/crossbuilds.yml > +++ b/.gitlab-ci.d/crossbuilds.yml > @@ -1,4 +1,26 @@ > + > +.ccache_cross_setup: > + cache: > + key: "$CI_JOB_NAME" > + paths: > + - ccache I discovered last month the cache/artifact passing feature is useful when all runners are in the same premises, but when you used runner in different locations it become slower (except if all your runners are in very fast clouds probably). Not a short term problem, but can hit us long term. I haven't looked if GitLab already figured how to manage this globally, like registering runners with affinity, or assigning them to pools. If we decide to stick with the free-tier runners, then this is a great improvement. For custom runners, a simple kludge is to assert they do *not* use cache/artifacts (from free-tier runners). We could restrict this to free-tier runners but these runners tag aren't standardized, and AFAIK we can not (yet?) use the "ANY" word to "select runners with any of this tag list". So far I noticed gitlab uses these: - shared docker - gce docker - gitlab-org - gitlab-org-docker The last 2 are recent, and seem to help with the problem I reported that some runners don't have Docker installed: https://lists.gnu.org/archive/html/qemu-devel/2021-04/msg02213.html Regards, Phil.
On 4/14/21 12:29 PM, Philippe Mathieu-Daudé wrote: > On 4/14/21 10:19 AM, Thomas Huth wrote: >> Ccache can speed up the compilation in some cases, so enable it for >> our cross-compilation CI builds, too. >> >> Signed-off-by: Thomas Huth <thuth@redhat.com> >> --- >> .gitlab-ci.d/crossbuilds.yml | 28 ++++++++++++++++++++++++++++ >> 1 file changed, 28 insertions(+) >> >> diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml >> index 017731a894..dee327a936 100644 >> --- a/.gitlab-ci.d/crossbuilds.yml >> +++ b/.gitlab-ci.d/crossbuilds.yml >> @@ -1,4 +1,26 @@ >> + >> +.ccache_cross_setup: >> + cache: >> + key: "$CI_JOB_NAME" >> + paths: >> + - ccache > > I discovered last month the cache/artifact passing feature is useful > when all runners are in the same premises, but when you used runner > in different locations it become slower (except if all your runners > are in very fast clouds probably). > > Not a short term problem, but can hit us long term. I haven't looked > if GitLab already figured how to manage this globally, like registering > runners with affinity, or assigning them to pools. > > If we decide to stick with the free-tier runners, then this is a great > improvement. > > For custom runners, a simple kludge is to assert they do *not* use > cache/artifacts (from free-tier runners). > > We could restrict this to free-tier runners but these runners tag aren't > standardized, and AFAIK we can not (yet?) use the "ANY" word to "select > runners with any of this tag list". So far I noticed gitlab uses these: > - shared docker > - gce docker > - gitlab-org > - gitlab-org-docker > > The last 2 are recent, and seem to help with the problem I reported > that some runners don't have Docker installed: > https://lists.gnu.org/archive/html/qemu-devel/2021-04/msg02213.html Actually found the doc for the last 2: https://docs.gitlab.com/ee/user/gitlab_com/#linux-shared-runners - gitlab-org-docker All your CI/CD jobs run on n1-standard-1 instances with 3.75GB of RAM, CoreOS and the latest Docker Engine installed. Instances provide 1 vCPU and 25GB of HDD disk space. The default region of the VMs is US East1. Each instance is used only for one job, this ensures any sensitive data left on the system can’t be accessed by other people their CI jobs. - gitlab-org The gitlab-shared-runners-manager-X.gitlab.com fleet of runners are dedicated for GitLab projects as well as community forks of them. They use a slightly larger machine type (n1-standard-2) and have a bigger SSD disk size. They don’t run untagged jobs and unlike the general fleet of shared runners, the instances are re-used up to 40 times.
diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml index 017731a894..dee327a936 100644 --- a/.gitlab-ci.d/crossbuilds.yml +++ b/.gitlab-ci.d/crossbuilds.yml @@ -1,4 +1,26 @@ + +.ccache_cross_setup: + cache: + key: "$CI_JOB_NAME" + paths: + - ccache + before_script: + - mkdir -p ccache + - if command -v ccache ; then + export CCACHE_BASEDIR=${PWD} ; + export CCACHE_DIR=${PWD}/ccache ; + export CCACHE_MAXSIZE="1G" ; + if [ -e /usr/lib/ccache ]; then + export PATH=/usr/lib/ccache:$PATH ; + fi ; + if [ -e /usr/lib64/ccache ]; then + export PATH=/usr/lib64/ccache:$PATH ; + fi ; + ccache --zero-stats ; + fi + .cross_system_build_job: + extends: .ccache_cross_setup stage: build image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest timeout: 80m @@ -11,6 +33,7 @@ i386-softmmu microblaze-softmmu mips-softmmu mipsel-softmmu mips64-softmmu ppc-softmmu sh4-softmmu xtensa-softmmu" - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS + - if command -v ccache ; then ccache --show-stats ; fi # Job to cross-build specific accelerators. # @@ -18,6 +41,7 @@ # KVM), and set extra options (such disabling other accelerators) via the # $ACCEL_CONFIGURE_OPTS variable. .cross_accel_build_job: + extends: .ccache_cross_setup stage: build image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest timeout: 30m @@ -28,8 +52,10 @@ ../configure --enable-werror --disable-docs $QEMU_CONFIGURE_OPTS --disable-tools --enable-${ACCEL:-kvm} $ACCEL_CONFIGURE_OPTS - make -j$(expr $(nproc) + 1) all check-build + - if command -v ccache ; then ccache --show-stats ; fi .cross_user_build_job: + extends: .ccache_cross_setup stage: build image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest script: @@ -39,6 +65,7 @@ ../configure --enable-werror --disable-docs $QEMU_CONFIGURE_OPTS --disable-system - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS + - if command -v ccache ; then ccache --show-stats ; fi cross-armel-system: extends: .cross_system_build_job @@ -195,6 +222,7 @@ cross-win64-system: --target-list="cris-softmmu x86_64-softmmu microblaze-softmmu mipsel-softmmu mips64-softmmu ppc-softmmu sh4-softmmu xtensa-softmmu" - make -j$(expr $(nproc) + 1) all check-build + - if command -v ccache ; then ccache --show-stats ; fi cross-amd64-xen-only: extends: .cross_accel_build_job
Ccache can speed up the compilation in some cases, so enable it for our cross-compilation CI builds, too. Signed-off-by: Thomas Huth <thuth@redhat.com> --- .gitlab-ci.d/crossbuilds.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)