Skip to content

www.rolfje.com

Make your buildserver talk

Posted on 2012-12-16 By rolfje No Comments on 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:

./yourreallyslowbuild.sh; 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:

#!/bin/sh

# Configuration
jenkinsurl=http://my.jenkins.server/jenkins
voice=Vicki

# The function that does the trick
fnReportFailure() {
  job=${1}
  message=${2}
  result=`curl -s \
    ${jenkinsurl}/job/${job}/lastBuild/api/xml?xpath=/*/result/text()`

  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}"
  fi
}

# Loop over all projects and shout out problems
clear
echo
echo "Monitoring ${jenkinsurl}"
echo
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
done

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.

Enjoy.

Apple, Fun, Software Tags:programming, usability

Post navigation

Previous Post: The world is not a Green Field
Next Post: Why you should not use SOAP Headers

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

           

Recent Comments

  • rolfje on Methode Buijs uitgelegd
  • LinkedIn is at Peak Enshittifaction – Will Chatham's Blog on Linked-In not really Opt-in?
  • Hans j on 1N4148 diode as RF switch
  • Roaming Rhonda on DLNA on OSX, done right
  • Frans on How to fix a Krups XN2001 Nespresso machine

Tags

Anonimatron Apple backup design DIY DRM eclipse environment Fun gmail google hacking hamradio Hardware helicopter iphone ipod iTunes Java Keynote maven modelling motorcycle music news opinion oracle osx photo photography programming repair review security Software Steve Jobs T-Mobile technology Time Machine Ubuntu usability Utilities vacation windows Workshop

Categories

  • Apple (105)
  • Divorce (1)
  • Electronics (3)
  • Fun (57)
  • Games (7)
  • Hardware (72)
  • Microsoft (18)
  • Racing (14)
  • Software (134)
  • Uncategorized (65)
  • Workshop (20)

Archives

Copyright © 2025 www.rolfje.com.

Powered by PressBook WordPress theme