mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 21:17:23 +00:00
Adding a script to verify that swagger spec is updated
This commit is contained in:
parent
0f1c4c25c3
commit
a89d2da249
@ -24,6 +24,7 @@ install:
|
|||||||
- ./hack/build-go.sh
|
- ./hack/build-go.sh
|
||||||
- GOPATH=$PWD/Godeps/_workspace:$GOPATH go install ./...
|
- 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-gendocs.sh
|
||||||
|
- PATH=$HOME/gopath/bin:./third_party/etcd:$PATH ./hack/verify-swagger-spec.sh
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- npm install karma karma-junit-reporter karma-phantomjs-launcher karma-jasmine
|
- npm install karma karma-junit-reporter karma-phantomjs-launcher karma-jasmine
|
||||||
|
@ -10606,7 +10606,7 @@
|
|||||||
},
|
},
|
||||||
"persistentVolumeReclaimPolicy": {
|
"persistentVolumeReclaimPolicy": {
|
||||||
"type": "string",
|
"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": {
|
"reason": {
|
||||||
"type": "string",
|
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -10603,7 +10603,7 @@
|
|||||||
},
|
},
|
||||||
"persistentVolumeReclaimPolicy": {
|
"persistentVolumeReclaimPolicy": {
|
||||||
"type": "string",
|
"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": {
|
"reason": {
|
||||||
"type": "string",
|
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
48
hack/verify-swagger-spec.sh
Executable file
48
hack/verify-swagger-spec.sh
Executable 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
|
@ -123,4 +123,16 @@ else
|
|||||||
fi
|
fi
|
||||||
echo "${reset}"
|
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
|
exit $exit_code
|
||||||
|
@ -31,6 +31,7 @@ install:
|
|||||||
- ./hack/build-go.sh
|
- ./hack/build-go.sh
|
||||||
- GOPATH=$PWD/Godeps/_workspace:$GOPATH go install ./...
|
- 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-gendocs.sh
|
||||||
|
- PATH=$HOME/gopath/bin:./third_party/etcd:$PATH ./hack/verify-swagger-spec.sh
|
||||||
|
|
||||||
script:
|
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
|
- 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
|
||||||
|
Loading…
Reference in New Issue
Block a user