From 052e22284be2c288b9afbe8cdcf70058f421237c Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 8 May 2020 11:42:59 +0200 Subject: [PATCH 1/2] gitlab-ci: show clear error message when one step of job fails --- .gitlab-ci.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e3ce7be9..25d2e11c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -142,14 +142,15 @@ lint_format_safety_bandit_checks: - python3 -m ensurepip - $pip install Babel 'bandit<1.6.0' pycodestyle pyflakes 'pylint<2.0' safety - export EXITVALUE=0 - - ./hooks/pre-commit || export EXITVALUE=1 - - ./tests/test-gradlew-fdroid || export EXITVALUE=1 + - function set_error() { export EXITVALUE=1; printf "\x1b[31mERROR `history|tail -2|head -1|cut -b 6-500`\x1b[0m\n"; } + - ./hooks/pre-commit || set_error + - ./tests/test-gradlew-fdroid || set_error - bandit -ii -s B110,B322,B404,B408,B410,B603,B607 -r $CI_PROJECT_DIR fdroid - || export EXITVALUE=1 - - safety check --full-report || export EXITVALUE=1 + || set_error + - safety check --full-report || set_error - pylint --rcfile=.pylint-rcfile --output-format=colorized --reports=n fdroid makebuildserver @@ -157,9 +158,9 @@ lint_format_safety_bandit_checks: fdroidserver/*.py tests/*.py tests/*.TestCase - || export EXITVALUE=1 + || set_error - apk add --no-cache gettext make - - make -C locale compile || export EXITVALUE=1 + - make -C locale compile || set_error - rm -f locale/*/*/*.mo - pybabel compile --domain=fdroidserver --directory locale 2>&1 | (grep -F "error:" && exit 1) || true - exit $EXITVALUE From 0700242416f07847c507dfb0b9498cdf515f68e8 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 8 May 2020 12:29:54 +0200 Subject: [PATCH 2/2] gitlab-ci: use latest pylint to avoid safety error about vuln --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 25d2e11c..3832c933 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -138,9 +138,9 @@ lint_format_safety_bandit_checks: variables: LANG: C.UTF-8 script: - - apk add --no-cache bash dash ca-certificates python3 + - apk add --no-cache bash build-base dash ca-certificates gcc python3 python3-dev - python3 -m ensurepip - - $pip install Babel 'bandit<1.6.0' pycodestyle pyflakes 'pylint<2.0' safety + - $pip install Babel 'bandit<1.6.0' pycodestyle pyflakes pylint safety - export EXITVALUE=0 - function set_error() { export EXITVALUE=1; printf "\x1b[31mERROR `history|tail -2|head -1|cut -b 6-500`\x1b[0m\n"; } - ./hooks/pre-commit || set_error