Skip to content

Commit affd793

Browse files
Internal change
PiperOrigin-RevId: 922850859
1 parent 76b61ae commit affd793

4 files changed

Lines changed: 64 additions & 11 deletions

File tree

.bazelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,7 @@ build:windows --google_default_credentials=true
3232
build:macos --remote_cache=https://storage.googleapis.com/macos-cel-python-remote-cache
3333
build:macos --google_default_credentials=true
3434

35+
# Silence deprecation warnings from external dependencies (Linux and macOS)
36+
build:linux --cxxopt=-Wno-deprecated-declarations
37+
build:macos --cxxopt=-Wno-deprecated-declarations
38+

release/kokoro/release_linux.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@
33

44
build_file: "cel-python/release/kokoro/release_linux.sh"
55
timeout_mins: 120
6+
7+
container_properties {
8+
docker_image: "us-central1-docker.pkg.dev/kokoro-container-bakery/kokoro/ubuntu/ubuntu2204/ktcb:current"
9+
docker_privileged: true
10+
}

release/kokoro/release_linux.sh

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,53 @@
11
#!/bin/bash
2+
# Copyright 2026 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
216
set -e
317

18+
# Avoid virtualenv/pip trying to download/upgrade tools from PyPI on host
19+
export VIRTUALENV_NO_DOWNLOAD=1
20+
export PIP_DISABLE_PIP_VERSION_CHECK=1
21+
22+
# Pass these environment variables to the cibuildwheel Docker container
23+
export CIBW_ENVIRONMENT="VIRTUALENV_NO_DOWNLOAD=1 PIP_DISABLE_PIP_VERSION_CHECK=1"
24+
export CIBW_DEPENDENCY_VERSIONS="latest"
25+
426
# If running locally (not on Kokoro), authenticate with gcloud.
527
if [ -z "${KOKORO_BUILD_ID}" ]; then
628
if ! gcloud auth application-default print-access-token --quiet > /dev/null; then
729
gcloud auth application-default login
830
fi
931
fi
1032

11-
pip install -U keyring keyrings.google-artifactregistry-auth twine cibuildwheel
33+
# We use --no-cache-dir to force pip to download packages fresh and bypass the local
34+
# cache. In Kokoro/RBE sandboxed environments, writing to the default cache directory
35+
# (~/.cache/pip) can encounter permission/sandbox restrictions or lead to stale
36+
# dependency resolution. Disabling the cache ensures a reliable, reproducible install.
37+
pip install --no-cache-dir -U keyring keyrings.google-artifactregistry-auth twine cibuildwheel
38+
39+
REPO_DIR=""
40+
TMP_DIR=""
41+
cleanup() {
42+
echo "Cleaning up temporary directories..."
43+
[ -n "${REPO_DIR}" ] && rm -rf "${REPO_DIR}"
44+
[ -n "${TMP_DIR}" ] && rm -rf "${TMP_DIR}"
45+
}
46+
trap cleanup EXIT
1247

1348
REPO_DIR=$(mktemp -d)
1449
echo "Created temporary directory: ${REPO_DIR}"
1550

16-
# Ensure the temporary directory is removed on script exit
17-
trap 'echo "Cleaning up temporary directory: ${REPO_DIR}"; rm -rf "${REPO_DIR}"' EXIT
18-
1951
if [ "${DRY_RUN}" = "true" ]; then
2052
echo "[DRY RUN] Using local Kokoro clone instead of cloning main."
2153
SRC_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
@@ -43,25 +75,30 @@ echo "Building release for version: ${VERSION}"
4375
TMP_DIR=$(mktemp -d)
4476
echo "Build directory: ${TMP_DIR}"
4577

46-
# Add trap cleanup for TMP_DIR as well
47-
trap 'echo "Cleaning up temporary directories: ${REPO_DIR} ${TMP_DIR}"; rm -rf "${REPO_DIR}" "${TMP_DIR}"' EXIT
48-
4978
pushd "${TMP_DIR}"
5079

5180
cp -r "${SRC_DIR}"/{*,.*} . 2>/dev/null || true
5281
cp -r "${SRC_DIR}"/release/* . 2>/dev/null || true
5382
rm -rf cel_expr_python/*_test.py
5483

84+
echo "Downloading bazelisk on host..."
85+
curl -LO https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-amd64
86+
chmod +x bazelisk-linux-amd64
87+
5588
# Check if pyproject.toml exists before running sed
5689
if [ -f pyproject.toml ]; then
5790
sed -i "" "s/\$VERSION/${VERSION}/g" pyproject.toml || sed -i "s/\$VERSION/${VERSION}/g" pyproject.toml
5891
fi
5992

60-
echo "Running cibuildwheel: ${CIBWHEEL_BIN}"
93+
export CIBW_CONTAINER_ENGINE_EXTRA_ARGS="--network=host"
94+
95+
echo "Running cibuildwheel..."
6196
# Default CIBWHEEL_BIN if not set
6297
if [ -z "${CIBWHEEL_BIN}" ]; then
6398
CIBWHEEL_BIN="python3 -m cibuildwheel"
6499
fi
100+
101+
# Run cibuildwheel synchronously. Output goes directly to the console in real-time.
65102
${CIBWHEEL_BIN} --platform linux --output-dir dist
66103

67104
if [ "${DRY_RUN}" = "true" ]; then

release/pyproject.toml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,20 @@ where = ["."]
3838
exclude = ["codelab*", "conformance*", "custom_ext*", "release*", "testing*", "wheelhouse*"]
3939

4040
[tool.cibuildwheel]
41-
build = "cp311-* cp312-* cp313-* cp314-*"
42-
skip = "*musllinux* *win32*"
41+
build = "cp311-*"
42+
#build = "cp311-* cp312-* cp313-* cp314-*"
43+
skip = "*musllinux* *win32* *i686*"
4344
test-command = "python {project}/cel_basic_test.py"
4445
build-verbosity = 1
4546

4647
[tool.cibuildwheel.linux]
47-
before-all = "echo 'Installing bazelisk'; curl -LO https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-amd64 && chmod +x bazelisk-linux-amd64 && mv bazelisk-linux-amd64 /usr/local/bin/bazel"
48+
manylinux-x86_64-image = "manylinux_2_28"
49+
# Google's internal Kokoro/RBE network uses a secure MITM proxy that resigns HTTPS
50+
# traffic with an internal Google CA. Since the public manylinux container does not
51+
# trust this CA, git fetches for external dependencies (like @cel-cpp) will fail
52+
# with SSL certificate errors. We disable http.sslVerify inside the container to
53+
# bypass this and allow Bazel to fetch SCM dependencies through the proxy.
54+
before-all = "git config --global http.sslVerify false && echo 'Installing bazelisk' && cp {project}/bazelisk-linux-amd64 /usr/local/bin/bazel"
4855

4956
[tool.cibuildwheel.macos]
5057
before-all = "echo 'Installing bazelisk'; brew install bazelisk"

0 commit comments

Comments
 (0)