A problem we hit on our CI runners themselves, from time to time, is a lack of disk space on the host. This is because Gitlab has no automation itself around the removal of items it put in a "cache". While part of the way to alleviate this is for the runners to run various docker cleanup commands on their own, periodically, another thing to potentially help would be to further clean-up in the job itself.
This patch adds "git clean -dfx" in jobs that leave some files in the source tree (these files may lead to a cache miss, more investigation would be required) and deleting the board build directory. This part is both a minimal size reclamation and minimal time increase (a few seconds). The other part this adds is making the world build use "/tmp/world" as the output directory not "/tmp" so that we can then delete "/tmp/world" afterwards. This adds between 1m30 and 3m to the build. Signed-off-by: Tom Rini <tr...@konsulko.com> --- Cc: Simon Glass <s...@chromium.org> Cc: Ilias Apalodimas <ilias.apalodi...@linaro.org> --- .gitlab-ci.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2dbe6325f334..ce7a391bbd00 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -63,8 +63,9 @@ stages: -r tools/buildman/requirements.txt -r tools/u_boot_pylib/requirements.txt after_script: + - git clean -dfx - cp -v /tmp/${TEST_PY_BD}/*.{html,css,xml} . - - rm -rf /tmp/uboot-test-hooks /tmp/venv + - rm -rf /tmp/uboot-test-hooks /tmp/venv /tmp/${TEST_PY_BD} script: # If we've been asked to use clang only do one configuration. - export UBOOT_TRAVIS_BUILD_DIR=/tmp/${TEST_PY_BD} @@ -130,11 +131,13 @@ build all platforms in a single job: -r tools/buildman/requirements.txt - ret=0; git config --global --add safe.directory "${CI_PROJECT_DIR}"; - ./tools/buildman/buildman -o /tmp -PEWM -x xtensa || ret=$?; + ./tools/buildman/buildman -o /tmp/world -PEWM -x xtensa || ret=$?; if [[ $ret -ne 0 ]]; then - ./tools/buildman/buildman -o /tmp -seP; + ./tools/buildman/buildman -o /tmp/world -seP; exit $ret; fi; + after_script: + - rm -rf /tmp/world .testsuites: stage: testsuites @@ -155,11 +158,15 @@ check for new CONFIG symbols outside Kconfig: docs: extends: .testsuites script: + - git config --global --add safe.directory "${CI_PROJECT_DIR}" - virtualenv -p /usr/bin/python3 /tmp/venvhtml - . /tmp/venvhtml/bin/activate - pip install -r doc/sphinx/requirements.txt - make htmldocs KDOC_WERROR=1 - make infodocs + after_script: + - rm -rf /tmp/venvhtml + - git clean -dfx # ensure all configs have MAINTAINERS entries Check for configs without MAINTAINERS entry: @@ -173,7 +180,8 @@ Build tools-only and envtools: script: - make tools-only_config tools-only -j$(nproc); make mrproper; - make tools-only_config envtools -j$(nproc) + make tools-only_config envtools -j$(nproc); + make mrproper Run binman, buildman, dtoc, Kconfig and patman testsuites: extends: .testsuites @@ -201,6 +209,9 @@ Run binman, buildman, dtoc, Kconfig and patman testsuites: ./tools/dtoc/dtoc -t; ./tools/patman/patman test; make testconfig + after_script: + - rm -rf /tmp/venv /tmp/tools-only + - git clean -dfx # Check for any pylint regressions Run pylint: @@ -223,6 +234,9 @@ Run pylint: - pylint --version - export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt" - make pylint_err + after_script: + - rm -rf /tmp/venv /tmp/tools-only + - git clean -dfx # Check for pre-schema driver model tags Check for pre-schema tags: -- 2.43.0