Wednesday, February 25, 2015

Automating the Automation Tool

Automation tools are excellent, no doubt, but as you get acclimatised to how good they are you always thinking of ways of trimming off the fat from the unnecessary time you spend using them. Take your CI (Continuous Integration) tool for example - at my current job we currently make heavy use of Atlassian's Bamboo for the majority of our automation. We have developed a number of scripts to do the actual work but we use Bamboo's interface to pass parameters to the build. 

Personally I'm really poor at doing repeatable, mundane tasks that don't really engage my brain however require a decent level of concentration. One such activity is going to Bamboo's UI, finding the correct plan and entering in a bunch of parameters in order to run our scripts in a particular way. 

This click happy process doesn't do much for my sanity, especially when you are doing this numerous times a day and are prone to mistakes due to complete boredom. 

Enter scriptural, my little repository of scripts that I'm putting together for mundane tasks that I can automate. One such task is running Bamboo builds from a little python script which will then check the progress up to a certain length of time. This allows me to define the parameters in a file for future use and change them as required. I don't have to even go to the Bamboo UI now as my script can wait until the build is complete and report back to me on success or failure.

Now you might say I'm being overly precious of my time here, but the next time you're clicking through a UI to complete a task that you've done twenty times before, copy pasting values, and maybe making a mistake - think to yourself, is there a better way to do this? Sure UI's are fancy and nice to look at, but if I've seen it before am I that interested? I wonder is there an API sitting behind this UI...

With the availability of API's that most tools now have, chances are that you too can be more productive by creating a little script that runs in a fraction of the time that you would have spent with your mouse clicking away. 

Check out my example's in the repository to see how I've done it. Suggestions welcome...