@@ -8,7 +8,7 @@ if [ -z "${KOKORO_BUILD_ID}" ]; then
88 fi
99fi
1010
11- pip install -U keyring keyrings.google-artifactregistry-auth twine cibuildwheel
11+ pip install --no-cache-dir - U keyring keyrings.google-artifactregistry-auth twine cibuildwheel
1212
1313REPO_DIR=$( mktemp -d)
1414echo " Created temporary directory: ${REPO_DIR} "
@@ -23,7 +23,7 @@ if [ "${DRY_RUN}" = "true" ]; then
2323 # Get the latest tag or fallback
2424 VERSION=$( git tag --sort=-v:refname 2> /dev/null | head -n 1 || true)
2525 if [ -z " ${VERSION} " ]; then
26- VERSION=" 0 .1.2"
26+ VERSION=" v0 .1.2"
2727 fi
2828 popd
2929else
4040VERSION=${VERSION# v}
4141echo " Building release for version: ${VERSION} "
4242
43- TMP_DIR=$( mktemp -d)
43+ # Explicitly create a normal directory in the workspace instead of using mktemp.
44+ TMP_DIR=" ${KOKORO_ARTIFACTS_DIR:- .} /cel-python-build"
45+ mkdir -p " ${TMP_DIR} "
46+ export TMPDIR=" ${TMP_DIR} "
4447echo " Build directory: ${TMP_DIR} "
4548
49+ # Configure pip inside cibuildwheel to use Google's internal Airlock PyPI mirror,
50+ # since public PyPI (pypi.org) is blocked by the RBE VM's network firewall.
51+ # We dynamically fetch the GCE Service Account token from the GCE Metadata Server
52+ # to authenticate the request to the Artifact Registry repository.
53+ GCE_TOKEN=$( python3 -c ' import urllib.request, json; req = urllib.request.Request("http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/token", headers={"Metadata-Flavor": "Google"}); print(json.loads(urllib.request.urlopen(req).read().decode())["access_token"])' )
54+ export PIP_INDEX_URL=" https://oauth2accesstoken:${GCE_TOKEN} @us-python.pkg.dev/artifact-foundry-prod/ah-3p-staging-python/simple/"
55+
56+ # Explicitly disable keyring searches and interactive prompts in pip inside the container
57+ # to prevent hangs on DBus or credential-helper lookups.
58+ export PIP_KEYRING_PROVIDER=" disabled"
59+ export PIP_NO_INPUT=" true"
60+ export CIBW_ENVIRONMENT=" PIP_INDEX_URL=$PIP_INDEX_URL PIP_KEYRING_PROVIDER=$PIP_KEYRING_PROVIDER PIP_NO_INPUT=$PIP_NO_INPUT http_proxy=$http_proxy https_proxy=$https_proxy HTTP_PROXY=$HTTP_PROXY HTTPS_PROXY=$HTTPS_PROXY "
61+
62+ # Enable extremely verbose logs for cibuildwheel.
63+ export CIBW_BUILD_VERBOSITY=3
64+
4665# Add trap cleanup for TMP_DIR as well
4766trap ' echo "Cleaning up temporary directories: ${REPO_DIR} ${TMP_DIR}"; rm -rf "${REPO_DIR}" "${TMP_DIR}"' EXIT
4867
0 commit comments