|
1 | 1 | #!/bin/bash |
2 | 2 | set -e |
3 | 3 |
|
| 4 | + |
| 5 | +# Avoid virtualenv/pip trying to download/upgrade tools from PyPI on host |
| 6 | +export VIRTUALENV_NO_DOWNLOAD=1 |
| 7 | +export PIP_DISABLE_PIP_VERSION_CHECK=1 |
| 8 | + |
| 9 | +# Pass these environment variables to the cibuildwheel Docker container |
| 10 | +export CIBW_ENVIRONMENT="VIRTUALENV_NO_DOWNLOAD=1 PIP_DISABLE_PIP_VERSION_CHECK=1" |
| 11 | +export CIBW_DEPENDENCY_VERSIONS="latest" |
| 12 | + |
4 | 13 | # If running locally (not on Kokoro), authenticate with gcloud. |
5 | 14 | if [ -z "${KOKORO_BUILD_ID}" ]; then |
6 | 15 | if ! gcloud auth application-default print-access-token --quiet > /dev/null; then |
7 | 16 | gcloud auth application-default login |
8 | 17 | fi |
9 | 18 | fi |
10 | 19 |
|
11 | | -pip install -U keyring keyrings.google-artifactregistry-auth twine cibuildwheel |
| 20 | +# We use --no-cache-dir to force pip to download packages fresh and bypass the local |
| 21 | +# cache. In Kokoro/RBE sandboxed environments, writing to the default cache directory |
| 22 | +# (~/.cache/pip) can encounter permission/sandbox restrictions or lead to stale |
| 23 | +# dependency resolution. Disabling the cache ensures a reliable, reproducible install. |
| 24 | +pip install --no-cache-dir -U keyring keyrings.google-artifactregistry-auth twine cibuildwheel |
12 | 25 |
|
13 | 26 | REPO_DIR=$(mktemp -d) |
14 | 27 | echo "Created temporary directory: ${REPO_DIR}" |
@@ -52,16 +65,24 @@ cp -r "${SRC_DIR}"/{*,.*} . 2>/dev/null || true |
52 | 65 | cp -r "${SRC_DIR}"/release/* . 2>/dev/null || true |
53 | 66 | rm -rf cel_expr_python/*_test.py |
54 | 67 |
|
| 68 | +echo "Downloading bazelisk on host..." |
| 69 | +curl -LO https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-amd64 |
| 70 | +chmod +x bazelisk-linux-amd64 |
| 71 | + |
55 | 72 | # Check if pyproject.toml exists before running sed |
56 | 73 | if [ -f pyproject.toml ]; then |
57 | 74 | sed -i "" "s/\$VERSION/${VERSION}/g" pyproject.toml || sed -i "s/\$VERSION/${VERSION}/g" pyproject.toml |
58 | 75 | fi |
59 | 76 |
|
| 77 | +export CIBW_CONTAINER_ENGINE_EXTRA_ARGS="--network=host" |
| 78 | + |
60 | 79 | echo "Running cibuildwheel: ${CIBWHEEL_BIN}" |
61 | 80 | # Default CIBWHEEL_BIN if not set |
62 | 81 | if [ -z "${CIBWHEEL_BIN}" ]; then |
63 | 82 | CIBWHEEL_BIN="python3 -m cibuildwheel" |
64 | 83 | fi |
| 84 | + |
| 85 | +# Run cibuildwheel synchronously |
65 | 86 | ${CIBWHEEL_BIN} --platform linux --output-dir dist |
66 | 87 |
|
67 | 88 | if [ "${DRY_RUN}" = "true" ]; then |
|
0 commit comments