-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: Improve builds for Envoy and mobile (stamping) #29887
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
# set SPHINX_SKIP_CONFIG_VALIDATION environment variable to true to skip | ||
# validation of configuration examples | ||
|
||
set -e | ||
|
||
|
||
if [[ ! $(command -v bazel) ]]; then | ||
# shellcheck disable=SC2016 | ||
echo 'ERROR: bazel must be installed and available in "$PATH" to build docs' >&2 | ||
exit 1 | ||
fi | ||
|
||
VERSION="$(cat VERSION.txt)" | ||
MAIN_BRANCH="refs/heads/main" | ||
DEV_VERSION_REGEX="-dev$" | ||
|
||
# default is to build html only | ||
BUILD_TYPE=html | ||
|
||
if [[ "$VERSION" =~ $DEV_VERSION_REGEX ]]; then | ||
if [[ "$CI_BRANCH" == "$MAIN_BRANCH" ]]; then | ||
# no need to build html, just rst | ||
BUILD_TYPE=rst | ||
fi | ||
else | ||
export BUILD_DOCS_TAG="v${VERSION}" | ||
echo "BUILD AZP RELEASE BRANCH ${BUILD_DOCS_TAG}" | ||
BAZEL_BUILD_OPTIONS+=("--action_env=BUILD_DOCS_TAG") | ||
fi | ||
|
||
# This is for local RBE setup, should be no-op for builds without RBE setting in bazelrc files. | ||
IFS=" " read -ra BAZEL_BUILD_OPTIONS <<< "${BAZEL_BUILD_OPTION_LIST:-}" | ||
IFS=" " read -ra BAZEL_STARTUP_OPTIONS <<< "${BAZEL_STARTUP_OPTION_LIST:-}" | ||
|
||
# We want the binary at the end | ||
BAZEL_BUILD_OPTIONS+=(--remote_download_toplevel) | ||
|
||
if [[ -n "${CI_TARGET_BRANCH}" ]] || [[ -n "${SPHINX_QUIET}" ]]; then | ||
export SPHINX_RUNNER_ARGS="-v warn" | ||
BAZEL_BUILD_OPTIONS+=("--action_env=SPHINX_RUNNER_ARGS") | ||
fi | ||
|
||
# Building html/rst is determined by then needs of CI but can be overridden in dev. | ||
if [[ "${BUILD_TYPE}" == "html" ]] || [[ -n "${DOCS_BUILD_HTML}" ]]; then | ||
BUILD_HTML=1 | ||
BUILD_HTML_TARGET="//docs" | ||
BUILD_HTML_TARBALL="bazel-bin/docs/html.tar.gz" | ||
if [[ -n "${CI_BRANCH}" ]] || [[ -n "${DOCS_BUILD_RELEASE}" ]]; then | ||
# CI build - use git sha | ||
BUILD_HTML_TARGET="//docs:html_release" | ||
BUILD_HTML_TARBALL="bazel-bin/docs/html_release.tar.gz" | ||
fi | ||
fi | ||
if [[ "${BUILD_TYPE}" == "rst" ]] || [[ -n "${DOCS_BUILD_RST}" ]]; then | ||
BUILD_RST=1 | ||
fi | ||
|
||
# Build html/rst | ||
if [[ -n "${BUILD_RST}" ]]; then | ||
bazel "${BAZEL_STARTUP_OPTIONS[@]}" build "${BAZEL_BUILD_OPTIONS[@]}" //docs:rst | ||
fi | ||
if [[ -n "${BUILD_HTML}" ]]; then | ||
bazel "${BAZEL_STARTUP_OPTIONS[@]}" build "${BAZEL_BUILD_OPTIONS[@]}" "$BUILD_HTML_TARGET" | ||
fi | ||
|
||
[[ -z "${DOCS_OUTPUT_DIR}" ]] && DOCS_OUTPUT_DIR=generated/docs | ||
rm -rf "${DOCS_OUTPUT_DIR}" | ||
mkdir -p "${DOCS_OUTPUT_DIR}" | ||
|
||
# Save html/rst to output directory | ||
if [[ -n "${BUILD_HTML}" ]]; then | ||
tar -xzf "$BUILD_HTML_TARBALL" -C "$DOCS_OUTPUT_DIR" | ||
fi | ||
if [[ -n "${BUILD_RST}" ]]; then | ||
cp bazel-bin/docs/rst.tar.gz "$DOCS_OUTPUT_DIR"/envoy-docs-rst.tar.gz | ||
fi | ||
# shellcheck disable=SC2016 | ||
echo 'This script has been removed. Please use `ci/do_ci.sh docs` instead' >&2 | ||
exit 1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,11 +48,11 @@ def setup(app): | |
app.add_directive('substitution-code-block', SubstitutionCodeBlock) | ||
|
||
|
||
if not os.environ.get('ENVOY_DOCS_RELEASE_LEVEL'): | ||
if not (release_level := os.environ.get('ENVOY_DOCS_RELEASE_LEVEL')): | ||
raise Exception("ENVOY_DOCS_RELEASE_LEVEL env var must be defined") | ||
|
||
release_level = os.environ['ENVOY_DOCS_RELEASE_LEVEL'] | ||
blob_sha = os.environ['ENVOY_BLOB_SHA'] | ||
if not (blob_sha := os.environ.get("ENVOY_BLOB_SHA")): | ||
raise Exception("ENVOY_BLOB_SHA env var must be defined") | ||
|
||
# If extensions (or modules to document with autodoc) are in another directory, | ||
# add these directories to sys.path here. If the directory is relative to the | ||
|
@@ -103,13 +103,12 @@ def setup(app): | |
# |version| and |release|, also used in various other places throughout the | ||
# built documents. | ||
|
||
if not os.environ.get('ENVOY_DOCS_VERSION_STRING'): | ||
# The short X.Y version. | ||
if not (version := os.environ.get("ENVOY_DOCS_VERSION_STRING")): | ||
raise Exception("ENVOY_DOCS_VERSION_STRING env var must be defined") | ||
|
||
# The short X.Y version. | ||
version = os.environ['ENVOY_DOCS_VERSION_STRING'] | ||
# The full version, including alpha/beta/rc tags. | ||
release = os.environ['ENVOY_DOCS_VERSION_STRING'] | ||
release = version | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems there's a mismatch between the description (comment) of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there are too many vars here - in this PR im doing the minimum to get things working but happy to remove some of this superflous code in a follow up fwiw - in a follow up - this will no longer happen here anyway i think - at least in relation to publishing (rather than testing) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm actually realizing this is the code that will be triggered still - so this wont be moved - but it is my intention to clean this up There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SGTM. |
||
|
||
# The language for content autogenerated by Sphinx. Refer to documentation | ||
# for a list of supported languages. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will/can the script fail if it is not set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah it will - bazel enforces set env vars so it fails
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(ditto re too many vars)