diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 83213550..704b7e5f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,5 +1,5 @@
include:
- - remote: "https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/8445ff7af2a68795afb98f486251f2ef8f90621c/templates/ci-fairy.yml"
+ - remote: "https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/18194044f0f984c8815bc9a1a146582f6bf15d41/templates/ci-fairy.yml"
image: registry.gitlab.gnome.org/gnome/gnome-shell/fedora/33:2020-11-17.0
@@ -43,7 +43,12 @@ check_commit_log:
- .fdo.ci-fairy
stage: pre_review
script:
- - ./.gitlab-ci/check-commit-log.sh
+ - if [[ x"$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" != "x" ]] ;
+ then
+ ci-fairy check-commits --junit-xml=commit-message-junit-report.xml ;
+ else
+ echo "Not a merge request" ;
+ fi
<<: *pipeline_guard
artifacts:
expire_in: 1 week
diff --git a/.gitlab-ci/check-commit-log.sh b/.gitlab-ci/check-commit-log.sh
deleted file mode 100755
index 00fd8938..00000000
--- a/.gitlab-ci/check-commit-log.sh
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env bash
-
-if [ -z "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
- echo This is not a merge request, skipping
- exit 0
-fi
-
-git fetch $CI_MERGE_REQUEST_PROJECT_URL.git $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
-
-branch_point=$(git merge-base HEAD FETCH_HEAD)
-
-commits=$(git log --format='format:%H' $branch_point..$CI_COMMIT_SHA)
-
-if [ -z "$commits" ]; then
- echo Commit range empty
- exit 1
-fi
-
-JUNIT_REPORT_TESTS_FILE=$(mktemp)
-
-function append_failed_test_case() {
- test_name="$1"
- commit="$2"
- test_message="$3"
- commit_short=${commit:0:8}
-
- echo "" >> $JUNIT_REPORT_TESTS_FILE
- echo &>2 "Commit check failed: $commit_short: $test_message"
-}
-
-function append_passed_test_case() {
- test_name="$1"
- commit="$2"
- commit_short=${commit:0:8}
- echo "" >> $JUNIT_REPORT_TESTS_FILE
-}
-
-function generate_junit_report() {
- junit_report_file="$1"
- num_tests=$(cat "$JUNIT_REPORT_TESTS_FILE" | wc -l)
- num_failures=$(grep '' "$JUNIT_REPORT_TESTS_FILE" | wc -l )
-
- echo Generating JUnit report \"$(pwd)/$junit_report_file\" with $num_tests tests and $num_failures failures.
-
- cat > $junit_report_file << __EOF__
-
-
-
-$(< $JUNIT_REPORT_TESTS_FILE)
-
-
-__EOF__
-}
-
-function commit_message_has_mr_url() {
- commit=$1
- commit_message=$(git show -s --format='format:%b' $commit)
- echo "$commit_message" | grep -qe "^$CI_MERGE_REQUEST_PROJECT_URL\/\(-\/\)\?merge_requests\/$CI_MERGE_REQUEST_IID$"
- return $?
-}
-
-for commit in $commits; do
- if commit_message_has_mr_url $commit; then
- append_failed_test_case superfluous_url $commit \
- "Commit message must not contain a link to its own merge request"
- else
- append_passed_test_case superfluous_url $commit
- fi
-done
-
-generate_junit_report commit-message-junit-report.xml
-
-! grep -q '