Skip to content

[build] reduce downloaded artifacts#17598

Open
titusfortner wants to merge 1 commit into
trunkfrom
c/cache_fix_java
Open

[build] reduce downloaded artifacts#17598
titusfortner wants to merge 1 commit into
trunkfrom
c/cache_fix_java

Conversation

@titusfortner
Copy link
Copy Markdown
Member

Trimming our Bazel repository cache to get it under the GitHub 10 GB limit.

This PR decreases Cache sizes

  • Mac 3.7 to 2.0 GB
  • Windows 2.8 to 2.4 GB
  • Linux 4.0 to 3.6 GB

💥 What does this PR do?

  • pinned-grid java_binary now respects --pin_browsers (java/src/org/openqa/selenium/grid/BUILD.bazel). Its select() keyed on bare //common:linux / //common:macos, so any mac or linux analysis pass — including --pin_browsers=false — unconditionally fetched @mac_chrome, @mac_firefox, drivers, etc. Switching the keys to //common:use_pinned_linux_chrome / use_pinned_macos_chrome (which require both the OS constraint and pin_browsers=true) makes the browser fetches actually conditional.

  • Bumped the build/test/tool JDK from 21 to 25 (.bazelrc). rules_java 9.6.1's per-language-version default_java_toolchain hardcodes java_runtime = :remotejdk_25 so even with --java_runtime_version=remotejdk_21, javac runs on JDK 25. That means we download both JDK 21 (for test/binary runtime) and JDK 25 (for compilation) on every fresh cache. Going to JDK 25 across the board (--java_language_version=25, --java_runtime_version=remotejdk_25, and the tool_ variants) leaves only JDK 25 in cache. Released artifacts stay at Java 11 via the unchanged --javacopt="--release 11", and test artifacts stay at Java 17 based on TOOLS_JAVA_VERSION (we can increase this later if we want).

🔧 Implementation Notes

  • Dropped -Djava.security.manager=allow from junit5_test** (java/private/junit5_test.bzl) since Security Manager was removed in JDK 24
  • Cleaned up unused "use_repo" entries

🤖 AI assistance

  • No substantial AI assistance used
  • AI assisted (complete below)
    • Tool(s): Claude Code
    • What was generated:
    • I reviewed all AI output and can explain the change

💡 Additional Considerations

  • This will allow us to switch away from External Cache and use Repository Contents Cache across the builds

🔄 Types of changes

  • Cleanup (formatting, renaming)
  • Bug fix (backwards compatible)

@selenium-ci selenium-ci added B-grid Everything grid and server related C-java Java Bindings B-build Includes scripting, bazel and CI integrations labels May 30, 2026
@qodo-code-review
Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Reduce Bazel cache size by optimizing Java toolchain and browser dependencies

✨ Enhancement 🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Upgrade Java toolchain from JDK 21 to 25 across build/test/tool
• Make pinned-grid browser fetches conditional on --pin_browsers flag
• Remove deprecated Security Manager flag from JUnit5 tests
• Clean up unused JDK 17 repository entries from MODULE.bazel
Diagram
flowchart LR
  A["JDK 21 to 25<br/>Upgrade"] --> B["Single JDK<br/>in cache"]
  C["Bare OS constraints<br/>in pinned-grid"] --> D["OS + pin_browsers<br/>constraints"]
  D --> E["Conditional browser<br/>downloads"]
  F["Remove JDK 17<br/>repos"] --> B
  G["Remove deprecated<br/>Security Manager"] --> H["JDK 24+<br/>compatible"]
  B --> I["Reduced cache<br/>size"]
  E --> I

Loading

Grey Divider

File Changes

1. java/private/junit5_test.bzl 🐞 Bug fix +1/-1

Remove deprecated Security Manager JVM flag

• Removed -Djava.security.manager=allow JVM flag from junit5_test
• Flag is deprecated and removed in JDK 24+

java/private/junit5_test.bzl


2. .bazelrc ⚙️ Configuration changes +4/-4

Upgrade Java toolchain from JDK 21 to 25

• Upgraded Java language version from 21 to 25
• Upgraded Java runtime version from remotejdk_21 to remotejdk_25
• Applied upgrade to both standard and tool variants
• Maintains Java 11 release target via unchanged --javacopt="--release 11"

.bazelrc


3. MODULE.bazel Cleanup +0/-6

Remove unused JDK 17 repository entries

• Removed six unused JDK 17 repository entries from use_repo()
• Cleaned up: remotejdk17_linux, remotejdk17_linux_s390x, remotejdk17_macos,
 remotejdk17_macos_aarch64, remotejdk17_win, remotejdk17_win_arm64
• Reduces unnecessary artifacts in Bazel cache

MODULE.bazel


View more (1)
4. java/src/org/openqa/selenium/grid/BUILD.bazel 🐞 Bug fix +4/-4

Make pinned-grid browser dependencies conditional on pin_browsers

• Changed pinned-grid data select conditions from //common:linux to
 //common:use_pinned_linux_chrome
• Changed pinned-grid data select conditions from //common:macos to
 //common:use_pinned_macos_chrome
• Applied same constraint changes to jvm_flags select block
• Makes browser dependencies conditional on both OS and --pin_browsers=true flag

java/src/org/openqa/selenium/grid/BUILD.bazel


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown
Contributor

qodo-code-review Bot commented May 30, 2026

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Qodo Logo

@titusfortner titusfortner requested review from diemol and shs96c May 30, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-build Includes scripting, bazel and CI integrations B-grid Everything grid and server related C-java Java Bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants