Make your buildserver talk

Jenkins talkingHave you ever started a shell script which takes a while and you keep monitoring that window because you really need those results? If you are working on a Mac, you can use the Mac’s power of speech to tell you a command is finished. Here’s how:

./; say "really long build is finished"

With a little curl and shell scripting magic, I told my Mac to constantly monitor our Jenkins buildserver, and bug everybody in the office when the hourly build is failing:


# Configuration

# The function that does the trick
fnReportFailure() {
  result=`curl -s \

  if  [ "${result}" == "XPath /*/result didn't match" ] \
   || [ "${result}" == "ABORTED" ]; then
    # ignore aborted or in-progress build. Ignore.
    return 0
  elif [ "${result}" != "SUCCESS" ]; then
    echo `date` ${job} : ${result}
    say -v "${voice}" "${message}"

# Loop over all projects and shout out problems
echo "Monitoring ${jenkinsurl}"
printf "===== "

while [ true ]; do
  # Add as many jobs as you want here:
  fnReportFailure "hourly_java_job" "The hourly java job is unstable."
  fnReportFailure "hourly_deploy_job" "The hourly deploy failed."

  # Tell the time and sleep a little
  now=`date +%H:%M:%S`
  printf "\b\b\b\b\b\b\b\b\b${now} "
  sleep 60

This script talks with the “Vicky” voice, because I let “Alex” read my iChat messages to me. Of course, the “Bad News” and “Zarvox” voices may be even more “motivating” to quickly fix the build. Now go and keep your eyes on youtube… err I mean your code.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s