Simple DCO check script to be used in any CI.
Project description
dco-check
Simple DCO check script to be used in any CI.
Motivation
Many open-source projects require the use of a Signed-off-by:
line in every commit message.
This is to certify that a contributor has the right to submit their code according to the Developer Certificate of Origin (DCO).
However, to my knowledge, there is no automated check that can run on any CI platform (or most platforms).
Some platforms simply do not possess such a feature.
This was inspired by the DCO GitHub App.
How to get & use
There are two main options:
- Using the package from PyPI
$ pip install dco-check $ dco-check
- Downloading the script and running it (you can replace
master
with a specific version)$ wget https://raw.githubusercontent.com/christophebedard/dco-check/master/dco_check/dco_check.py $ python3 dco_check.py
It exits with 0 if all checked commits have been signed-off. Otherwise, it exits with a non-zero number.
Run with --help
for more information and options, including:
- ignoring merge commits
- default branch
- default remote
- quiet mode
- verbose mode
Those options can alternatively be set through environment variables (see --help
).
How it works
dco-check
focuses on two use-cases:
- Commits part of a feature branch, i.e. a proposed change (pull request or merge request)
- Commits on the default branch, e.g.
master
, especially the new commits pushed to the default branch
The first use-case is easy to cover given a normal git repository.
We can simply use git merge-base --fork-point $DEFAULT_BRANCH
to get the list of commits on a specific feature branch.
Then we can just check every commit using git log
and make sure it is signed-off by the author.
The second use-case isn't really possible, because a git repository does not contain the necessary information (AFAIK). Fortunately, some CIs do provide this information.
Furthermore, by default, some CI platforms only clone git repositories up to a specific depth, i.e. you only get a partial commit history.
This depth can sometimes be 1 for some CIs.
For those cases, it is usually possible to prevent shallow cloning by setting the right parameter(s) in the job configuration.
However, since one of the goals of dco-check
is to be as easy to use as possible, it tries not to rely on that.
This is why dco-check
detects the current CI platform and uses whatever information that platform can provide.
Otherwise, it falls back on a default generic implementation which uses simple git commands.
Python version support
Python 3.6+ is required because of the use of f-strings.
However, it shouldn't be too hard to remove them to support older versions of Python 3, if there is demand for it, or if such a change is contributed to dco-check
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dco-check-0.0.5.tar.gz
.
File metadata
- Download URL: dco-check-0.0.5.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d83b4bf13c38174145bb983015bef978caaaa3153078bb778a448dc0db28694 |
|
MD5 | 5b93d5683cfebd6d7ac67261eeaaff53 |
|
BLAKE2b-256 | 9ce8b6734064b465e31767555112d5a952ce59bda1ff9235397aacaa2004ef2e |
File details
Details for the file dco_check-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: dco_check-0.0.5-py3-none-any.whl
- Upload date:
- Size: 16.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cd3e933675aabf337e00df2eda55ef64ca0d5b4674e373149ef4b03f74ec5cb |
|
MD5 | 6a913550bb580621424f434a34535016 |
|
BLAKE2b-256 | 406c5ad400c8d67a1a0158b611c5ef7e66b739914edef9e571577a32eafd56b8 |