Add verify script for swagger-docs
Signed-off-by: lonelyCZ <531187475@qq.com>
This commit is contained in:
parent
065400875c
commit
6339fbec48
|
@ -11,3 +11,4 @@ bash "$REPO_ROOT/hack/update-crdgen.sh"
|
||||||
bash "$REPO_ROOT/hack/update-estimator-protobuf.sh"
|
bash "$REPO_ROOT/hack/update-estimator-protobuf.sh"
|
||||||
bash "$REPO_ROOT/hack/update-import-aliases.sh"
|
bash "$REPO_ROOT/hack/update-import-aliases.sh"
|
||||||
bash "$REPO_ROOT/hack/update-vendor.sh"
|
bash "$REPO_ROOT/hack/update-vendor.sh"
|
||||||
|
bash "$REPO_ROOT/hack/update-swagger-docs.sh"
|
||||||
|
|
|
@ -11,3 +11,4 @@ bash "$REPO_ROOT/hack/verify-crdgen.sh"
|
||||||
bash "$REPO_ROOT/hack/verify-staticcheck.sh"
|
bash "$REPO_ROOT/hack/verify-staticcheck.sh"
|
||||||
bash "$REPO_ROOT/hack/verify-import-aliases.sh"
|
bash "$REPO_ROOT/hack/verify-import-aliases.sh"
|
||||||
bash "$REPO_ROOT/hack/verify-vendor.sh"
|
bash "$REPO_ROOT/hack/verify-vendor.sh"
|
||||||
|
bash "$REPO_ROOT/hack/verify-swagger-docs.sh"
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||||
|
|
||||||
|
DIFFROOT="${SCRIPT_ROOT}/api/openapi-spec"
|
||||||
|
TMP_DIFFROOT="${SCRIPT_ROOT}/_tmp/api/openapi-spec"
|
||||||
|
_tmp="${SCRIPT_ROOT}/_tmp"
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
rm -rf "${_tmp}"
|
||||||
|
}
|
||||||
|
trap "cleanup" EXIT SIGINT
|
||||||
|
|
||||||
|
cleanup
|
||||||
|
|
||||||
|
mkdir -p "${TMP_DIFFROOT}"
|
||||||
|
cp -a "${DIFFROOT}"/* "${TMP_DIFFROOT}"
|
||||||
|
|
||||||
|
bash "${SCRIPT_ROOT}/hack/update-swagger-docs.sh"
|
||||||
|
echo "diffing ${DIFFROOT} against freshly generated files"
|
||||||
|
|
||||||
|
ret=0
|
||||||
|
|
||||||
|
diff -Naupr "${DIFFROOT}" "${TMP_DIFFROOT}" || ret=$?
|
||||||
|
cp -a "${TMP_DIFFROOT}"/* "${DIFFROOT}"
|
||||||
|
if [[ $ret -eq 0 ]]
|
||||||
|
then
|
||||||
|
echo "${DIFFROOT} up to date."
|
||||||
|
else
|
||||||
|
echo "${DIFFROOT} is out of date. Please run hack/update-swagger-docs.sh"
|
||||||
|
exit 1
|
||||||
|
fi
|
Loading…
Reference in New Issue