zuul-jobs/roles/validate-dco-license/tasks/main.yaml
Paul Belanger 3525e04cc5 Add validate-dco-license role
This role can be used to validate all commits have --signedoff header.

Change-Id: I737d3efd730d20c6dd9f4a7cda2aa99125eaa0a0
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2019-01-09 11:39:02 -05:00

26 lines
652 B
YAML

- 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_work_dir }}"
executable: /bin/bash
register: _dco
failed_when: _dco.rc > 1
- name: License check failed
fail:
msg: "{{ dco_license_failure }}"
when: _dco.rc != 0