From 9ca0ac6e420e5eb69ed635493bae91a200694c77 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 30 Oct 2024 08:50:16 +0100 Subject: [PATCH] gitlab-ci: fix checkupdates_filter exit code ! has meaning in YAML, and dealing with conflicting YAML vs bash quoting and escaping is a nightmare. So just use if/then/else. --- .gitlab-ci.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d064a30cfd..3bbaae53bd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -485,11 +485,17 @@ check_git_repos: checkupdates_filter: image: debian:bookworm-slim stage: test + needs: [] rules: - if: $CI_PROJECT_PATH == 'fdroid/checkupdates-bot-fdroiddata' script: - apt-get update - apt-get -qy install --no-install-recommends ca-certificates git - git fetch https://gitlab.com/fdroid/fdroiddata.git - - echo "Checking for modifications to restricted paths:" - - ! (git diff --merge-base FETCH_HEAD HEAD --name-only | grep -v '^metadata/\S*\.yml$') + - | + if git diff --merge-base FETCH_HEAD HEAD --name-only | grep -v '^metadata/\S*\.yml$'; then + printf "\x1b[31mERROR Modifications to paths checkupdates-bot is not allowed to change! \x1b[0m\n" + exit 1 + else + echo "All file modifications match paths checkupdates-bot is allowed to change." + fi