diff --git a/makeBuild.py b/makeBuild.py index 9abe8bc9ee..60a5b7b25d 100755 --- a/makeBuild.py +++ b/makeBuild.py @@ -3,6 +3,7 @@ # uses a refactored Aura script which is an opensource port of ccutil +import argparse import sys import os import logging @@ -19,6 +20,15 @@ from aura.transformers.tf_asciidoc import AsciiDocPublicanTransformer, XML_NS, L #print(branch) +def setup_parser(): + parser = argparse.ArgumentParser( + formatter_class=argparse.ArgumentDefaultsHelpFormatter + ) + parser.add_argument( + "--include-api-book", help="Include the rest_api book in the build", action="store_true", default=False, + ) + return parser + # function to convert XML ids to HTML 4 compatible ids from ccutil def _fix_ids_for_html4(tree): """ @@ -122,6 +132,10 @@ all_validated = True # Initialize logging cli.init_logging(False, False) + +parser = setup_parser() +args = parser.parse_args() + for distro in os.listdir("drupal-build"): print("---------------------------------------") @@ -136,7 +150,9 @@ for distro in os.listdir("drupal-build"): continue # rest api book is a pain and doesn't convert well if book == "rest_api": - continue + # Exclude the REST API book unless we explicitly require it + if not args.include_api_book: + continue if os.path.exists(os.path.join("drupal-build", distro, book,"hugeBook.flag")): for secondary_book in os.listdir(os.path.join("drupal-build", distro, book)): diff --git a/scripts/prow-smoke-test.sh b/scripts/prow-smoke-test.sh index 3bc701eaf0..37e74e66cb 100755 --- a/scripts/prow-smoke-test.sh +++ b/scripts/prow-smoke-test.sh @@ -10,13 +10,16 @@ #% Validates openshift-docs AsciiDoc source files using the same tools that run in the Prow CI #% #%OPTIONS ⚙️ -#% -v, --validate Validate the AsciiDoc source +#% -v, --validate $DISTRO Validate the AsciiDoc source. Use --validate to run with default options +#% -a, --validate-incl-api-book Validate the AsciiDoc source and include the REST API books #% -l, --lint-topicmaps Lint topic-map YAML #% -p, --preview $DISTRO "$PRODUCT_NAME" $VERSION Use --preview to run with default options #% -h, --help Print this help #% #%EXAMPLES 🤔 #% ./scripts/prow-smoke-test.sh --validate +#% ./scripts/prow-smoke-test.sh --validate openshift-rosa +#% ./scripts/prow-smoke-test.sh --validate-incl-api-book #% ./scripts/prow-smoke-test.sh --lint-topicmaps #% ./scripts/prow-smoke-test.sh --preview #% ./scripts/prow-smoke-test.sh --preview openshift-rosa @@ -87,6 +90,13 @@ elif [[ "$TEST" == "--validate" || "$TEST" == "-v" ]]; then echo "🚧 Validating the docs..." $CONTAINER_ENGINE run --rm -it -v "$(pwd)":${CONTAINER_WORKDIR}:Z $CONTAINER_IMAGE sh -c 'scripts/check-asciidoctor-build.sh && python3 build_for_portal.py --distro '${DISTRO}' --product "'"${PRODUCT_NAME}"'" --version '${VERSION}' --no-upstream-fetch && python3 makeBuild.py' +elif [[ "$TEST" == "--validate-incl-api-book" || "$TEST" == "-a" ]]; then + # Clean output folder + rm -rf ./drupal-build + echo "" + echo "🚧 Validating the docs..." + $CONTAINER_ENGINE run --rm -it -v "$(pwd)":${CONTAINER_WORKDIR}${SELINUX_LABEL} $CONTAINER_IMAGE sh -c 'scripts/check-asciidoctor-build.sh && python3 build_for_portal.py --distro '${DISTRO}' --product "'"${PRODUCT_NAME}"'" --version '${VERSION}' --no-upstream-fetch && python3 makeBuild.py --include-api-book' + elif [[ "$TEST" == "--lint-topicmaps" || "$TEST" == "-l" ]]; then echo "" echo "🚧 Linting the topicmap YAML..."