From 430a359eed98a3d31e342db24da197e6f0380bca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 17 Dec 2024 16:00:31 +0100 Subject: [PATCH] Use TMPDIR for CI jobs --- .gitlab-ci.yml | 19 +++++++++++-------- .gitlab-scripts/generate-doc.sh | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7b74dd1985..8b2e92f131 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,6 +12,9 @@ stages: - test - build +variables: + TMPDIR: /tmp + packages: stage: preparation rules: @@ -161,8 +164,8 @@ check-eslint: check-ci-modules: extends: .check script: - - python .gitlab-scripts/generate-ci.py $TMPDIR/gitab-ci-modules.yml - - cmp .gitlab-ci-modules.yml $TMPDIR/gitab-ci-modules.yml + - python .gitlab-scripts/generate-ci.py "${TMPDIR}/gitab-ci-modules.yml" + - cmp .gitlab-ci-modules.yml "${TMPDIR}/gitab-ci-modules.yml" check-cookiecutter-module: extends: .check @@ -174,9 +177,9 @@ check-cookiecutter-module: before_script: - pip install cookiecutter script: - - cookiecutter --no-input cookiecutter-module -o /tmp - - flake8 /tmp/my_module - - isort --multi-line VERTICAL_GRID --check --diff /tmp/my_module + - cookiecutter --no-input cookiecutter-module -o "${TMPDIR}" + - flake8 "${TMPDIR}/my_module" + - isort --multi-line VERTICAL_GRID --check --diff "${TMPDIR}/my_module" rules: - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH changes: @@ -254,7 +257,7 @@ check-account-chart: .test-db: extends: .test-tox variables: - DB_CACHE: /tmp/cache + DB_CACHE: "${TMPDIR}/cache" script: - tox -e "py${PYTHON_VERSION/./}-${DATABASE}" -c "${PACKAGE}" -- -v --output-file junit.xml @@ -403,8 +406,8 @@ test-demo: - pip install packages/trytond* packages/proteus* script: - touch /tmp/demo.sqlite - - echo "admin" > /tmp/password - - TRYTONPASSFILE=/tmp/password trytond-admin --database demo --all --email admin@example.com + - echo "admin" > "${TMPDIR}/password" + - TRYTONPASSFILE="${TMPDIR}/password" trytond-admin --database demo --all --email admin@example.com - python -m demo --database demo rules: - changes: diff --git a/.gitlab-scripts/generate-doc.sh b/.gitlab-scripts/generate-doc.sh index 945f1bf191..3558b5d45f 100755 --- a/.gitlab-scripts/generate-doc.sh +++ b/.gitlab-scripts/generate-doc.sh @@ -7,7 +7,7 @@ mkdir -p "${OUTPUTDIR}" : ${MAX_PROCS:=$(( `nproc` * 2 ))} export DOC_BASE_URL -requirements=$(mktemp /tmp/requirements-doc-XXXXXXXXXX.txt) +requirements=$(mktemp "${TMPDIR}/requirements-doc-XXXXXXXXXX.txt") find . -name 'cookiecutter*' -prune -o -path '*/doc/requirements-doc.txt' -exec cat {} + | sort | uniq > "${requirements}" pip install setuptools pip install -r "${requirements}"