Signed-off-by: Daniel Nephin <dnephin@docker.com>
| 16 | 17 |
new file mode 100755 |
| ... | ... |
@@ -0,0 +1,30 @@ |
| 0 |
+#!/bin/bash |
|
| 1 |
+ |
|
| 2 |
+export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
| 3 |
+source "${SCRIPTDIR}/.validate"
|
|
| 4 |
+ |
|
| 5 |
+IFS=$'\n' |
|
| 6 |
+files=( $(validate_diff --diff-filter=ACMR --name-only -- 'api/types/' || true) ) |
|
| 7 |
+unset IFS |
|
| 8 |
+ |
|
| 9 |
+if [ ${#files[@]} -gt 0 ]; then
|
|
| 10 |
+ # We run vndr to and see if we have a diff afterwards |
|
| 11 |
+ ${SCRIPTDIR}/../generate-swagger-api.sh 2> /dev/null
|
|
| 12 |
+ # Let see if the working directory is clean |
|
| 13 |
+ diffs="$(git status --porcelain -- api/types/ 2>/dev/null)" |
|
| 14 |
+ if [ "$diffs" ]; then |
|
| 15 |
+ {
|
|
| 16 |
+ echo 'The result of hack/geneate-swagger-api.sh differs' |
|
| 17 |
+ echo |
|
| 18 |
+ echo "$diffs" |
|
| 19 |
+ echo |
|
| 20 |
+ echo 'Please update api/swagger.yaml with any api changes, then ' |
|
| 21 |
+ echo 'run `hack/geneate-swagger-api.sh`.' |
|
| 22 |
+ } >&2 |
|
| 23 |
+ false |
|
| 24 |
+ else |
|
| 25 |
+ echo 'Congratulations! All api changes are done the right way.' |
|
| 26 |
+ fi |
|
| 27 |
+else |
|
| 28 |
+ echo 'No api/types/ changes in diff.' |
|
| 29 |
+fi |