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

Adding more JDK support for Jenkins Mac agent nodes #376

Merged
merged 4 commits into from
Dec 8, 2023
Merged
Changes from 3 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
14 changes: 13 additions & 1 deletion packer/scripts/macos/macos-agentsetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,27 @@ sudo chown -R ec2-user:staff /var/jenkins
/usr/local/bin/brew install wget
/usr/local/bin/brew install maven

## Install MacPorts, setup java11 and python
## Install MacPorts, jEnv, setup java8,11,14,17,19,20,21 and python, then set default java to 11
/usr/local/bin/wget https://github.com/macports/macports-base/releases/download/v2.7.2/MacPorts-2.7.2.tar.gz
tar -xvf MacPorts-2.7.2.tar.gz
cd MacPorts-2.7.2
./configure && make && sudo make install
cd .. && rm -rf MacPorts-2.7.2.tar.gz
export PATH=/opt/local/bin:$PATH
sudo port -v selfupdate
yes | sudo port install openjdk8-temurin
yes | sudo port install openjdk11-temurin
yes | sudo port install openjdk14-temurin
yes | sudo port install openjdk17-temurin
yes | sudo port install openjdk19
yes | sudo port install openjdk20
yes | sudo port install openjdk21-temurin
yes | sudo port install jenv
echo 'eval "$(jenv init -)"' >> ~/.zshrc && source ~/.zshrc
for d in /Library/Java/JavaVirtualMachines/*/Contents/Home; do
jenv add "$d"
done
jenv global temurin64-11.0.21
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion:

  1. Change d to some other better variable name to be more visiable
  2. See if you can make every entry an alias for easier setup, recommending openjdk-<majorVersion> as that is the output of the javaVersion from detectAgent jenkins lib such as:

https://github.com/opensearch-project/opensearch-build-libraries/blob/main/vars/detectDockerAgent.groovy#L16C27-L16C34
https://github.com/opensearch-project/opensearch-build/blob/main/jenkins/opensearch/distribution-build.jenkinsfile#L102

Thanks.

Copy link
Contributor Author

@jordarlu jordarlu Dec 8, 2023

Choose a reason for hiding this comment

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

thanks, Peter, looks like jenv did support using the alias per jenv/jenv#306 , so, I am adapting it in revised PR here now.. and we can remove the for-loop
Also, seems like some issues on jdk14, 19, and 20 on my local Mac test, let me remove them for now.

yes | sudo port install py39-python-install
sudo port select --set python python39
sudo port select --set python3 python39
Expand Down