Skip to content
Snippets Groups Projects
Unverified Commit fb8ed650 authored by Tomasz Maczukin's avatar Tomasz Maczukin
Browse files

Remove DCO validation

parent 8246c2c5
No related branches found
No related tags found
No related merge requests found
...@@ -75,11 +75,11 @@ to clean-up build results. ...@@ -75,11 +75,11 @@ to clean-up build results.
We use the usual `go` tools for this, to run those commands you need at least the linter which you can We use the usual `go` tools for this, to run those commands you need at least the linter which you can
install with `go get -u golang.org/x/lint/golint` install with `go get -u golang.org/x/lint/golint`
To run basic validation (dco, fmt), and the project unit tests, call: To run basic validation (fmt, test-short, lint, vet), and the project unit tests, call:
$ make test $ make test
If you want more indepth validation (vet, lint), and all tests with race detection, call: If you want all tests with race detection, call:
$ make validate $ make validate
...@@ -150,7 +150,6 @@ Scrub build results: ...@@ -150,7 +150,6 @@ Scrub build results:
make fmt make fmt
make vet make vet
make lint make lint
make dco
### Managing dependencies ### Managing dependencies
......
...@@ -41,7 +41,7 @@ include mk/validate.mk ...@@ -41,7 +41,7 @@ include mk/validate.mk
.all_coverage: coverage-generate coverage-html coverage-send coverage-serve coverage-clean .all_coverage: coverage-generate coverage-html coverage-send coverage-serve coverage-clean
.all_release: release-checksum release .all_release: release-checksum release
.all_test: test-short test-long test-integration .all_test: test-short test-long test-integration
.all_validate: dco fmt vet lint .all_validate: fmt vet lint
default: build default: build
...@@ -49,7 +49,7 @@ install: ...@@ -49,7 +49,7 @@ install:
cp $(PREFIX)/bin/$(PKG_NAME) /usr/local/bin cp $(PREFIX)/bin/$(PKG_NAME) /usr/local/bin
clean: coverage-clean build-clean clean: coverage-clean build-clean
test: dco fmt test-short lint vet test: fmt test-short lint vet
validate: dco fmt lint vet test-long validate: fmt lint vet test-long
.PHONY: .all_build .all_coverage .all_release .all_test .all_validate test build validate clean .PHONY: .all_build .all_coverage .all_release .all_test .all_validate test build validate clean
# Validate DCO on all history
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
# XXX vendorized script miss exec bit, hence the gymnastic
# plus the path resolution...
# TODO migrate away from the shell script and have a make equivalent instead
dco:
@echo `bash $(current_dir)/../script/validate-dco`
fmt: fmt:
@test -z "$$(gofmt -s -l . 2>&1 | grep -v vendor/ | tee /dev/stderr)" @test -z "$$(gofmt -s -l . 2>&1 | grep -v vendor/ | tee /dev/stderr)"
......
#!/bin/bash
source "$(dirname "$BASH_SOURCE")/.validate"
adds=$(validate_diff --numstat | awk '{ s += $1 } END { print s }')
dels=$(validate_diff --numstat | awk '{ s += $2 } END { print s }')
notDocs="$(validate_diff --numstat | awk '$3 !~ /^docs\// { print $3 }')"
: ${adds:=0}
: ${dels:=0}
# "Username may only contain alphanumeric characters or dashes and cannot begin with a dash"
githubUsernameRegex='[a-zA-Z0-9][a-zA-Z0-9-]+'
# https://github.com/docker/docker/blob/master/CONTRIBUTING.md#sign-your-work
dcoPrefix='Signed-off-by:'
dcoRegex="^(Docker-DCO-1.1-)?$dcoPrefix ([^<]+) <([^<>@]+@[^<>]+)>( \\(github: ($githubUsernameRegex)\\))?$"
check_dco() {
grep -qE "$dcoRegex"
}
if [ $adds -eq 0 -a $dels -eq 0 ]; then
echo '0 adds, 0 deletions; nothing to validate! :)'
elif [ -z "$notDocs" -a $adds -le 1 -a $dels -le 1 ]; then
echo 'Congratulations! DCO small-patch-exception material!'
else
commits=( $(validate_log --format='format:%H%n') )
badCommits=()
for commit in "${commits[@]}"; do
if [ -z "$(git log -1 --format='format:' --name-status "$commit")" ]; then
# no content (ie, Merge commit, etc)
continue
fi
if ! git log -1 --format='format:%B' "$commit" | check_dco; then
badCommits+=( "$commit" )
fi
done
if [ ${#badCommits[@]} -eq 0 ]; then
echo "Congratulations! All commits are properly signed with the DCO!"
else
{
echo "These commits do not have a proper '$dcoPrefix' marker:"
for commit in "${badCommits[@]}"; do
echo " - $commit"
done
echo
echo 'Please amend each commit to include a properly formatted DCO marker.'
echo
echo 'Visit the following URL for information about the Docker DCO:'
echo ' https://github.com/docker/docker/blob/master/CONTRIBUTING.md#sign-your-work'
echo
} >&2
false
fi
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment