summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-01-11 18:16:59 +0000
committerGerrit Code Review <review@openstack.org>2019-01-11 18:16:59 +0000
commitffc27a339ff9acb90058b453f79ffbe7de26b783 (patch)
treef899e61afcca2f58bc984bd8c352550d24a632cf
parentfba15d26a601e6e779229fd607098ca86f6b89d6 (diff)
parent3525e04cc597e5f30243e4c882a4e316d8c95b43 (diff)
Merge "Add validate-dco-license role"
-rw-r--r--roles/validate-dco-license/README.rst12
-rw-r--r--roles/validate-dco-license/defaults/main.yaml9
-rw-r--r--roles/validate-dco-license/tasks/main.yaml25
3 files changed, 46 insertions, 0 deletions
diff --git a/roles/validate-dco-license/README.rst b/roles/validate-dco-license/README.rst
new file mode 100644
index 0000000..2cf9b0b
--- /dev/null
+++ b/roles/validate-dco-license/README.rst
@@ -0,0 +1,12 @@
1Validate all commits have Signed-off-by header
2
3**Role Variables**
4
5.. zuul:rolevar:: dco_license_failure
6
7 Message to display when Signed-off-by header is missing.
8
9.. zuul:rolevar:: zuul_work_dir
10 :default: {{ zuul.project.src_dir }}
11
12 Directory to DCO license check in.
diff --git a/roles/validate-dco-license/defaults/main.yaml b/roles/validate-dco-license/defaults/main.yaml
new file mode 100644
index 0000000..2a6712c
--- /dev/null
+++ b/roles/validate-dco-license/defaults/main.yaml
@@ -0,0 +1,9 @@
1---
2dco_license_failure: |
3 One or more commits have not been signed properly using --signoff.
4
5 The meaning of a signoff depends on the project, but it typically certifies
6 that committer has the rights to submit this work under the same license and
7 agrees to a Developer Certificate of Origin
8 (see http://developercertificate.org/ for more information).
9zuul_work_dir: "{{ zuul.project.src_dir }}"
diff --git a/roles/validate-dco-license/tasks/main.yaml b/roles/validate-dco-license/tasks/main.yaml
new file mode 100644
index 0000000..47228af
--- /dev/null
+++ b/roles/validate-dco-license/tasks/main.yaml
@@ -0,0 +1,25 @@
1- name: Developer Certificate of Origin (DCO) license check
2 shell:
3 cmd: |
4 set -e
5 result=0
6 for commit in $(git cherry -v origin/{{ zuul.branch }} HEAD | cut -d " " -f2)
7 do
8 if ! git show -s $commit | grep -q "Signed-off-by:"; then
9 echo "---"
10 git show -s $commit
11 echo "---"
12 echo "does not have a Signed-off-by header"
13 result=1
14 fi
15 done
16 exit $result
17 chdir: "{{ zuul_work_dir }}"
18 executable: /bin/bash
19 register: _dco
20 failed_when: _dco.rc > 1
21
22- name: License check failed
23 fail:
24 msg: "{{ dco_license_failure }}"
25 when: _dco.rc != 0