Repository navigation
fix: resolve portable Ruby dist path at action time and mark repo reproducible - #435
Conversation
…roducible The portable Ruby repository wrote BUNDLE_BUILD__PSYCH and BUNDLE_BUILD__OPENSSL with an absolute path to its dist/ directory. That made the repository machine-specific and broke on remote execution. The repository now records the options with paths relative to the repository (rb_toolchain.bundle_build_env). rb_bundle_install and rb_gem_install make them absolute with $PWD when the action runs. With no absolute path left, portable Ruby returns repo_metadata(reproducible = True) so Bazel can reuse it from the repository cache.
|
|
… explicit A host-detected platform or a download without a sha256 made the repository depend on the host or on the remote file, so it must not be reused from the repository contents cache. is_reproducible now also requires the platform attribute and the sha256 the archive was verified against. Assisted-by: Claude
|
Thanks, real. A host-detected platform or a download without a sha256 could have been reused from the repo contents cache. Fixed in 46d5cea: Assisted by Claude. |
| """ | ||
| if not portable_ruby or is_windows_target or not platform or not sha256: | ||
| return False | ||
| if version == "system" or version.startswith("jruby") or version.startswith("truffleruby"): |
There was a problem hiding this comment.
jruby should be reproducible as it's fully supported on RBE
There was a problem hiding this comment.
Agreed. 062a984 makes JRuby reproducible whenever its sha256 is pinned, regardless of portable_ruby or platform. It also copies the .cmd wrappers instead of symlinking them, because a symlink would point to an absolute path. I updated the unit tests, and bazel test //ruby/tests/... passes (10/10). A real JRuby download did not finish locally, so that part is untested.
Assisted by Claude.
TruffleRuby on macOS legitimately records Homebrew prefixes as BUNDLE_BUILD__* options, which made the check fail there. Assisted-by: Claude
JRuby's archive is the same on every platform and is verified against a pinned sha256, so it no longer depends on portable_ruby or platform. The Windows .cmd wrappers are copied instead of symlinked, as a symlink points to an absolute path. Assisted-by: Claude
|
The Assisted by Claude. |
Fixes #414.
Portable Ruby wrote
BUNDLE_BUILD__PSYCHandBUNDLE_BUILD__OPENSSLwith an absolute path to itsdistdirectory. This made the repository machine-specific, embeddedoutput_basepaths inrb_binary/rb_testlaunchers, and did not work with remote execution (see the removed# TODO: This won't work on RBE).Changes:
rb_downloadstores the options in a newrb_toolchainattribute,bundle_build_env, with paths relative to the repository (--with-libyaml-dir=dist).rb_bundle_installandrb_gem_installmake the path absolute in their scripts with$PWD/<toolchain root>/dist. This happens on the machine that runs the action, so it also works on RBE. Userenvstill wins. Windows is unaffected.platformand a sha256-pinned archive,rb_downloadnow returnsrepo_metadata(reproducible = True), so Bazel 8.3+ can reuse the toolchain from the repository cache. Guarded withhasattrfor older Bazel. A host-detected platform, an unpinned download, system Ruby, JRuby, TruffleRuby and Windows are not marked.examples/gemlauncher_env_check_testfails if therb_binarylauncher containsBUNDLE_BUILD__PSYCH,BUNDLE_BUILD__OPENSSLor an absolute--with-*-dir=. Verified it fails on main (71164b0) and passes with this change.Behavior change:
rb_binaryandrb_testno longer haveBUNDLE_BUILD__PSYCHandBUNDLE_BUILD__OPENSSLin their runtime environment. Only the rules that compile native extensions set them.Testing:
bazel test --ignore_dev_dependency //ruby/tests:all: 10 of 10 pass (run on the draft base14e9863; no touched file changed upstream since). New tests:download_tests,utils_tests.examples/gem:bazel test //:launcher_env_check_testpasses. psych 5.3.1 built with--incompatible_strict_action_envon remote execution in the earlier run.bazel run :buildifier.check, the full//ruby/tests:all, and the fullexamples/gembuild .../test .... CI will cover them.Assisted by Claude.