diff options
author | Tim Rühsen <tim.ruehsen@gmx.de> | 2019-01-10 14:53:32 +0100 |
---|---|---|
committer | Tim Rühsen <tim.ruehsen@gmx.de> | 2019-01-20 13:20:41 +0100 |
commit | 3a1ec182a38e372e03887bc231b7d3766aaa134f (patch) | |
tree | 643d98685ee0d783c478cb59a171363253dd5c94 | |
parent | dfc3780b3efa0ff99daecd7d43078a45050e818b (diff) | |
download | gnutls-3a1ec182a38e372e03887bc231b7d3766aaa134f.tar.gz |
Check for Signed-off-by: in CI
Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
-rw-r--r-- | .gitlab-ci.yml | 18 | ||||
-rwxr-xr-x | devel/check_if_signed | 25 |
2 files changed, 43 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6a7652ddeb..cc67461034 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,6 +31,7 @@ variables: DEBIAN_X86_CROSS_BUILD: buildenv-debian-x86-cross FEDORA28_BUILD: buildenv-f28 FEDORA_BUILD: buildenv-f29 + ALPINE_BASE_BUILD: buildenv-alpine-base CPPCHECK_OPTIONS: "--enable=warning --enable=style --enable=performance --enable=portability --std=c99 --suppressions-list=devel/cppcheck.suppressions --template='{id}:{file}:{line},{severity},{message}'" GET_SOURCES_ATTEMPTS: "3" @@ -38,6 +39,23 @@ variables: # Stage 1, documentation, and advanced checks ################################################## +commit-check: + stage: stage1-testing + image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$ALPINE_BASE_BUILD + before_script: + - /bin/true + after_script: + - /bin/true + cache: + # do not load cache files + key: none + policy: pull + script: + # we want $ALPINE_BASE_BUILD without git, so add it here + - apk add git + - devel/check_if_signed + retry: 0 + doc-dist.Fedora: stage: stage1-testing image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD diff --git a/devel/check_if_signed b/devel/check_if_signed new file mode 100755 index 0000000000..a053bbc0c8 --- /dev/null +++ b/devel/check_if_signed @@ -0,0 +1,25 @@ +#!/usr/bin/env sh + +if test -z "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"; then + CI_MERGE_REQUEST_TARGET_BRANCH_NAME="master" +fi + +echo "target=$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" +echo "source=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" + +# create list of commits of the current branch +commits=$(git rev-list --no-merges $CI_MERGE_REQUEST_TARGET_BRANCH_NAME..$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME) + +# check if author's email matches email in 'Signed-off-by' +for hash in $commits; do + author=$(git log --format='%ae' ${hash}^\!) + signed=$(git log --format='%b' ${hash}^\! | grep -i "Signed-off-by:") + if test $? -ne 0; then + echo "Missing Signed-off-by" + exit 1 + fi + if ! echo $signed | grep -q "Signed-off-by:.*<${author}>"; then + echo "Author '${author}' doesn't match" + exit 1 + fi +done |