bazel: provide semi-hermetic python toolchain (#1753)

The actual python version used in bazel is hermetic after this PR.
However, we still require a host python toolchain for bootstrapping (this will be fixed soon upstream) and host wide glibc (+ libcrypt.so.1).
This commit is contained in:
Malte Poll 2023-05-22 09:10:41 +02:00 committed by GitHub
parent 87b9d85669
commit ab257944f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 0 deletions

View File

@ -1,3 +1,17 @@
# Python toolchain
load("//bazel/toolchains:python_deps.bzl", "python_deps")
python_deps()
load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains")
py_repositories()
python_register_toolchains(
name = "python3_11",
python_version = "3.11",
)
# Go toolchain
load("//bazel/toolchains:go_rules_deps.bzl", "go_deps")

View File

@ -16,6 +16,8 @@ RUN chmod +x /usr/local/bin/bazelisk && \
dnf install -y \
git \
diffutils \
libxcrypt-compat \
python3 \
&& \
dnf clean all && \
groupadd --gid 1000 builder && \

View File

@ -0,0 +1,15 @@
"""python toolchain rules"""
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def python_deps():
http_archive(
name = "rules_python",
sha256 = "94750828b18044533e98a129003b6a68001204038dc4749f40b195b24c38f49f",
strip_prefix = "rules_python-0.21.0",
urls = [
"https://cdn.confidential.cloud/constellation/cas/sha256/94750828b18044533e98a129003b6a68001204038dc4749f40b195b24c38f49f",
"https://github.com/bazelbuild/rules_python/releases/download/0.21.0/rules_python-0.21.0.tar.gz",
],
type = "tar.gz",
)