From 29e060276c9f67a26b154b704b61689294639ae7 Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Fri, 12 Oct 2018 21:09:29 -0400 Subject: [PATCH 1/2] DNM: DCO testing Signed-off-by: Paul Belanger --- .zuul.yaml | 7 +++++++ playbooks/dco/run.yaml | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 playbooks/dco/run.yaml diff --git a/.zuul.yaml b/.zuul.yaml index d4faf74..727d12d 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,6 +1,13 @@ +- job: + name: dco + run: playbooks/dco/run.yaml + - project: templates: - build-tox-docs + check: + jobs: + - dco post: jobs: - tox-docs diff --git a/playbooks/dco/run.yaml b/playbooks/dco/run.yaml new file mode 100644 index 0000000..94aff56 --- /dev/null +++ b/playbooks/dco/run.yaml @@ -0,0 +1,20 @@ +- hosts: all + tasks: + - name: chell + shell: git remote -v + args: + chdir: "{{ zuul.project.src_dir }}" + + - name: chell + shell: git log origin/master..HEAD + args: + chdir: "{{ zuul.project.src_dir }}" + + - name: shell + shell: | + for commit in $(git cherry master | cut -d " " -f2) + do + echo $commit + done + args: + chdir: "{{ zuul.project.src_dir }}" From 33959deb615368f4a9bfc9c697db9fe26856e27e Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Fri, 12 Oct 2018 22:16:37 -0400 Subject: [PATCH 2/2] Add b to file Signed-off-by: Paul Belanger --- .zuul.yaml | 4 ++-- playbooks/dco/run.yaml | 43 +++++++++++++++++++++++++++--------------- test.txt | 1 + 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index 727d12d..d44bca0 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,5 +1,5 @@ - job: - name: dco + name: dco-license-check run: playbooks/dco/run.yaml - project: @@ -7,7 +7,7 @@ - build-tox-docs check: jobs: - - dco + - dco-license-check post: jobs: - tox-docs diff --git a/playbooks/dco/run.yaml b/playbooks/dco/run.yaml index 94aff56..2bd2e55 100644 --- a/playbooks/dco/run.yaml +++ b/playbooks/dco/run.yaml @@ -1,20 +1,33 @@ - hosts: all tasks: - - name: chell - shell: git remote -v - args: + - name: Developer Certificate of Origin (DCO) license check + shell: + cmd: | + set -e + result=0 + for commit in $(git cherry -v origin/{{ zuul.branch }} HEAD | cut -d " " -f2) + do + if ! git show -s $commit | grep -q "Signed-off-by:"; then + echo "---" + git show -s $commit + echo "---" + echo "does not have a Signed-off-by header" + result=1 + fi + done + exit $result chdir: "{{ zuul.project.src_dir }}" + executable: /bin/bash + register: _dco + failed_when: _dco.rc > 1 - - name: chell - shell: git log origin/master..HEAD - args: - chdir: "{{ zuul.project.src_dir }}" + - name: License check failed + fail: + msg: | + One or more commits have not been signed properly using --signoff. - - name: shell - shell: | - for commit in $(git cherry master | cut -d " " -f2) - do - echo $commit - done - args: - chdir: "{{ zuul.project.src_dir }}" + The meaning of a signoff depends on the project, but it typically + certifies that committer has the rights to submit this work under + the same license and agrees to a Developer Certificate of Origin + (see http://developercertificate.org/ for more information). + when: _dco.rc != 0 diff --git a/test.txt b/test.txt index 86ba82a..00fc4d8 100644 --- a/test.txt +++ b/test.txt @@ -1 +1,2 @@ new line +b