Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using update-alternatives from dpkg to set Java version on Mac agent node #380

Merged
merged 4 commits into from
Jan 8, 2024

Conversation

jordarlu
Copy link
Contributor

@jordarlu jordarlu commented Jan 3, 2024

Description

We are going to use update-alternatives from dpkg to set Java version on Mac agent node

Issues Resolved

opensearch-project/opensearch-build#4272

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…node

Signed-off-by: Jeff Lu <chunglu@amazon.com>
@jordarlu
Copy link
Contributor Author

jordarlu commented Jan 3, 2024

Tested on staging enviroment with 3.0.0 (Java21) and build 1.3.15 (Java11), they both looked successful :

build 3.0.0

Current Java version
[Pipeline] sh
+ java -version
openjdk version "11.0.21" 2023-10-17
OpenJDK Runtime Environment Temurin-11.0.21+9 (build 11.0.21+9)
OpenJDK 64-Bit Server VM Temurin-11.0.21+9 (build 11.0.21+9, mixed mode)
[Pipeline] echo
Switching to Java 21 on MacOS
[Pipeline] sh
++ update-alternatives --list java
++ grep openjdk-21
+ update-alternatives --set java /opt/java/openjdk-21/Contents/Home/bin/java
update-alternatives: using /opt/java/openjdk-21/Contents/Home/bin/java to provide /usr/local/bin/java (java) in manual mode
[Pipeline] sh
+ java -version
openjdk version "21.0.1" 2023-10-17 LTS
OpenJDK Runtime Environment Temurin-21.0.1+12 (build 21.0.1+12-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.1+12 (build 21.0.1+12-LTS, mixed mode)
[Pipeline] }
[Pipeline] // script

build 1.3.15

Current Java version
[Pipeline] sh
+ java -version
openjdk version "21.0.1" 2023-10-17 LTS
OpenJDK Runtime Environment Temurin-21.0.1+12 (build 21.0.1+12-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.1+12 (build 21.0.1+12-LTS, mixed mode)
[Pipeline] echo
Switching to Java 11 on MacOS
[Pipeline] sh
++ update-alternatives --list java
++ grep openjdk-11
+ update-alternatives --set java /opt/java/openjdk-11/Contents/Home/bin/java
update-alternatives: using /opt/java/openjdk-11/Contents/Home/bin/java to provide /usr/local/bin/java (java) in manual mode
[Pipeline] sh
+ java -version
openjdk version "11.0.21" 2023-10-17
OpenJDK Runtime Environment Temurin-11.0.21+9 (build 11.0.21+9)
OpenJDK 64-Bit Server VM Temurin-11.0.21+9 (build 11.0.21+9, mixed mode)
[Pipeline] }
[Pipeline] // script

Signed-off-by: Jeff Lu <chunglu@amazon.com>
Copy link
Member

@peterzhuamazon peterzhuamazon left a comment

Choose a reason for hiding this comment

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

Thanks @jordarlu , more comments here. Thanks!

packer/scripts/macos/macos-agentsetup.sh Outdated Show resolved Hide resolved
packer/scripts/macos/macos-agentsetup.sh Outdated Show resolved Hide resolved
packer/scripts/macos/macos-agentsetup.sh Outdated Show resolved Hide resolved
Signed-off-by: Jeff Lu <chunglu@amazon.com>
Signed-off-by: Jeff Lu <chunglu@amazon.com>
@jordarlu jordarlu merged commit de981c2 into opensearch-project:main Jan 8, 2024
3 checks passed
@jordarlu jordarlu deleted the newMacAMI branch January 8, 2024 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants