From d155e193f557cc270971bdb42208c2ffb3100845 Mon Sep 17 00:00:00 2001 From: Cristina Pauna Date: Thu, 25 Apr 2019 16:03:40 +0300 Subject: [PATCH] Add verify for signed patch JIRA: VAL-12 Add a script to verify that each patch has a "Signed-off-by" line Run the script with tox, so that the check is made for each patch submitted in gerrit Change-Id: I078d032fc1ebf79b710fd93689de47f298e0adce Signed-off-by: Cristina Pauna --- tox.ini | 6 ++++++ utils/signed.sh | 10 ++++++++++ 2 files changed, 16 insertions(+) create mode 100755 utils/signed.sh diff --git a/tox.ini b/tox.ini index f53943c..c6ac867 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,17 @@ [tox] minversion = 1.6 envlist = + signedCommit, coala, skipsdist = true passenv = TOX_WORK_DIR toxworkdir = {env:TOX_WORK_DIR:/tmp/v} +[testenv:signedCommit] +whitelist_externals = bash +commands = + bash utils/signed.sh + [testenv:coala] basepython = python3 deps = diff --git a/utils/signed.sh b/utils/signed.sh new file mode 100755 index 0000000..d5e4e04 --- /dev/null +++ b/utils/signed.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Check that the last commit message contains the "Signed-off-by <>" line + +signature="$(git log -1 --show-signature |grep Signed-off-by:)" + +if [ -z "$signature" ]; then + echo "Signed-off-by is missing from the commit message; please run \"git commit -s --amend\"" + exit 1 +fi -- 2.16.6