Friday, January 11, 2013

more headless jenkins under Mac OS X 10.x

Steps to create a headless Slave Jenkins Mac OS X

1. Install Java VM or JDK
    Downloading .DMG from Oracle Java site. Install
2. Install Apple X Code development plus command line package
    Download from Apple Developers site
3. Connect under-setup Jenkins Mac Slave to Jenkins Master through web browser
4. Create a Mac Slave Node on Master
5. From Slave, connect to Master from Mac Slave Node using command line:
    javaws http://<your jenkins master>:8080/computer/<YOUR SLAVE MACHINE NAME>/slave-agent.jnlp
or if the slave is headless:
    java -jar slave.jar -jnlpUrl http://<your jenkins master>:8080/computer/<YOUR SLAVE MACHINE NAME>/slave-agent.jnlp

6. The above step #5 will fail as expected

7. Create a .plist file org.jenkins-ci.plist for launchDaemons in
    /Library/LaunchDaemons/<create a dir name here>
All paths here are specific for my system.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<string>/Library/Application Support/build-slave/</string>
<string>your user</string>
<true />

8. Create a LaunchDaemon script in
    /Library/Application Support/<create a dir name here>
/usr/bin/java -jar slave.jar -jnlpUrl http://<your jenkins master:8080>/computer/<your mac slave>/slave-agent.jnlp

9. Create a launchDaemon script to start jenkins headless slave in case you want to do it manually, test, etc.
sudo launchctl load -w /Library/LaunchDaemons/org.jenkins-ci.plist

10. Put the command line in /etc/launchd.conf to start everytime the system reboots
launchctl load -w /Library/LaunchDaemons/org.jenkins-ci.plist

some examples of launchctl:

sudo launchctl list
sudo launchctl unload -w /System/Library/LaunchDaemons/finger.plist
sudo launchctl load -w /System/Library/LaunchDaemons/finger.plist

No comments:

Post a Comment