Merge pull request #17382 from caesarxuchao/rewrite-linkchecker

Auto commit by PR queue bot
This commit is contained in:
k8s-merge-robot
2016-01-26 17:51:44 -08:00
22 changed files with 2187 additions and 51 deletions

View File

@@ -24,15 +24,36 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
linkcheck=$(kube::util::find-binary "linkcheck")
TYPEROOT="${KUBE_ROOT}/pkg/api/"
"${linkcheck}" "--root-dir=${TYPEROOT}" "--repo-root=${KUBE_ROOT}" "--file-suffix=types.go" "--prefix=http://releases.k8s.io/HEAD" && ret=0 || ret=$?
if [[ $ret -eq 1 ]]; then
echo "links in ${TYPEROOT} is out of date."
exit 1
fi
if [[ $ret -gt 1 ]]; then
echo "Error running linkcheck"
exit 1
kube::util::ensure-temp-dir
OUTPUT="${KUBE_TEMP}"/linkcheck-output
cleanup() {
rm -rf "${OUTPUT}"
}
trap "cleanup" EXIT SIGINT
mkdir -p "$OUTPUT"
APIROOT="${KUBE_ROOT}/pkg/api/"
APISROOT="${KUBE_ROOT}/pkg/apis/"
DOCROOT="${KUBE_ROOT}/docs/"
ROOTS=($APIROOT $APISROOT $DOCROOT)
found_invalid=false
for root in "${ROOTS[@]}"; do
"${linkcheck}" "--root-dir=${root}" 2> >(tee -a "${OUTPUT}/error" >&2) && ret=0 || ret=$?
if [[ $ret -eq 1 ]]; then
echo "Failed: found invalid links in ${root}."
found_invalid=true
fi
if [[ $ret -gt 1 ]]; then
echo "Error running linkcheck"
exit 1
fi
done
if [ ${found_invalid} = true ]; then
echo "Summary of invalid links:"
cat ${OUTPUT}/error
fi
trap "cleanup" EXIT SIGINT
# ex: ts=2 sw=2 et filetype=sh

View File

@@ -60,7 +60,7 @@ if $SILENT ; then
fi
# remove protobuf until it is part of direct generation
EXCLUDE="verify-godeps.sh verify-godep-licenses.sh verify-generated-protobuf.sh"
EXCLUDE="verify-godeps.sh verify-godep-licenses.sh verify-generated-protobuf.sh verify-linkcheck.sh"
ret=0
for t in `ls $KUBE_ROOT/hack/verify-*.sh`