Add verify for signed patch 82/582/3
authorCristina Pauna <cristina.pauna@enea.com>
Thu, 25 Apr 2019 13:03:40 +0000 (16:03 +0300)
committerCristina Pauna <cristina.pauna@enea.com>
Thu, 2 May 2019 10:44:39 +0000 (13:44 +0300)
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 <cristina.pauna@enea.com>
tox.ini
utils/signed.sh [new file with mode: 0755]

diff --git a/tox.ini b/tox.ini
index f53943c..c6ac867 100644 (file)
--- 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 (executable)
index 0000000..d5e4e04
--- /dev/null
@@ -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