Skip to content

bazel/pigz: Allow a pigz on the host, by path - #5605

Merged
phlax merged 1 commit into
envoyproxy:mainfrom
phlax:pigz-host
Nov 14, 2026
Merged

phlax merged 1 commit into
envoyproxy:mainfrom
phlax:pigz-host

Conversation

@phlax

@phlax phlax commented Nov 14, 2026

Copy link
Copy Markdown
Member

pigz_prebuilt_extension.setup(host_path = "/abs/path/pigz") adds a toolchain over that pigz for the host's OS and CPU, after the prebuilts: so it is used where there is no prebuilt (eg macOS), or where the prebuilt is disabled (linux_x86_64_sha256 = ""), rather than requiring a source build or failing.

//pigz then resolves: the prebuilt, the host pigz, a consumer's source toolchain, else the failing fallback (whose message now mentions host_path).

  • The path must be absolute and exist; it is watched, so a change re-evaluates the toolchains.
  • The host must be Linux or macOS on x86_64 or aarch64; otherwise the hub fails with the reason.
  • The hub is not reproducible with a host pigz (repo_metadata).
  • The binary runs wherever the action does (eg with remote execution it must run there) - documented.

Tests: the hub rendering with a host toolchain (after the prebuilts, and alone), and the host OS/CPU mapping.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The host pigz target is rejected during Bazel analysis, the rendering assertion always fails, and toolchain registration incorrectly prioritizes the host over matching prebuilts.

3 open issues
What changed in this PR

Adds a configurable host-installed pigz to Bazel’s compression toolchains, intended as a fallback when no prebuilt is available or the matching prebuilt is disabled.

Changes:

  • Adds setup(host_path = ...) with path validation, file watching, and host platform constraints.
  • Documents host-toolchain usage and remote-execution requirements, and updates the unavailable-toolchain message.
  • Adds rendering and platform-mapping tests and refreshes the extension lockfile entry.
File Description
bazel/​pigz/​toolchain.bzl Mentions host configuration in the fallback error.
bazel/​pigz/​test/​pigz_test.bzl Tests host-toolchain rendering and platform mapping.
bazel/​pigz/​test/​BUILD Registers the host platform-mapping test.
bazel/​pigz/​README.md Documents host setup and intended resolution priority.
bazel/​pigz/​private/​pigz_prebuilt.bzl Validates and links host pigz and generates its toolchain.
bazel/​pigz/​extensions.bzl Exposes and forwards the host_path option.
bazel/​MODULE.bazel.lock Records the updated extension digest and attribute.

Review effort: Balanced

Comment thread bazel/pigz/private/pigz_prebuilt.bzl Resolved
Comment thread bazel/pigz/private/pigz_prebuilt.bzl Resolved
Comment thread bazel/pigz/test/pigz_test.bzl Resolved
`pigz_prebuilt_extension.setup(host_path = "/abs/path/pigz")` adds a
toolchain over that pigz for the host's OS and CPU, after the
prebuilts: so it is used where there is no prebuilt (eg macOS), or
where the prebuilt is disabled, rather than building pigz or failing.

The path must be absolute and exist (it is watched, so a change
re-evaluates the toolchains), and the host must be Linux or macOS on
x86_64 or aarch64; otherwise the hub fails, with the reason. The hub
is not reproducible with a host pigz.

The fallback's failure now points at the option too.

Signed-off-by: Ryan Northey <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the host-installed pigz toolchain support.

No open issues 🎉

3 resolved since last review

Review effort: Balanced

@phlax
phlax merged commit 77185d7 into envoyproxy:main Nov 14, 2026
56 checks passed
phlax added a commit to phlax/toolshed that referenced this pull request Nov 17, 2026
`pigz_prebuilt_extension.setup(host_path = "/abs/path/pigz")` adds a
toolchain over that pigz for the host's OS and CPU, after the
prebuilts: so it is used where there is no prebuilt (eg macOS), or
where the prebuilt is disabled, rather than building pigz or failing.

The path must be absolute and exist (it is watched, so a change
re-evaluates the toolchains), and the host must be Linux or macOS on
x86_64 or aarch64; otherwise the hub fails, with the reason. The hub
is not reproducible with a host pigz.

The fallback's failure now points at the option too.

Backport note (workspace): the path is set with `setup_pigz(host_path = ...)`. The prebuilts are
not configurable here, so a prebuilt for the host always takes precedence.

(cherry picked from commit 77185d7)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/toolshed that referenced this pull request Nov 17, 2026
`pigz_prebuilt_extension.setup(host_path = "/abs/path/pigz")` adds a
toolchain over that pigz for the host's OS and CPU, after the
prebuilts: so it is used where there is no prebuilt (eg macOS), or
where the prebuilt is disabled, rather than building pigz or failing.

The path must be absolute and exist (it is watched, so a change
re-evaluates the toolchains), and the host must be Linux or macOS on
x86_64 or aarch64; otherwise the hub fails, with the reason. The hub
is not reproducible with a host pigz.

The fallback's failure now points at the option too.

Backport note (workspace): the path is set with `setup_pigz(host_path = ...)`. The prebuilts are
not configurable here, so a prebuilt for the host always takes precedence.

(cherry picked from commit 77185d7)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/toolshed that referenced this pull request Nov 17, 2026
`pigz_prebuilt_extension.setup(host_path = "/abs/path/pigz")` adds a
toolchain over that pigz for the host's OS and CPU, after the
prebuilts: so it is used where there is no prebuilt (eg macOS), or
where the prebuilt is disabled, rather than building pigz or failing.

The path must be absolute and exist (it is watched, so a change
re-evaluates the toolchains), and the host must be Linux or macOS on
x86_64 or aarch64; otherwise the hub fails, with the reason. The hub
is not reproducible with a host pigz.

The fallback's failure now points at the option too.

Backport note (workspace): the path is set with `setup_pigz(host_path = ...)`. The prebuilts are
not configurable here, so a prebuilt for the host always takes precedence.

(cherry picked from commit 77185d7)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/toolshed that referenced this pull request Nov 17, 2026
`pigz_prebuilt_extension.setup(host_path = "/abs/path/pigz")` adds a
toolchain over that pigz for the host's OS and CPU, after the
prebuilts: so it is used where there is no prebuilt (eg macOS), or
where the prebuilt is disabled, rather than building pigz or failing.

The path must be absolute and exist (it is watched, so a change
re-evaluates the toolchains), and the host must be Linux or macOS on
x86_64 or aarch64; otherwise the hub fails, with the reason. The hub
is not reproducible with a host pigz.

The fallback's failure now points at the option too.

Backport note (workspace): the path is set with `setup_pigz(host_path = ...)`. The prebuilts are
not configurable here, so a prebuilt for the host always takes precedence.

(cherry picked from commit 77185d7)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/toolshed that referenced this pull request Nov 17, 2026
`pigz_prebuilt_extension.setup(host_path = "/abs/path/pigz")` adds a
toolchain over that pigz for the host's OS and CPU, after the
prebuilts: so it is used where there is no prebuilt (eg macOS), or
where the prebuilt is disabled, rather than building pigz or failing.

The path must be absolute and exist (it is watched, so a change
re-evaluates the toolchains), and the host must be Linux or macOS on
x86_64 or aarch64; otherwise the hub fails, with the reason. The hub
is not reproducible with a host pigz.

The fallback's failure now points at the option too.

Backport note (workspace): the path is set with `setup_pigz(host_path = ...)`. The prebuilts are
not configurable here, so a prebuilt for the host always takes precedence.

(cherry picked from commit 77185d7)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/toolshed that referenced this pull request Nov 17, 2026
…allow the libcxx LLVM version to be set

Port `//oci` (`oci_base_edit`), `//pigz` and `//tarball:compressed_tar.bzl` from `main` at
bazel-v0.5.22, so Envoy's WORKSPACE release branches (`release/v1.39` and earlier) can build their
release container images with rules_oci and gzip the packages with all the cores, as `main` and
`release/v1.40` do.

Backported, with what differs from `main`:

- envoyproxy#5597 `oci_base_edit`: as on `main`.
- envoyproxy#5601 hermetic pigz: the toolchain and the prebuilt repositories only. `setup_pigz()` and
`load_pigz_toolchains()` (`//pigz:repositories.bzl`) replace the module extension, as `//pgp` does
for `sq`, and this repo's `WORKSPACE` calls both. The source build and its packaging stay on
`main`, which publishes the prebuilts. The README describes them as `main` now builds them (against
zlib-ng, envoyproxy#5606, which has nothing else to backport here). `repository_ctx.repo_metadata` is only
called where Bazel has it: Envoy's `release/v1.38` and earlier use Bazel 7.
- envoyproxy#5605 a pigz on the host, by path: `setup_pigz(host_path = ...)`. The prebuilts are not
configurable here, so a prebuilt for the host always takes precedence.
- envoyproxy#5607 `compressed_tar`: as on `main`. zstd uses the consumer's `@zstd` (Envoy has one; this
branch's toolshed does not), so only gzip is tested here, on Linux only.

Also, not a backport: `setup_libcxx_libs(llvm_version = ...)`. The libc++ bundles for
cross-compiling are fetched for toolshed's LLVM (22.1.8), but Envoy's `release/v1.39` and earlier
compile with LLVM 18.1.8, so a cross-compile there (arm64 from x64, as the one-job release build
does) gets LLVM 18's headers with LLVM 22's `__config_site` and fails. The option selects the
bundles of the consumer's LLVM, from the bins release that published them (0.1.59 for 18.1.8).

The prebuilt hashes (`VERSIONS["pigz_sha256"]`) are empty, as in envoyproxy#5601, for the release preparation
to set: the `_release.yml` step that does that comes with envoyproxy#5601 too. This branch has no source
toolchain to fall back to, so `//pigz` is `manual` (there is no pigz without a prebuilt for the
platform), and the tests that run it are `manual` until the hashes are set.

(cherry picked from commit 0dbd94a)
(cherry picked from commit fc8e06e)
(cherry picked from commit 77185d7)
(cherry picked from commit 49947f3)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit that referenced this pull request Nov 17, 2026
`pigz_prebuilt_extension.setup(host_path = "/abs/path/pigz")` adds a
toolchain over that pigz for the host's OS and CPU, after the
prebuilts: so it is used where there is no prebuilt (eg macOS), or
where the prebuilt is disabled, rather than building pigz or failing.

The path must be absolute and exist (it is watched, so a change
re-evaluates the toolchains), and the host must be Linux or macOS on
x86_64 or aarch64; otherwise the hub fails, with the reason. The hub
is not reproducible with a host pigz.

The fallback's failure now points at the option too.

Backport note (workspace): the path is set with `setup_pigz(host_path = ...)`. The prebuilts are
not configurable here, so a prebuilt for the host always takes precedence.

(cherry picked from commit 77185d7)
Signed-off-by: Ryan Northey <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants