Repository: flink Updated Branches: refs/heads/master 8304f3e15 -> c04941d2a
[FLINK-5751] [docs] Add link check script This closes #3332. Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/c04941d2 Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/c04941d2 Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/c04941d2 Branch: refs/heads/master Commit: c04941d2ab61fffa9d45cdfce0cbf5fffd0fda0c Parents: 8304f3e Author: Patrick Lucas <[email protected]> Authored: Thu Feb 16 11:58:35 2017 +0100 Committer: Ufuk Celebi <[email protected]> Committed: Fri Feb 17 13:46:52 2017 +0100 ---------------------------------------------------------------------- docs/check_links.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/c04941d2/docs/check_links.sh ---------------------------------------------------------------------- diff --git a/docs/check_links.sh b/docs/check_links.sh new file mode 100755 index 0000000..36d5371 --- /dev/null +++ b/docs/check_links.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +################################################################################ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +################################################################################ + +target=${1:-"http://localhost:4000"} + +# Crawl the docs, ignoring robots.txt, storing nothing locally +wget --spider -r -nd -nv -e robots=off -p -o spider.log "$target" + +# Abort for anything other than 0 and 4 ("Network failure") +status=$? +if [ $status -ne 0 ] && [ $status -ne 4 ]; then + exit $status +fi + +# Fail the build if any broken links are found +broken_links_str=$(grep -e 'Found [[:digit:]]\+ broken links' spider.log) +if [ -n "$broken_links_str" ]; then + echo -e "\e[1;31m$broken_links_str\e[0m" + exit 1 +fi
