“VJ, I want you to run the automation job on all our three environments on a nightly basis. So that we can compare the results & find out any discrepancies across environments.”
My team lead said this to me one day out of the blue.A small background on this – we have automation scripts used to test Rest APis on our cloud. This normally runs on a single environment every night, mainly pre-prod.Now the requirement was to run the same set of scripts on all environments i.e staging/dev, pre-prod & prod.
This was a new and exciting task for me and I got on with it right away!
Till now, I only knew how to schedule a job periodically as I had earlier written a blog post regarding it. But I did not know how to schedule the same job, multiple times with different parameters.
I found exactly what I needed in the Parameterised Scheduler Plugin!!
So once you install this plugin,restart the jenkins application for it to take effect. Very important. I tried scheduling it without restart and the plugin did not work.
Here’s how you can schedule the same job multiple times throughout the day with different parameters:-
The % symbol separates the cron notation from the parameters(if any) that you want to give for your run. ‘env’ is my parameter which my scripts pick up.
Another example of scheduling the same job with multiple parameters :-
The parameters have to be separated by a ; for it to take effect. Here ‘env’ and ‘param’ are 2 params that my automation scripts accept.
So there’s the solution for it.Hope this post was helpful to some.
I love Jenkins for it’s plug-ability & wide range of solutions to commonly faced problems/requirements. Simply superb!
Alright guys.. Have fun… Enjoy 🙂
This is VJ signing off!