New test and commit hook to make sure changes to Godeps are reproducable

It is a pretty slow test (it downloads fresh) all of kube's Godeps, so only
run it when needed in pre-commit hook.

This also means that random changes to other non-kube repositories could
cause travis/shippable to just randomly stop working for all PRs which touch
Godeps after that moment (even though no changes have been made to Godeps by
us).  Examples would be things like other repos completely disappearing. Or
even the directory we include disappearing in master in the remote
project (even though the directory may exist at the commit we care
about) This is a bugwin godep, but it is a problem we have seen happen
with kube Godeps.
This commit is contained in:
Eric Paris
2015-08-04 00:45:39 -04:00
parent 8dcbebae5e
commit 823392e4e3
4 changed files with 90 additions and 0 deletions

View File

@@ -16,6 +16,20 @@ else
fi
echo "${reset}"
# Check if changes to Godeps are reproducable...
files=($(git diff --cached --name-only --diff-filter ACM | grep "Godeps"))
if [[ "${#files[@]}" -ne 0 ]]; then
echo -ne "Check if changes to Godeps are reproducable (this is pretty slow)..."
if ! OUT=$("hack/verify-godeps.sh" 2>&1); then
echo
echo "${red}${OUT}"
exit_code=1
else
echo "${green}OK"
fi
echo "${reset}"
fi
echo -ne "Checking for files that need gofmt... "
files_need_gofmt=()
files=($(git diff --cached --name-only --diff-filter ACM | grep "\.go" | grep -v -e "third_party" -e "Godeps"))