From 03c1a369604ca0853b7fb575be432d2b7bff8f98 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Mon, 12 Dec 2016 11:29:56 +0100 Subject: [PATCH] Make root-marker generation more robust Check whether we're on master or stable branch and create marker in the correct place. This ensures that they are always properly set. Change-Id: I4fede4a1e9d8a15fa7f932feefdb5eab13685aca --- tools/build-all-rst.sh | 22 ++++++++++++++++++---- tools/build-install-guides-rst.sh | 18 ++++++++++++++++-- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/tools/build-all-rst.sh b/tools/build-all-rst.sh index 386e358b45..5e109ebcc4 100755 --- a/tools/build-all-rst.sh +++ b/tools/build-all-rst.sh @@ -2,6 +2,15 @@ mkdir -p publish-docs +# Set this to a sensible value if not set by OpenStack CI. +if [ -z "$ZUUL_REFNAME" ] ; then + ZUUL_REFNAME="master" +fi + +# This marker is needed for infra publishing. +# Note for stable branches, this needs to be the top of each manual. +MARKER_TEXT="Project: $ZUUL_PROJECT Ref: $ZUUL_REFNAME Build: $ZUUL_UUID Revision: $ZUUL_NEWREV" + LINKCHECK="" if [[ $# > 0 ]] ; then if [ "$1" = "--linkcheck" ] ; then @@ -16,6 +25,7 @@ PDF_TARGETS=( 'arch-design' 'arch-design-draft' 'cli-reference'\ 'ha-guide' 'networking-guide'\ 'ops-guide' 'user-guide' ) +# Note that these guides are only build for master branch for guide in admin-guide arch-design cli-reference contributor-guide \ ha-guide image-guide ops-guide user-guide; do if [[ ${PDF_TARGETS[*]} =~ $guide ]]; then @@ -38,11 +48,15 @@ for guide in networking-guide arch-design-draft config-reference; do tools/build-rst.sh doc/$guide --build build \ --target "draft/$guide" $LINKCHECK fi + # For stable branches, we need to mark the specific guides. + if [ "$ZUUL_REFNAME" != "master" ] ; then + echo $MARKER_TEXT > publish-docs/draft/$guide/.root-marker + fi done tools/build-install-guides-rst.sh $LINKCHECK -# This marker is needed for infra publishing. -# Note for stable branches, this needs to be the top of each manual. -MARKER_TEXT="Project: $ZUUL_PROJECT Ref: $ZUUL_REFNAME Build: $ZUUL_UUID Revision: $ZUUL_NEWREV" -echo $MARKER_TEXT > publish-docs/.root-marker +# For master, just mark the root +if [ "$ZUUL_REFNAME" = "master" ] ; then + echo $MARKER_TEXT > publish-docs/.root-marker +fi diff --git a/tools/build-install-guides-rst.sh b/tools/build-install-guides-rst.sh index c75ebcf838..cb1533b41d 100755 --- a/tools/build-install-guides-rst.sh +++ b/tools/build-install-guides-rst.sh @@ -22,12 +22,22 @@ fi cp -f ${INDEX} ${INDEX}.save trap "mv -f ${INDEX}.save ${INDEX}" EXIT +# Set this to a sensible value if not set by OpenStack CI. +if [ -z "$ZUUL_REFNAME" ] ; then + ZUUL_REFNAME="master" +fi + +# This marker is needed for infra publishing. +# Note for stable branches, this needs to be the top of each manual. +MARKER_TEXT="Project: $ZUUL_PROJECT Ref: $ZUUL_REFNAME Build: $ZUUL_UUID Revision: $ZUUL_NEWREV" + for tag in $TAGS; do + TARGET="draft/install-guide-${tag}" if [[ "$tag" == "debconf" ]]; then # Build the guide with debconf # To use debian only contents, use "debian" tag. tools/build-rst.sh doc/install-guide-debconf \ - --tag debian --target "draft/install-guide-${tag}" $LINKCHECK --pdf + --tag debian --target "$TARGET" $LINKCHECK --pdf else ## # Because Sphinx uses the first heading as title regardless of @@ -40,6 +50,10 @@ for tag in $TAGS; do # Build the guide tools/build-rst.sh doc/install-guide \ - --tag ${tag} --target "draft/install-guide-${tag}" $LINKCHECK --pdf + --tag ${tag} --target "$TARGET" $LINKCHECK --pdf + fi + # Add this for stable branches + if [ "$ZUUL_REFNAME" != "master" ] ; then + echo $MARKER_TEXT > publish-docs/$TARGET/.root-marker fi done