Skip to content

Commit 853dd9d

Browse files
authored
Merge pull request #85851 from aireilly/validate_rest_api_books
Add option to include API book in Prow smoke test and makeBuild
2 parents 57af5b6 + 1f57ea0 commit 853dd9d

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

makeBuild.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
# uses a refactored Aura script which is an opensource port of ccutil
55

6+
import argparse
67
import sys
78
import os
89
import logging
@@ -19,6 +20,15 @@
1920

2021
#print(branch)
2122

23+
def setup_parser():
24+
parser = argparse.ArgumentParser(
25+
formatter_class=argparse.ArgumentDefaultsHelpFormatter
26+
)
27+
parser.add_argument(
28+
"--include-api-book", help="Include the rest_api book in the build", action="store_true", default=False,
29+
)
30+
return parser
31+
2232
# function to convert XML ids to HTML 4 compatible ids from ccutil
2333
def _fix_ids_for_html4(tree):
2434
"""
@@ -122,6 +132,10 @@ def build_book(book):
122132
# Initialize logging
123133
cli.init_logging(False, False)
124134

135+
136+
parser = setup_parser()
137+
args = parser.parse_args()
138+
125139
for distro in os.listdir("drupal-build"):
126140

127141
print("---------------------------------------")
@@ -136,7 +150,9 @@ def build_book(book):
136150
continue
137151
# rest api book is a pain and doesn't convert well
138152
if book == "rest_api":
139-
continue
153+
# Exclude the REST API book unless we explicitly require it
154+
if not args.include_api_book:
155+
continue
140156

141157
if os.path.exists(os.path.join("drupal-build", distro, book,"hugeBook.flag")):
142158
for secondary_book in os.listdir(os.path.join("drupal-build", distro, book)):

scripts/prow-smoke-test.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111
#%
1212
#%OPTIONS ⚙️
1313
#% -v, --validate $DISTRO Validate the AsciiDoc source. Use --validate to run with default options
14+
#% -a, --validate-incl-api-book Validate the AsciiDoc source and include the REST API books
1415
#% -l, --lint-topicmaps Lint topic-map YAML
1516
#% -p, --preview $DISTRO "$PRODUCT_NAME" $VERSION Use --preview to run with default options
1617
#% -h, --help Print this help
1718
#%
1819
#%EXAMPLES 🤔
1920
#% ./scripts/prow-smoke-test.sh --validate
2021
#% ./scripts/prow-smoke-test.sh --validate openshift-rosa
22+
#% ./scripts/prow-smoke-test.sh --validate-incl-api-book
2123
#% ./scripts/prow-smoke-test.sh --lint-topicmaps
2224
#% ./scripts/prow-smoke-test.sh --preview
2325
#% ./scripts/prow-smoke-test.sh --preview openshift-rosa
@@ -96,6 +98,13 @@ elif [[ "$TEST" == "--validate" || "$TEST" == "-v" ]]; then
9698
echo "🚧 Validating the docs..."
9799
$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'
98100

101+
elif [[ "$TEST" == "--validate-incl-api-book" || "$TEST" == "-a" ]]; then
102+
# Clean output folder
103+
rm -rf ./drupal-build
104+
echo ""
105+
echo "🚧 Validating the docs..."
106+
$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'
107+
99108
elif [[ "$TEST" == "--lint-topicmaps" || "$TEST" == "-l" ]]; then
100109
echo ""
101110
echo "🚧 Linting the topicmap YAML..."

0 commit comments

Comments
 (0)