Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/jobs/sbt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,15 @@ steps:
environment:
OJDK_VERSION: << parameters.openjdk_version >>
command: |
sudo apt update
sudo apt install openjdk-${OJDK_VERSION}-jre
sudo update-alternatives --set java /usr/lib/jvm/java-${OJDK_VERSION}-openjdk-amd64/bin/java
JVM_DIR="/usr/lib/jvm/java-${OJDK_VERSION}-openjdk-amd64"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM RISK

The JVM path is hardcoded to amd64, which breaks compatibility with ARM-based executors. Use dpkg --print-architecture to dynamically determine the correct path for the host architecture.

Suggested change
JVM_DIR="/usr/lib/jvm/java-${OJDK_VERSION}-openjdk-amd64"
JVM_DIR="/usr/lib/jvm/java-${OJDK_VERSION}-openjdk-$(dpkg --print-architecture)"

@andrzej-janczak andrzej-janczak Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not applying. -amd64 was already on the original line 94; this diff only moves it into a variable.

ARM is unreachable here: machine.yml fixes resource_class: large and sbt.yml has no resource_class param. The orb has 8 other amd64 hardcodes, so fixing one implies ARM works when it does not. Own ticket if we ever want it.

# skip only when the exact alternative the --set below needs is already registered
if update-alternatives --list java 2>/dev/null | grep -qx "${JVM_DIR}/bin/java"; then
echo "openjdk-${OJDK_VERSION} already registered at ${JVM_DIR}, skipping install"
else
sudo apt update
sudo apt install -y "openjdk-${OJDK_VERSION}-jre"
fi
sudo update-alternatives --set java "${JVM_DIR}/bin/java"
- when:
condition: << parameters.install_sbt_version >>
steps:
Expand Down