Skip to content

Commit d2dec76

Browse files
dmitriplotnikovcopybara-github
authored andcommitted
No public description
PiperOrigin-RevId: 936185160
1 parent 584be4f commit d2dec76

4 files changed

Lines changed: 55 additions & 4 deletions

File tree

.bazelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ common:windows --experimental_repository_downloader_retries=10
2828
build --verbose_failures
2929
test --test_output=errors
3030

31+
# GCS remote caching config (Linux-only, active by default on Linux)
32+
build:linux --remote_cache=https://storage.googleapis.com/linux-cel-python-remote-cache
33+
build:linux --google_default_credentials=true
34+
build:linux --remote_upload_local_results=false
35+
3136
# GCS remote caching config (Windows-only, active by default on Windows!)
3237
build:windows --remote_cache=https://storage.googleapis.com/windows-cel-python-remote-cache
3338
build:windows --google_default_credentials=true

release/kokoro/release_linux.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ build_file: "cel-python/release/kokoro/release_linux.sh"
55
timeout_mins: 120
66

77
container_properties {
8-
docker_image: "us-central1-docker.pkg.dev/kokoro-container-bakery/kokoro/ubuntu/ubuntu2204/ktcb:current"
8+
docker_image: "mirror.gcr.io/library/ubuntu:22.04"
99
docker_sibling_containers: true
1010
}

release/kokoro/release_linux.sh

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,41 @@
1515

1616
set -e
1717

18+
# Install dependencies if running in a bare container
19+
if ! command -v pip3 &> /dev/null || ! command -v curl &> /dev/null || ! command -v docker &> /dev/null; then
20+
echo "Installing basic dependencies..."
21+
apt-get update && apt-get install -y python3-pip curl
22+
23+
if ! command -v docker &> /dev/null; then
24+
echo "Installing docker CLI..."
25+
ARCH=$(uname -m)
26+
if [ "$ARCH" = "x86_64" ]; then
27+
DOCKER_ARCH="x86_64"
28+
elif [ "$ARCH" = "aarch64" ]; then
29+
DOCKER_ARCH="aarch64"
30+
else
31+
echo "Unsupported arch: $ARCH"
32+
exit 1
33+
fi
34+
curl -fsSL "https://download.docker.com/linux/static/stable/${DOCKER_ARCH}/docker-24.0.7.tgz" -o docker.tgz
35+
tar xzvf docker.tgz --strip-components=1 docker/docker
36+
mv docker /usr/local/bin/
37+
rm -f docker.tgz
38+
fi
39+
fi
40+
1841
# Avoid virtualenv/pip trying to download/upgrade tools from PyPI on host
1942
export VIRTUALENV_NO_DOWNLOAD=1
2043
export PIP_DISABLE_PIP_VERSION_CHECK=1
2144

45+
if [ "$(uname -m)" = "aarch64" ]; then
46+
export CIBW_ARCHS="aarch64"
47+
else
48+
export CIBW_ARCHS="x86_64"
49+
fi
50+
2251
# Pass these environment variables to the cibuildwheel Docker container
23-
export CIBW_ENVIRONMENT="VIRTUALENV_NO_DOWNLOAD=1 PIP_DISABLE_PIP_VERSION_CHECK=1"
52+
export CIBW_ENVIRONMENT="VIRTUALENV_NO_DOWNLOAD=1 PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_DEFAULT_TIMEOUT=120"
2453
export CIBW_DEPENDENCY_VERSIONS="latest"
2554
export CIBW_CONTAINER_ENGINE_EXTRA_ARGS="--network=host"
2655

@@ -203,13 +232,26 @@ rm -rf cel_expr_python/*_test.py
203232

204233
echo "Downloading bazelisk on host..."
205234
curl -LO https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-amd64
206-
chmod +x bazelisk-linux-amd64
235+
curl -LO https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-arm64
236+
chmod +x bazelisk-linux-amd64 bazelisk-linux-arm64
237+
238+
echo "Downloading build dependencies on host..."
239+
mkdir -p build_deps
240+
pip download --only-binary=:all: --dest build_deps "setuptools>=40.8.0" "wheel"
241+
if [ "$(uname -m)" = "aarch64" ]; then
242+
PLATFORM_SUFFIX="aarch64"
243+
else
244+
PLATFORM_SUFFIX="x86_64"
245+
fi
246+
pip download --only-binary=:all: --dest build_deps --python-version 3.9 --platform "manylinux2014_${PLATFORM_SUFFIX}" "virtualenv"
207247

208248
# Check if pyproject.toml exists before running sed
209249
if [ -f pyproject.toml ]; then
210250
sed -i "" "s/\$VERSION/${VERSION}/g" pyproject.toml || sed -i "s/\$VERSION/${VERSION}/g" pyproject.toml
211251
fi
212252

253+
254+
213255
echo "Running cibuildwheel..."
214256
# Default CIBWHEEL_BIN if not set
215257
if [ -z "${CIBWHEEL_BIN}" ]; then

release/pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,18 @@ test-command = "python {project}/cel_basic_test.py"
4444
build-verbosity = 1
4545

4646
[tool.cibuildwheel.linux]
47+
build-frontend = { name = "pip", args = ["--no-build-isolation"] }
48+
before-build = "pip install --no-index --find-links={project}/build_deps setuptools wheel virtualenv"
49+
archs = ["x86_64", "aarch64"]
4750
manylinux-x86_64-image = "manylinux_2_28"
51+
manylinux-aarch64-image = "manylinux_2_28"
4852
container-engine = "docker; disable_host_mount: True"
4953
# Google's internal Kokoro/RBE network uses a secure MITM proxy that resigns HTTPS
5054
# traffic with an internal Google CA. Since the public manylinux container does not
5155
# trust this CA, git fetches for external dependencies (like @cel-cpp) will fail
5256
# with SSL certificate errors. We disable http.sslVerify inside the container to
5357
# 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"
58+
before-all = "git config --global http.sslVerify false && echo 'Installing bazelisk' && if [ $(uname -m) = 'aarch64' ]; then cp {project}/bazelisk-linux-arm64 /usr/local/bin/bazel; else cp {project}/bazelisk-linux-amd64 /usr/local/bin/bazel; fi && python3 -m pip install --no-index --find-links={project}/build_deps virtualenv"
5559

5660
[tool.cibuildwheel.macos]
5761
archs = ["x86_64", "arm64"]

0 commit comments

Comments
 (0)