From 2d1c9c1d11148e08f8fe19249753144ad5d8e119 Mon Sep 17 00:00:00 2001 From: ArrayRecord Team Date: Fri, 20 Nov 2026 04:53:54 -0800 Subject: [PATCH] Move ArrayRecord OSS builds to riegeli 0.0.0-20261117-64d553d and Bazel 8. The new riegeli release on BCR adds `Reader::NewReader(initial_pos, length_hint)`, which upcoming ArrayRecord changes use for bounded GCS reads. Moving to it needs several OSS build changes at once: * The other direct dependencies in `MODULE.bazel` are raised to the versions riegeli requires (abseil-cpp, protobuf, rules_cc, rules_python, platforms, googletest, pybind11_bazel). The build sets `--check_direct_dependencies=error`, so they must match. * CI and the BCR presubmit move from Bazel 7 to Bazel 8: rules_python 2.4.1 does not load on Bazel 7. * Linux wheels are built on `manylinux_2_28` instead of `manylinux2014`, because Bazel 8 needs a newer libstdc++ than the manylinux2014 image has. Prebuilt Linux wheels now need glibc 2.28 or newer, so CentOS/RHEL 7, Amazon Linux 2, and Ubuntu 18.04 lose them. manylinux2014 is end-of-life together with CentOS 7. * `SequencedChunkWriter` pads with `WritePadding(kImplicitPadding)` in OSS too, since the new riegeli removed `PadToBlockBoundary()`. * macOS CI moves from `macos-14`, which GitHub Actions no longer runs for this repository, to `macos-15`. `pypa/gh-action-pypi-publish` is pinned to v1.14.3, which fixes GHSA-5xjx-3w67-w9x9. * The wheel build skips the `*.venv` directories rules_python 2.x creates for `py_test` targets. Their `python3` symlink does not resolve outside of runfiles, and the macOS `rsync -L` fails on it. `ArrayRecordReader` now uses insecure credentials for `gs://` paths when `CLOUD_STORAGE_EMULATOR_ENDPOINT` is set. google-cloud-cpp 3.x documents this for `storage::Client()`, but its default options replace these credentials with Application Default Credentials. Outside of GCE those look up the metadata server, and the read is retried until the retry policy expires. With the new google-cloud-cpp, this made the GCS emulator tests in `array_record_module_test` time out. This workaround can be removed once https://github.com/googleapis/google-cloud-cpp/issues/16678 is fixed (proposed fix: https://github.com/googleapis/google-cloud-cpp/pull/16687) and the OSS build uses a google-cloud-cpp release with it. PiperOrigin-RevId: 1026386371 --- .bcr/presubmit.yml | 2 +- .../workflows/build_and_publish_template.yml | 8 +++--- MODULE.bazel | 16 +++++------ cpp/BUILD | 2 +- cpp/sequenced_chunk_writer.cc | 6 ++-- oss/build_whl.sh | 6 ++-- oss/runner_common.sh | 2 +- python/array_record_module.cc | 28 ++++++++++++++++++- 8 files changed, 49 insertions(+), 21 deletions(-) diff --git a/.bcr/presubmit.yml b/.bcr/presubmit.yml index 6f3a9f1..e87427d 100644 --- a/.bcr/presubmit.yml +++ b/.bcr/presubmit.yml @@ -18,7 +18,7 @@ matrix: - ubuntu2204 - macos_arm64 bazel: - - 7.x + - 8.x tasks: verify_targets: name: Verify build and test targets diff --git a/.github/workflows/build_and_publish_template.yml b/.github/workflows/build_and_publish_template.yml index 6e32a53..87e2413 100644 --- a/.github/workflows/build_and_publish_template.yml +++ b/.github/workflows/build_and_publish_template.yml @@ -28,10 +28,10 @@ jobs: fail-fast: false matrix: python-version: ["3.11", "3.12", "3.13", "3.14"] - os: [ubuntu-22.04, ubuntu-22.04-arm, macos-14] + os: [ubuntu-22.04, ubuntu-22.04-arm, macos-15] env: - USE_BAZEL_VERSION: "7.4.1" + USE_BAZEL_VERSION: "8.8.2" steps: - name: Set up Bazel uses: bazel-contrib/setup-bazel@4fd964a13a440a8aeb0be47350db2fc640f19ca8 # 0.15.0 @@ -54,7 +54,7 @@ jobs: export PYTHON_VERSION=${{ matrix.python-version }} export PYTHON_MAJOR_VERSION=$(echo $PYTHON_VERSION | cut -d. -f1) export PYTHON_MINOR_VERSION=$(echo $PYTHON_VERSION | cut -d. -f2) - export BAZEL_VERSION="7.4.1" + export BAZEL_VERSION="8.8.2" export OUTPUT_DIR="/tmp/array_record" export SOURCE_DIR="/tmp/array_record" . "${SOURCE_DIR}"'/oss/runner_common.sh' @@ -82,7 +82,7 @@ jobs: path: dist/ merge-multiple: true - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1 + uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3 with: attestations: false verbose: true \ No newline at end of file diff --git a/MODULE.bazel b/MODULE.bazel index deefe2f..2ae4409 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -20,19 +20,19 @@ module( repo_name = "com_google_array_record", ) -bazel_dep(name = "rules_cc", version = "0.2.17") +bazel_dep(name = "rules_cc", version = "0.2.22") bazel_dep(name = "rules_proto", version = "7.1.0") -bazel_dep(name = "rules_python", version = "1.6.0") -bazel_dep(name = "platforms", version = "1.0.0") -bazel_dep(name = "protobuf", version = "31.1") +bazel_dep(name = "rules_python", version = "2.4.1") +bazel_dep(name = "platforms", version = "1.1.0") +bazel_dep(name = "protobuf", version = "35.1") bazel_dep(name = "boringssl", version = "0.20260413.0") -bazel_dep(name = "googletest", version = "1.17.0.bcr.2") -bazel_dep(name = "abseil-cpp", version = "20260107.1") +bazel_dep(name = "googletest", version = "1.18.0") +bazel_dep(name = "abseil-cpp", version = "20260817.0") bazel_dep(name = "abseil-py", version = "2.1.0") bazel_dep(name = "eigen", version = "3.4.0.bcr.3") -bazel_dep(name = "riegeli", version = "0.0.0-20250717-5b2e77e") -bazel_dep(name = "pybind11_bazel", version = "2.13.6") +bazel_dep(name = "riegeli", version = "0.0.0-20261117-64d553d") +bazel_dep(name = "pybind11_bazel", version = "3.0.0") SUPPORTED_PYTHON_VERSIONS = [ "3.11", diff --git a/cpp/BUILD b/cpp/BUILD index 22fc358..977d77b 100644 --- a/cpp/BUILD +++ b/cpp/BUILD @@ -43,11 +43,11 @@ cc_library( "@riegeli//riegeli/base:initializer", "@riegeli//riegeli/base:object", "@riegeli//riegeli/base:status", - "@riegeli//riegeli/base:types", "@riegeli//riegeli/bytes:writer", "@riegeli//riegeli/chunk_encoding:chunk", "@riegeli//riegeli/chunk_encoding:constants", "@riegeli//riegeli/records:chunk_writer", + "@riegeli//riegeli/records:record_writer", ], ) diff --git a/cpp/sequenced_chunk_writer.cc b/cpp/sequenced_chunk_writer.cc index b1cd998..926db29 100644 --- a/cpp/sequenced_chunk_writer.cc +++ b/cpp/sequenced_chunk_writer.cc @@ -25,10 +25,10 @@ limitations under the License. #include "absl/strings/str_format.h" #include "absl/synchronization/mutex.h" #include "riegeli/base/status.h" -#include "riegeli/base/types.h" #include "riegeli/chunk_encoding/chunk.h" #include "riegeli/chunk_encoding/constants.h" #include "riegeli/records/chunk_writer.h" +#include "riegeli/records/record_writer.h" namespace array_record { @@ -118,8 +118,8 @@ void SequencedChunkWriterBase::TrySubmitFirstFutureChunk( return; } if (pad_to_block_boundary_) { - if (!chunk_writer->PadToBlockBoundary()) - { + if (!chunk_writer->WritePadding( + riegeli::RecordWriterBase::kImplicitPadding)) { Fail(riegeli::Annotate( chunk_writer->status(), absl::StrFormat("Could not pad boundary for chunk: %d", diff --git a/oss/build_whl.sh b/oss/build_whl.sh index 575d7a4..a853c3d 100755 --- a/oss/build_whl.sh +++ b/oss/build_whl.sh @@ -67,10 +67,12 @@ function main() { cp LICENSE "${TMPDIR}" rsync -avm -L --exclude="bazel-*/" . "${TMPDIR}/array_record" rsync -avm -L --include="*.so" --include="*_pb2.py" \ - --exclude="*.runfiles" --exclude="*_obj" --include="*/" --exclude="*" \ + --exclude="*.runfiles" --exclude="*.venv" --exclude="*_obj" \ + --include="*/" --exclude="*" \ bazel-bin/cpp "${TMPDIR}/array_record" rsync -avm -L --include="*.so" --include="*_pb2.py" \ - --exclude="*.runfiles" --exclude="*_obj" --include="*/" --exclude="*" \ + --exclude="*.runfiles" --exclude="*.venv" --exclude="*_obj" \ + --include="*/" --exclude="*" \ bazel-bin/python "${TMPDIR}/array_record" pushd ${TMPDIR} diff --git a/oss/runner_common.sh b/oss/runner_common.sh index d3e3ee5..5504029 100644 --- a/oss/runner_common.sh +++ b/oss/runner_common.sh @@ -26,7 +26,7 @@ build_and_test_array_record() { else # Automatically decide which platform to build for by checking on which # platform this runs. - AUDITWHEEL_PLATFORM='manylinux2014_'"$(uname -m)" + AUDITWHEEL_PLATFORM='manylinux_2_28_'"$(uname -m)" docker rmi -f array_record:${PYTHON_VERSION} docker rm -f array_record DOCKER_BUILDKIT=1 docker build --progress=plain --no-cache \ diff --git a/python/array_record_module.cc b/python/array_record_module.cc index bd3da2f..d500f6a 100644 --- a/python/array_record_module.cc +++ b/python/array_record_module.cc @@ -16,6 +16,7 @@ limitations under the License. #include #include +#include #include #include #include @@ -40,6 +41,31 @@ limitations under the License. namespace py = pybind11; +namespace { + +// Returns the GCS client used by `ArrayRecordReader` for `gs://` paths. +// +// When a storage emulator is configured, google-cloud-cpp 3.x still uses +// Application Default Credentials, even though `Client()` documents otherwise. +// Outside of GCE they look up the metadata server and the request is retried +// until the retry policy expires, so the reader appears to hang. Use insecure +// credentials, as emulators expect. +// +// TODO(zhixiangli): Use `google::cloud::storage::Client()` again once +// https://github.com/googleapis/google-cloud-cpp/issues/16678 is fixed in the +// google-cloud-cpp release used by the OSS build. +google::cloud::storage::Client MakeGcsClient() { + google::cloud::Options options; + if (std::getenv("CLOUD_STORAGE_EMULATOR_ENDPOINT") != nullptr || + std::getenv("CLOUD_STORAGE_TESTBENCH_ENDPOINT") != nullptr) { + options.set( + google::cloud::MakeInsecureCredentials()); + } + return google::cloud::storage::Client(std::move(options)); +} + +} // namespace + PYBIND11_MODULE(array_record_module, m) { using array_record::ArrayRecordReaderBase; using array_record::ArrayRecordWriterBase; @@ -104,7 +130,7 @@ PYBIND11_MODULE(array_record_module, m) { status_or_option->footer_prefetch_bytes(); return new array_record::ArrayRecordReader( riegeli::Maker( - google::cloud::storage::Client(), + MakeGcsClient(), riegeli::GcsObject(path), std::move(gcs_reader_options), footer_prefetch_bytes > 0 ? google::cloud::storage::ReadLast(