From 240495f07f54574cbc83030f472948cca7fbd93e Mon Sep 17 00:00:00 2001
From: Aanand Prasad <aanand.prasad@gmail.com>
Date: Mon, 27 Apr 2015 15:00:50 +0100
Subject: [PATCH] Remove DCO validation from CI script

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
---
 CONTRIBUTING.md     |  6 ++---
 script/.validate    | 33 --------------------------
 script/ci           |  3 ---
 script/validate-dco | 58 ---------------------------------------------
 4 files changed, 2 insertions(+), 98 deletions(-)
 delete mode 100644 script/.validate
 delete mode 100755 script/validate-dco

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 0cca17b00..373c8dc6f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -31,8 +31,8 @@ that should get you started.
 
 ## Running the test suite
 
-Use the test script to run DCO check, linting checks and then the full test
-suite against different Python interpreters:
+Use the test script to run linting checks and then the full test suite against
+different Python interpreters:
 
     $ script/test
 
@@ -51,8 +51,6 @@ you can specify a test directory, file, module, class or method:
     $ script/test tests.integration.service_test
     $ script/test tests.integration.service_test:ServiceTest.test_containers
 
-Before pushing a commit you can check the DCO by invoking `script/validate-dco`.
-
 ## Building binaries
 
 Linux:
diff --git a/script/.validate b/script/.validate
deleted file mode 100644
index 244cbe49c..000000000
--- a/script/.validate
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-
-if [ -z "$VALIDATE_UPSTREAM" ]; then
-	# this is kind of an expensive check, so let's not do this twice if we
-	# are running more than one validate bundlescript
-	
-	VALIDATE_REPO='https://github.com/docker/fig.git'
-	VALIDATE_BRANCH='master'
-	
-	if [ "$TRAVIS" = 'true' -a "$TRAVIS_PULL_REQUEST" != 'false' ]; then
-		VALIDATE_REPO="https://github.com/${TRAVIS_REPO_SLUG}.git"
-		VALIDATE_BRANCH="${TRAVIS_BRANCH}"
-	fi
-	
-	VALIDATE_HEAD="$(git rev-parse --verify HEAD)"
-	
-	git fetch -q "$VALIDATE_REPO" "refs/heads/$VALIDATE_BRANCH"
-	VALIDATE_UPSTREAM="$(git rev-parse --verify FETCH_HEAD)"
-	
-	VALIDATE_COMMIT_LOG="$VALIDATE_UPSTREAM..$VALIDATE_HEAD"
-	VALIDATE_COMMIT_DIFF="$VALIDATE_UPSTREAM...$VALIDATE_HEAD"
-	
-	validate_diff() {
-		if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
-			git diff "$VALIDATE_COMMIT_DIFF" "$@"
-		fi
-	}
-	validate_log() {
-		if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
-			git log "$VALIDATE_COMMIT_LOG" "$@"
-		fi
-	}
-fi
diff --git a/script/ci b/script/ci
index a1391c627..2e4ec9197 100755
--- a/script/ci
+++ b/script/ci
@@ -8,9 +8,6 @@
 
 set -e
 
->&2 echo "Validating DCO"
-script/validate-dco
-
 export DOCKER_VERSIONS=all
 . script/test-versions
 
diff --git a/script/validate-dco b/script/validate-dco
deleted file mode 100755
index 701ac5e46..000000000
--- a/script/validate-dco
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/bash
-
-set -e
-
-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