Skip to content

Support recent versions of Bazel in build-tools containers.#531

Open
PiotrSikora wants to merge 1 commit intoproxy-wasm:mainfrom
PiotrSikora:build-tools-next
Open

Support recent versions of Bazel in build-tools containers.#531
PiotrSikora wants to merge 1 commit intoproxy-wasm:mainfrom
PiotrSikora:build-tools-next

Conversation

@PiotrSikora
Copy link
Member

While there, increase the jobs count and memory limit.

Tested with Bazel v7.7.1, v8.5.1, v8.6.0 and v9.0.1.

While there, increase the jobs count and memory limit.

Tested with Bazel v7.7.1, v8.5.1, v8.6.0 and v9.0.1.

Signed-off-by: Piotr Sikora <code@piotrsikora.dev>
@PiotrSikora
Copy link
Member Author

cc @mmorel-35

--jobs=1 \
--local_ram_resources=2048 \
--jobs=HOST_CPUS*.5 \
--local_resources=memory=8192 \
Copy link
Contributor

Choose a reason for hiding this comment

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

HOST_RAM*.5?

Copy link
Member Author

Choose a reason for hiding this comment

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

To be honest, I don't think there is a good reason to keep memory usage limited at all, since the crashes / hangs were all happening because of bugs in QEMU CPU emulation and some race conditions there... On the other hand, it doesn't feel like Bazel should require more than 8 GiB RAM to build itself.

# For Bazel v7.7.1 - patch MODULE.bazel and tools/cpp/unix_cc_configure.bzl to:
# - Force bazel_features v1.11.0 (avoids bzlmod macro requirement during bootstrap)
# - Configure C++ toolchain compilation flags to avoid GCC segmentation faults on s390x under QEMU emulation
COPY bazel/external/bazel-v7.7.1.patch /tmp/bazel-v7.7.1.patch
Copy link
Contributor

@mmorel-35 mmorel-35 Mar 19, 2026

Choose a reason for hiding this comment

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

Can you use ARG BAZEL_VERSION to do COPY "bazel/external/bazel-v${BAZEL_VERSION}.patch" /tmp/bazel.patch this will make Dockerfile version agnostic

And use only the patch you need

Copy link
Member Author

Choose a reason for hiding this comment

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

Does COPY work with non-existing files (we only have patches for v7.7.1 and v9.0.1, but not for 8.x)?

Alternatively, we could just COPY bazel/external/bazel-*.patch /tmp/ and be done with it...

Copy link
Contributor

Choose a reason for hiding this comment

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

That might work.

I'm also wondering if it would be better to have a dedicated project to build this image. Then have branches per bazel major version

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.

3 participants