mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 09:54:25 +09:00
gitlab-ci: Check merge requests for Signed-off-by trailers
Based on Andreas work in https://gitlab.com/libssh/libssh-mirror/-/merge_requests/104/ Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Jakub Jelen
parent
ed68fdaa61
commit
46e6804c89
@@ -112,6 +112,16 @@ clang-format:
|
|||||||
# the format is not always matching our intentions
|
# the format is not always matching our intentions
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
|
||||||
|
git-log-check:
|
||||||
|
variables:
|
||||||
|
GIT_DEPTH: 100
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
||||||
|
stage: review
|
||||||
|
script:
|
||||||
|
- ./.gitlab-ci/git-check-signoff-trailer.sh ${CI_MERGE_REQUEST_DIFF_BASE_SHA}
|
||||||
|
only:
|
||||||
|
- merge_requests
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# CentOS builds #
|
# CentOS builds #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|||||||
36
.gitlab-ci/git-check-signoff-trailer.sh
Executable file
36
.gitlab-ci/git-check-signoff-trailer.sh
Executable file
@@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ $# != 1 ]; then
|
||||||
|
echo "Usage: $0 UPSTREAM_COMMIT_SHA"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
if [ -z "$CI_COMMIT_SHA" ]; then
|
||||||
|
echo "CI_COMMIT_SHA is not set"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CI_COMMIT_RANGE="$1..$CI_COMMIT_SHA"
|
||||||
|
|
||||||
|
red='\033[0;31m'
|
||||||
|
blue='\033[0;34m'
|
||||||
|
|
||||||
|
echo -e "${blue}Checking commit range: $CI_COMMIT_RANGE"
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
|
||||||
|
for commit in `git rev-list $CI_COMMIT_RANGE`; do
|
||||||
|
git show -s --format=%B $commit | grep "^Signed-off-by: " 2>&1 >/dev/null
|
||||||
|
ret=$?
|
||||||
|
if [ $ret -eq 1 ]; then
|
||||||
|
echo -e "${red} >>> Missing Signed-off-by trailer in commit $commit"
|
||||||
|
failed=`expr $failed + 1`
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
|
||||||
|
exit $failed
|
||||||
Reference in New Issue
Block a user