Repository: impala Updated Branches: refs/heads/master 8c284e771 -> 70e2d57fc
IMPALA-7314: Doc generation should fail on error This patch updates the doc generation to fail when there is an error. dita does not exit with non-zero exit code when there is an error. The patch checks for [ERROR] in the dita output and fails if it encounters one. Testing: - Manually tested by injecting failures Change-Id: Ic452aa282a3f2a761e3b04a7460e0d86bc51d721 Reviewed-on: http://gerrit.cloudera.org:8080/10976 Reviewed-by: Alex Rodoni <[email protected]> Reviewed-by: Michael Brown <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/impala/repo Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/20087027 Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/20087027 Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/20087027 Branch: refs/heads/master Commit: 2008702759d16460803b6e190173f887cc6ef832 Parents: 8c284e7 Author: Fredy Wijaya <[email protected]> Authored: Tue Jul 17 21:34:46 2018 -0700 Committer: Impala Public Jenkins <[email protected]> Committed: Wed Jul 18 23:32:07 2018 +0000 ---------------------------------------------------------------------- docs/.gitignore | 1 + docs/Makefile | 4 ++-- docs/build-doc.sh | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/impala/blob/20087027/docs/.gitignore ---------------------------------------------------------------------- diff --git a/docs/.gitignore b/docs/.gitignore index b6e5611..cf8132f 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1,2 +1,3 @@ !Makefile build/ +*.log http://git-wip-us.apache.org/repos/asf/impala/blob/20087027/docs/Makefile ---------------------------------------------------------------------- diff --git a/docs/Makefile b/docs/Makefile index 99a0e09..fc2f8e9 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -26,7 +26,7 @@ pdf: build/impala.pdf ALL_DEPS=Makefile impala.ditamap shared/*.xml images/* topics/*.xml build/html/index.html: impala_html.ditaval ${ALL_DEPS} - dita -i impala.ditamap -f html5 -o $(dir $@) -filter $< + ./build-doc.sh html5 $(dir $@) $< gen-html.log build/impala.pdf: impala_pdf.ditaval ${ALL_DEPS} - dita -i impala.ditamap -f pdf -o $(dir $@) -filter $< + ./build-doc.sh pdf $(dir $@) $< gen-pdf.log http://git-wip-us.apache.org/repos/asf/impala/blob/20087027/docs/build-doc.sh ---------------------------------------------------------------------- diff --git a/docs/build-doc.sh b/docs/build-doc.sh new file mode 100755 index 0000000..6153e1d --- /dev/null +++ b/docs/build-doc.sh @@ -0,0 +1,36 @@ +#!/bin/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. + +set -euo pipefail + +function usage() { + echo "$0 <file_format> <output_file> <filter_file> <log_file>" + exit 1 +} + +[[ $# -eq 4 ]] || usage + +FILE_FORMAT=$1 +OUTPUT_FILE=$2 +FILTER_FILE=$3 +LOG_FILE=$4 + +dita -i impala.ditamap -f ${FILE_FORMAT} -o ${OUTPUT_FILE} -filter ${FILTER_FILE} 2>&1 \ + | tee ${LOG_FILE} +[[ -z $(grep "\[ERROR\]" ${LOG_FILE}) ]] || exit 1
