Step 1: Setup a local email client
Screen shots for: Setting up a client, adding an email filter, running a Jenkins job (dos) by batch file
Start up and add a mailbox:
This page will take you through my own setup using Thunderbird, but there are many email clients out there with similar facilities so feel free to use your own software choice and just follow the general guidelines below. (I may be able to grab screenshots from our office Outlook, which does have similar features, but our workstations are locked down so actually, I can't use it in this case)
Install ThunderBird, found here at the time of print: www.mozilla.org
. Follow instructions and setup a connection to your preferred imap mailbox (I use one of my website's standard facilities):
Step 2: Add an email filter plugin
Add the email filters plugin called 'FiltaQuilla':
Set your main preferences. I do find the 'Run File' option the most useful for my approach outlined below:
In the main Thunderbird window, go to Tools, Message Filters and press the 'New' button. This presents you with the 'Filters Rules' options (shown below). To keep things fairly secure and locked down by the performance test analyst, I provide simple rules that say for example: if a message appears from 'my_user@my_company'
AND the subject is 'run my Performance Job'
THEN, run the file
I specify, which contains all the instructions:
Step 3: Control the running of Jenkins jobs
Run a batch file
To keep my setup secure, I keep the details of my jobs on the box itself and just give users a message to send to run the job. So the way in which I run the job is kept separate from the email itself. This certainly feels more secure and of course I can easily turn job access on and off myself as required.
C:\cygwin\bin\bash -c "wget --no-cookies --header=\"Authorization: Basic bmdvZGZyZXl***************s6VGVsZXBob25lMDI=\" --post-data ' ' http://127.0.0.1/job/allweb_perf_status/build?delay=0sec"
The batch job I run can of course be tailored to my individual jobs that I want to run on this box. Above is an example of a Jenkins job, including the proper log in required. Notice I do tend to use cygwin as BASH gives me more control on all sorts of job activities.
In fact, when you setup a default email filter rule using the 'FiltaQuilla' plugin, you typically get a 'Run File' line such as:
And then you can make use of the command line arguments as shown below. Note the date time stamp is added to the log file for our records. I am not actually using the command line arguments in earnest here, but of course you can do so just by editing the batch file as required. And there are other arguments you can pass down to the script, see the 'FiltaQuilla' user manual for details:
rem NOTE DOWN the run time:
echo %date% %time% >> c:\loadrunner\log.txt
echo first parameter is %1
echo second parameter is %2
echo --- about to run allweb --- >> c:\loadrunner\log.txt
echo ------ >> c:\loadrunner\log.txt
Because I have already setup my Jenkins jobs to send emails out on completion, we can now cascade our jobs if required, using the approach above to trigger new jobs based on the Jenkins emails, lets say if we get a 'Passed' subject email from a particular Jenkins job, then trigger a different box to run the next job inline. etc. etc.
Because all our boxes (in our case) are watching the same IMAP mail box, ALL boxes see the job status as it rolls, so we do actually have our own (cheap, non-commercial) instant messaging queue system! This is NOT recommended for proper commercial systems, by the way.
Outlook can be setup as well, to run commands on receiving certain emails. I've grabbed some screenshots to show roughly how you can do this:
Press 'Advanced Options' and select 'start application':
Browse to your batch file as shown above with Thunderbird: