Is it just me, or is Jenkins the best name for a technology, ever? Sorry, Alexa and Siri. Clippy maybe comes in second. You want to order Jenkins around, not some robot with a creepy voice!
I've always had a weird fascination with butlers (butlering?). I've even read two books about butlers (The Remains of the Day and Wake up, Sir!). But playing around with Jenkins is the ultimate way to acquire your own butler in real life...at least kinda.
Meet Jenkins
For those who don't know, Jenkins is a continuous integration solution that helps development teams automatically test and integrate new code into their existing code base.
But Jenkins isn't an elitist—he doesn't just cater to gigantic technology teams. You can use Jenkins at home, like a personal butler who attends to your personal development needs. If you've got a Mac machine and a few minutes, I'll show you how to install and set up Jenkins on your local machine.
Check if you have Java installed:
java -version
If not, download that first.
Next, download the latest stable version of Jenkins here. Try going to localhost:8080
in a web browser. If that doesn't work, start it up on the command line:
# start the daemon
sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist
# stop the daemon
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
Once you've started it up, navigate to localhost:8080
in a web browser. You are now face to face with Jenkins.
Let's ask Jenkins to execute a shell script on the 1st and 15th of every month. You can set up Jenkins to pull that off. In the side menu, click on "New Item" and give your job a name.
Check the box to "build periodically".
To make it run once a day on the 1st and 15th of every month:
H H 1,15 1-12 *
Type out your shell script right in the text box under Build > Execute shell.
# a ridiculous shell script
echo $BUILD_NUMBER
sleep 10m
Save and exit. You can test it out by clicking "Build now" and viewing the results. If there are any problems, click on "Console Output" to read any complaints Jenkins dared to utter while trying to execute your command. Don't you like a butler who talks back?
That about wraps up this very basic tutorial for getting Jenkins up and running on your Macbook. If you want to stop the daemon, run sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
(enter the password you use to log into your laptop when prompted).
One weird quirk about Jenkins is that it shows a blue ball whan a job build is completed successfully, and a red ball when it fails. Maybe he's being sensitive to users with red-green colorblindness? If you like Christmas colors or have been conditioned by years of driving in traffic, the Green Balls Jenkins plugin can help with that.
Have fun getting acquainted with Jenkins!
Further reading:
Setting up Jenkins CI on a Mac
How to set up Jenkins CI on Mac
Set up Jenkins CI on OSX