From e01cbd160790df002605992793c7bdbe7490a2fa Mon Sep 17 00:00:00 2001 From: Ryan Northey Date: Fri, 22 Sep 2023 20:29:11 +0100 Subject: [PATCH] build/artefacts: Use zstd where possible Signed-off-by: Ryan Northey --- docs/BUILD | 8 +++++--- docs/build.sh | 15 +++++++++++---- tools/base/requirements.in | 2 +- tools/base/requirements.txt | 6 +++--- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/docs/BUILD b/docs/BUILD index 555ce065e1d9..3d426d209aa0 100644 --- a/docs/BUILD +++ b/docs/BUILD @@ -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", @@ -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) \ @@ -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:-} \ diff --git a/docs/build.sh b/docs/build.sh index 110aa22ebec5..398f47e13660 100755 --- a/docs/build.sh +++ b/docs/build.sh @@ -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 @@ -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 diff --git a/tools/base/requirements.in b/tools/base/requirements.in index 8d3b3effd0d2..b7e471a22cbe 100644 --- a/tools/base/requirements.in +++ b/tools/base/requirements.in @@ -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 diff --git a/tools/base/requirements.txt b/tools/base/requirements.txt index d97b57752a90..d8bd7112e625 100644 --- a/tools/base/requirements.txt +++ b/tools/base/requirements.txt @@ -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 \