Skip to content

[WIP] build/artefacts: Use zstd where possible #29780

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
8 changes: 5 additions & 3 deletions docs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ pkg_tar(
pkg_tar(
name = "rst",
srcs = [":rst_files"],
extension = "tar.gz",
compressor = "//tools/zstd",
compressor_args = "-T0",
extension = "tar.zst",
deps = [
":api_rst",
":empty_protos_rst",
Expand All @@ -245,7 +247,7 @@ pkg_tar(
# TODO(phlax): Add `envoy_sphinx` rule to encapsulate these and above targets
genrule(
name = "html_release",
outs = ["html_release.tar.gz"],
outs = ["html_release.tar.zst"],
cmd = """
. $(location //bazel:volatile_env) \
&& $(location //tools/docs:sphinx_runner) \
Expand All @@ -270,7 +272,7 @@ genrule(
# No git stamping, speeds up local dev switching branches
genrule(
name = "html",
outs = ["html.tar.gz"],
outs = ["html.tar.zst"],
cmd = """
$(location //tools/docs:sphinx_runner) \
$${SPHINX_RUNNER_ARGS:-} \
Expand Down
15 changes: 11 additions & 4 deletions docs/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ fi
if [[ "${BUILD_TYPE}" == "html" ]] || [[ -n "${DOCS_BUILD_HTML}" ]]; then
BUILD_HTML=1
BUILD_HTML_TARGET="//docs:html"
BUILD_HTML_TARBALL="bazel-bin/docs/html.tar.gz"
BUILD_HTML_TARBALL="bazel-bin/docs/html.tar.zst"
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"
BUILD_HTML_TARBALL="bazel-bin/docs/html_release.tar.zst"
fi
fi
if [[ "${BUILD_TYPE}" == "rst" ]] || [[ -n "${DOCS_BUILD_RST}" ]]; then
Expand All @@ -69,10 +69,17 @@ fi
rm -rf "${DOCS_OUTPUT_DIR}"
mkdir -p "${DOCS_OUTPUT_DIR}"

BUILD_HTML_TARBALL="$(realpath "${BUILD_HTML_TARBALL}")"

# Save html/rst to output directory
if [[ -n "${BUILD_HTML}" ]]; then
tar -xzf "$BUILD_HTML_TARBALL" -C "$DOCS_OUTPUT_DIR"
bazel "${BAZEL_STARTUP_OPTIONS[@]}" run \
"${BAZEL_BUILD_OPTIONS[@]}" \
//tools/zstd \
-- --stdout \
-d "$BUILD_HTML_TARBALL" | tar --warning=no-timestamp -xf - -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
cp bazel-bin/docs/rst.tar.zst "$DOCS_OUTPUT_DIR"/envoy-docs-rst.tar.zst
fi
2 changes: 1 addition & 1 deletion tools/base/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ envoy.dependency.check>=0.1.7
envoy.distribution.release>=0.0.9
envoy.distribution.repo>=0.0.8
envoy.distribution.verify>=0.0.11
envoy.docs.sphinx_runner>=0.2.7
envoy.docs.sphinx_runner>=0.2.8
envoy.gpg.identity>=0.1.1
envoy.gpg.sign>=0.2.0
flake8>=6
Expand Down
6 changes: 3 additions & 3 deletions tools/base/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,9 @@ envoy-distribution-verify==0.0.11 \
envoy-docker-utils==0.0.2 \
--hash=sha256:a12cb57f0b6e204d646cbf94f927b3a8f5a27ed15f60d0576176584ec16a4b76
# via envoy-distribution-distrotest
envoy-docs-sphinx-runner==0.2.7 \
--hash=sha256:093a53b20c4818354e156c459beb81ef9da607e8aa7fb87d0118ccd7332ff87c \
--hash=sha256:da659d446be6433da909e91ed6a2feca9c2cb9a97b10a1f01b67cca8678df63e
envoy-docs-sphinx-runner==0.2.8 \
--hash=sha256:129db23430fd3fae3cf62fda74b9479c6880698fef46f895058c98f1f3cf8e20 \
--hash=sha256:736cc88874bdf42778cec02648fcbd82971154d38618b3699e17c049bdec74c9
# via -r requirements.in
envoy-github-abstract==0.0.22 \
--hash=sha256:2dd65e2f247a4947d0198b295c82716c13162e30c433b7625c27d59eee7bcf78 \
Expand Down