Skip to content

Commit

Permalink
Adding more JDK support for Jenkins Mac agent nodes (#376)
Browse files Browse the repository at this point in the history
* adding more JDKs

Signed-off-by: Jeff Lu <[email protected]>

* remove a duplicated line

Signed-off-by: Jeff Lu <[email protected]>

* using jEnv to set default java version to 11

Signed-off-by: Jeff Lu <[email protected]>

* address the comment

Signed-off-by: Jeff Lu <[email protected]>

---------

Signed-off-by: Jeff Lu <[email protected]>
  • Loading branch information
jordarlu authored Dec 8, 2023
1 parent 4a299e4 commit 4d068fd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packer/scripts/macos/macos-agentsetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,25 @@ 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,17,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 openjdk17-temurin
yes | sudo port install openjdk21-temurin
yes | sudo port install jenv
echo 'eval "$(jenv init -)"' >> ~/.bash_profile && source ~/.bash_profile
jenv add openjdk-8 /Library/Java/JavaVirtualMachines/openjdk8-temurin/Contents/Home/
jenv add openjdk-11 /Library/Java/JavaVirtualMachines/openjdk11-temurin/Contents/Home/
jenv add openjdk-17 /Library/Java/JavaVirtualMachines/openjdk17-temurin/Contents/Home/
jenv add openjdk-21 /Library/Java/JavaVirtualMachines/jdk-21-eclipse-temurin.jdk/Contents/Home/
jenv local openjdk-11 && jenv global openjdk-11
yes | sudo port install py39-python-install
sudo port select --set python python39
sudo port select --set python3 python39
Expand Down

0 comments on commit 4d068fd

Please sign in to comment.