1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00

Add option to include or exclude API book from makeBuild

This commit is contained in:
Aidan Reilly
2024-12-05 13:05:49 +00:00
parent 5de4fb8bf7
commit 6a996206ff
2 changed files with 28 additions and 2 deletions

View File

@@ -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)):

View File

@@ -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..."