From b9acbe117cefc7fc193c36012a4c79e4c6663a0f Mon Sep 17 00:00:00 2001 From: Eli Polonsky Date: Mon, 4 Oct 2021 21:20:22 +0300 Subject: [PATCH] chore: DCO (#706) Part of https://github.com/cdk8s-team/cdk8s/issues/508 --- CONTRIBUTING.md | 7 +++++++ DCO | 34 ++++++++++++++++++++++++++++++++++ git-hooks/README.md | 9 +++++++++ git-hooks/prepare-commit-msg | 18 ++++++++++++++++++ git-hooks/setup.sh | 10 ++++++++++ 5 files changed, 78 insertions(+) create mode 100644 DCO create mode 100644 git-hooks/README.md create mode 100755 git-hooks/prepare-commit-msg create mode 100755 git-hooks/setup.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 62bde36910..5ae492f3b0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -232,6 +232,13 @@ release. Therefore please following these guidelines to the letter: - If this is a breaking change, the last paragraph should describe the breaking change with the prefix `BREAKING CHANGE: xxxxxx`. +#### Developer Certificate Of Origin (DCO) + +Every commit should be signed-off in compliance with the [Developer Certificate Of Origin](./DCO). +You can sign your commits by using the `git commit -s` command. + +> To configure automatic signoff, see [git-hooks](./git-hooks/README.md). + ## Documentation Documentation is rendered from markdown using diff --git a/DCO b/DCO new file mode 100644 index 0000000000..49b8cb0549 --- /dev/null +++ b/DCO @@ -0,0 +1,34 @@ +Developer Certificate of Origin +Version 1.1 + +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + + +Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. diff --git a/git-hooks/README.md b/git-hooks/README.md new file mode 100644 index 0000000000..cecddeaf79 --- /dev/null +++ b/git-hooks/README.md @@ -0,0 +1,9 @@ +# Git Hooks + +This directory contains git hooks that the core team uses for various tasks. + +- Commit signoff for automatic compliance of the [DCO](../CONTRIBUTING.md#developer-certificate-of-origin-dco). + +## Setup + +To setup these git hooks, run `./git-hooks/setup.sh` from the root directory of the project. \ No newline at end of file diff --git a/git-hooks/prepare-commit-msg b/git-hooks/prepare-commit-msg new file mode 100755 index 0000000000..3ca518f395 --- /dev/null +++ b/git-hooks/prepare-commit-msg @@ -0,0 +1,18 @@ +#!/bin/sh + +NAME=$(git config user.name) +EMAIL=$(git config user.email) + +if [ -z "$NAME" ]; then + echo "empty git config user.name" + exit 1 +fi + +if [ -z "$EMAIL" ]; then + echo "empty git config user.email" + exit 1 +fi + +git interpret-trailers --if-exists doNothing --trailer \ + "Signed-off-by: $NAME <$EMAIL>" \ + --in-place "$1" \ No newline at end of file diff --git a/git-hooks/setup.sh b/git-hooks/setup.sh new file mode 100755 index 0000000000..a62242a50f --- /dev/null +++ b/git-hooks/setup.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +############################################## +# Setup shared .git hooks for this project. +# + +hooksdir="$(cd $(dirname $0) && pwd)" + +git config core.hooksPath ${hooksdir} +echo "Configured core.hooksPath to ${hooksdir}" \ No newline at end of file