Add validation for compose schema bindata.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin 2016-12-27 11:55:13 -05:00
parent 007e492eac
commit d9bda3080a
4 changed files with 32 additions and 3 deletions

View file

@ -261,7 +261,7 @@ Function Validate-GoFormat($headCommit, $upstreamCommit) {
# Get a list of all go source-code files which have changed. Ignore exit code on next call - always process regardless
$files=@(); $files = Invoke-Expression "git diff $upstreamCommit...$headCommit --diff-filter=ACMR --name-only -- `'*.go`'"
$files = $files | Select-String -NotMatch "^vendor/"
$files = $files | Select-String -NotMatch "^vendor/" | Select-String -NotMatch "^cli/compose/schema/bindata.go"
$badFiles=@(); $files | %{
# Deliberately ignore error on next line - treat as failed
$content=Invoke-Expression "git show $headCommit`:$_"

28
hack/validate/compose-bindata Executable file
View file

@ -0,0 +1,28 @@
#!/bin/bash
export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${SCRIPTDIR}/.validate"
IFS=$'\n'
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'cli/compose/schema/data' || true) )
unset IFS
if [ ${#files[@]} -gt 0 ]; then
go generate github.com/docker/docker/cli/compose/schema 2> /dev/null
# Let see if the working directory is clean
diffs="$(git status --porcelain -- api/types/ 2>/dev/null)"
if [ "$diffs" ]; then
{
echo 'The result of `go generate github.com/docker/docker/cli/compose/schema` differs'
echo
echo "$diffs"
echo
echo 'Please run `go generate github.com/docker/docker/cli/compose/schema`'
} >&2
false
else
echo 'Congratulations! cli/compose/schema/bindata.go is up-to-date.'
fi
else
echo 'No cli/compose/schema/data changes in diff.'
fi

View file

@ -4,7 +4,9 @@ export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${SCRIPTDIR}/.validate"
IFS=$'\n'
files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/' || true) )
files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' |
grep -v '^vendor/' |
grep -v '^cli/compose/schema/bindata.go' || true) )
unset IFS
badFiles=()

View file

@ -8,7 +8,6 @@ files=( $(validate_diff --diff-filter=ACMR --name-only -- 'api/types/' 'api/swag
unset IFS
if [ ${#files[@]} -gt 0 ]; then
# We run vndr to and see if we have a diff afterwards
${SCRIPTDIR}/../generate-swagger-api.sh 2> /dev/null
# Let see if the working directory is clean
diffs="$(git status --porcelain -- api/types/ 2>/dev/null)"