Adding a script to verify that swagger spec is updated

This commit is contained in:
nikhiljindal 2015-06-08 01:38:08 -07:00
parent 0f1c4c25c3
commit a89d2da249
6 changed files with 68 additions and 6 deletions

View File

@ -24,6 +24,7 @@ install:
- ./hack/build-go.sh
- GOPATH=$PWD/Godeps/_workspace:$GOPATH go install ./...
- PATH=$HOME/gopath/bin:./third_party/etcd:$PATH ./hack/verify-gendocs.sh
- PATH=$HOME/gopath/bin:./third_party/etcd:$PATH ./hack/verify-swagger-spec.sh
before_script:
- npm install karma karma-junit-reporter karma-phantomjs-launcher karma-jasmine

View File

@ -10606,7 +10606,7 @@
},
"persistentVolumeReclaimPolicy": {
"type": "string",
"description": "persistentVolumeReclaimPolicy is what happens to a volume when released from its claim; Default is Retain."
"description": "what happens to a volume when released from its claim; Valid options are Retain (default) and Recycle. Recyling must be supported by the volume plugin underlying this persistent volume."
}
}
},
@ -10818,7 +10818,7 @@
},
"reason": {
"type": "string",
"description": "(brief) reason the volume is not is not available, such as failed recycling"
"description": "(brief) reason the volume is not is not available"
}
}
},
@ -12053,4 +12053,4 @@
}
}
}
}
}

View File

@ -10603,7 +10603,7 @@
},
"persistentVolumeReclaimPolicy": {
"type": "string",
"description": "persistentVolumeReclaimPolicy is what happens to a volume when released from its claim; Default is Retain."
"description": "what happens to a volume when released from its claim; Valid options are Retain (default) and Recycle. Recyling must be supported by the volume plugin underlying this persistent volume."
}
}
},
@ -10815,7 +10815,7 @@
},
"reason": {
"type": "string",
"description": "(brief) reason the volume is not is not available, such as failed recycling"
"description": "(brief) reason the volume is not is not available"
}
}
},
@ -12059,4 +12059,4 @@
}
}
}
}
}

48
hack/verify-swagger-spec.sh Executable file
View File

@ -0,0 +1,48 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
SPECROOT="${KUBE_ROOT}/api/swagger-spec"
TMP_SPECROOT="${KUBE_ROOT}/_tmp/swagger-spec"
_tmp="${KUBE_ROOT}/_tmp"
mkdir -p "${_tmp}"
cp -a "${SPECROOT}" "${TMP_SPECROOT}"
"${KUBE_ROOT}/hack/build-go.sh"
"${KUBE_ROOT}/hack/update-swagger-spec.sh"
echo "diffing ${SPECROOT} against freshly generated swagger spec"
ret=0
diff -Naupr -I 'Auto generated by' "${SPECROOT}" "${TMP_SPECROOT}" || ret=$?
cp -a ${TMP_SPECROOT} "${KUBE_ROOT}/api"
rm -rf "${_tmp}"
if [[ $ret -eq 0 ]]
then
echo "${SPECROOT} up to date."
else
echo "${SPECROOT} is out of date. Please run hack/update-swagger-spec.sh"
exit 1
fi
# ex: ts=2 sw=2 et filetype=sh

View File

@ -123,4 +123,16 @@ else
fi
echo "${reset}"
echo -ne "Checking for swagger spec that need updating... "
if ! hack/verify-swagger-spec.sh > /dev/null; then
echo "${red}ERROR!"
echo "Swagger spec needs to be updated."
echo "To regenerate the spec, run:"
echo " hack/update-swagger-spec.sh"
exit_code=1
else
echo "${green}OK"
fi
echo "${reset}"
exit $exit_code

View File

@ -31,6 +31,7 @@ install:
- ./hack/build-go.sh
- GOPATH=$PWD/Godeps/_workspace:$GOPATH go install ./...
- PATH=$HOME/gopath/bin:./third_party/etcd:$PATH ./hack/verify-gendocs.sh
- PATH=$HOME/gopath/bin:./third_party/etcd:$PATH ./hack/verify-swagger-spec.sh
script:
- KUBE_RACE="-race" KUBE_COVER="y" KUBE_GOVERALLS_BIN="$HOME/gopath/bin/goveralls" KUBE_TIMEOUT='-timeout 300s' KUBE_COVERPROCS=8 KUBE_TEST_ETCD_PREFIXES="${KUBE_TEST_ETCD_PREFIXES}" KUBE_TEST_API_VERSIONS="${KUBE_TEST_API_VERSIONS}" ./hack/test-go.sh -- -p=2