Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions docs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ licenses(["notice"]) # Apache 2
exports_files([
"protodoc_manifest.yaml",
"v2_mapping.json",
"redirects.txt",
])

envoy_package()
Expand Down Expand Up @@ -44,3 +45,20 @@ filegroup(
],
),
)

genrule(
name = "v2_redirects",
outs = ["v2_redirects.txt"],
cmd = "jq -r 'with_entries(.key |= sub(\"^envoy/\";\"api-v3/\")) | with_entries(.value |= sub(\"^envoy/\";\"api-v2/\")) | to_entries[] | \"\\(.value)\t\t\\(.key)\"' docs/v2_mapping.json > $@",
tools = ["//docs:v2_mapping.json"],
)

genrule(
name = "redirects",
outs = ["envoy-redirects.txt"],
cmd = "cat $(location //docs:redirects.txt) > $@ && cat $(location :v2_redirects) >> $@",
tools = [
":redirects.txt",
":v2_redirects",
],
)
6 changes: 3 additions & 3 deletions docs/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ rsync -av \
"${SCRIPT_DIR}"/_ext \
"${GENERATED_RST_DIR}"

bazel build "${BAZEL_BUILD_OPTIONS[@]}" //docs:redirects

# TODO(phlax): once all of above jobs are moved to bazel build genrules these can be done as part of the sphinx build
tar -xf bazel-bin/tools/docs/extensions_security_rst.tar -C "${GENERATED_RST_DIR}"
tar -xf bazel-bin/tools/docs/external_deps_rst.tar -C "${GENERATED_RST_DIR}"

# Merge generated redirects
jq -r 'with_entries(.key |= sub("^envoy/";"api-v3/")) | with_entries(.value |= sub("^envoy/";"api-v2/")) | to_entries[] | "\(.value)\t\t\(.key)"' docs/v2_mapping.json >> "${GENERATED_RST_DIR}"/redirects.txt
cp -a bazel-bin/docs/envoy-redirects.txt "${GENERATED_RST_DIR}"

# To speed up validate_fragment invocations in validating_code_block
bazel build "${BAZEL_BUILD_OPTIONS[@]}" //tools/config_validation:validate_fragment
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def setup(app):
# TODO(phlax): add redirect diff (`rediraffe_branch` setting)
# - not sure how diffing will work with main merging in PRs - might need
# to be injected dynamically, somehow
rediraffe_redirects = "redirects.txt"
rediraffe_redirects = "envoy-redirects.txt"

intersphinx_mapping = {
'v1.5.0': ('https://www.envoyproxy.io/docs/envoy/v1.5.0', None),
Expand Down