gitlab: aggressively avoid extra GIT data

This avoids fetching blobs and tree references for branches we are not
going to worry about. Also skip tag references which are similarly not
useful and keep the default --prune. This keeps the .git data to
around 100M rather than the ~400M even a shallow clone takes.

So we can check the savings we also run a quick du while setting up
the build.

We also have to have special settings of GIT_FETCH_EXTRA_FLAGS for the
Windows build, the migration legacy test and the custom runners. In
the case of the custom runners we also move the free floating variable
to the runner template.

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20240312170011.1688444-1-alex.bennee@linaro.org>
This commit is contained in:
Alex Bennée 2024-03-12 17:00:11 +00:00
parent c62d54d0a8
commit 9837697b7f
5 changed files with 12 additions and 2 deletions

View File

@ -24,6 +24,10 @@ variables:
# Each script line from will be in a collapsible section in the job output # Each script line from will be in a collapsible section in the job output
# and show the duration of each line. # and show the duration of each line.
FF_SCRIPT_SECTIONS: 1 FF_SCRIPT_SECTIONS: 1
# The project has a fairly fat GIT repo so we try and avoid bringing in things
# we don't need. The --filter options avoid blobs and tree references we aren't going to use
# and we also avoid fetching tags.
GIT_FETCH_EXTRA_FLAGS: --filter=blob:none --filter=tree:0 --no-tags --prune --quiet
interruptible: true interruptible: true

View File

@ -14,6 +14,7 @@
- export CCACHE_DIR="$CCACHE_BASEDIR/ccache" - export CCACHE_DIR="$CCACHE_BASEDIR/ccache"
- export CCACHE_MAXSIZE="500M" - export CCACHE_MAXSIZE="500M"
- export PATH="$CCACHE_WRAPPERSDIR:$PATH" - export PATH="$CCACHE_WRAPPERSDIR:$PATH"
- du -sh .git
- mkdir build - mkdir build
- cd build - cd build
- ccache --zero-stats - ccache --zero-stats

View File

@ -187,6 +187,8 @@ build-previous-qemu:
variables: variables:
IMAGE: opensuse-leap IMAGE: opensuse-leap
TARGETS: x86_64-softmmu aarch64-softmmu TARGETS: x86_64-softmmu aarch64-softmmu
# Override the default flags as we need more to grab the old version
GIT_FETCH_EXTRA_FLAGS: --prune --quiet
before_script: before_script:
- export QEMU_PREV_VERSION="$(sed 's/\([0-9.]*\)\.[0-9]*/v\1.0/' VERSION)" - export QEMU_PREV_VERSION="$(sed 's/\([0-9.]*\)\.[0-9]*/v\1.0/' VERSION)"
- git remote add upstream https://gitlab.com/qemu-project/qemu - git remote add upstream https://gitlab.com/qemu-project/qemu

View File

@ -10,13 +10,14 @@
# gitlab-runner. To avoid problems that gitlab-runner can cause while # gitlab-runner. To avoid problems that gitlab-runner can cause while
# reusing the GIT repository, let's enable the clone strategy, which # reusing the GIT repository, let's enable the clone strategy, which
# guarantees a fresh repository on each job run. # guarantees a fresh repository on each job run.
variables:
GIT_STRATEGY: clone
# All custom runners can extend this template to upload the testlog # All custom runners can extend this template to upload the testlog
# data as an artifact and also feed the junit report # data as an artifact and also feed the junit report
.custom_runner_template: .custom_runner_template:
extends: .base_job_template extends: .base_job_template
variables:
GIT_STRATEGY: clone
GIT_FETCH_EXTRA_FLAGS: --no-tags --prune --quiet
artifacts: artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
expire_in: 7 days expire_in: 7 days

View File

@ -28,6 +28,8 @@ msys2-64bit:
# qTests don't run successfully with "--without-default-devices", # qTests don't run successfully with "--without-default-devices",
# so let's exclude the qtests from CI for now. # so let's exclude the qtests from CI for now.
TEST_ARGS: --no-suite qtest TEST_ARGS: --no-suite qtest
# The Windows git is a bit older so override the default
GIT_FETCH_EXTRA_FLAGS: --no-tags --prune --quiet
artifacts: artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
expire_in: 7 days expire_in: 7 days