Parameterised Scheduler Plugin

“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:-

Build_periodically_with_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 :-

Scheduling_With_Multiple_Params

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!

 

 

 

sudo /etc/init.d/jenkins start not working

I had installed jenkins and builds were working fine.

Suddenly it stopped working. There is nothing in logs

I tried starting it, with the following command :-

sudo /etc/init.d/jenkins start

but still it’s not running

root@localhost:$# service jenkins restart
 * Restarting Jenkins Continuous Integration Server jenkins [ OK ] 

root@localhost:$# service jenkins status
Jenkins Continuous Integration Server is not running

After some googling I was able to get to run jenkins with the foll command :-

-Djava.awt.headless=true -jar /usr/share/jenkins/jenkins.war –webroot=/var/cache/jenkins/war –httpPort=8080

Still not able to get why the conventional Jenkins start command is not working. I’m working on ubuntu 14.04 version. So maybe there is some issue with Jenkins-Linux combination. To get it working is enough for the time being!

Jenkins ERROR: Failed to parse POMs : java.io.IOException: remote file operation failed: Caused by: java.lang.NoClassDefFoundError:

Hi all,

I have recently faced a peculiar error with my Jenkins+Selenium Integration.The scripts which were running fine for many weeks suddenly started failing.The scripts would not even get invoked.

Initially before invocation of the scripts I got a failed to parse POM error. How could that happen when I have’nt changed the setup at all myself??

This was the error I saw in the Jenkins console logs :-

parsing pom error-Jenkins

Anyhow after reading a few Stack overflow posts, I got a few clues that it must be somewhere related to the default Maven installations done by Jenkins in the respective slaves.

In the Jenkins slave default path I saw there are few jars/ packages that Jenkins configures/copied on to the slave :-

Temp Maven Files copied on to Jenkins Slave

The tools folder contains the following Maven Package :-

Temp Maven Files copied on to Jenkins Slave- inside Tools Folder

I deleted the 3 jars(maven3-interceptor-commons.jar, maven31-agent.jar, maven31-interceptor.jar) and the complete ‘tools’ folder and once again re-run my automation job.

And… Voila!! The scripts were invoked fine once again! 🙂 All those files were again copied fresh to the Jenkins Slave once again.

So it looks like maybe one of the Maven jars got corrupted for some reason and were breaking the execution. The reason this could have happened is still hazy to me. But atleast we have a solution for it :).

Let me know if you come across such an error and if you were able to resolve it with this post.

Regards,

VJ

Useful Jenkins Plugins: JobConfigHistory Plugin

This plugin comes in handy while creating/modifying Jenkins jobs. Once you install this plugin, there is small ‘spanner’ symbol next to the individual builds run

Screen Shot 2015-04-27 at 5.45.05 pm

Clicking on this spanner icon will show you an xml comparison between the configurations before and after the change on the respective jenkins job.

Screen Shot 2015-04-27 at 5.41.19 pm

Also there is a button called ‘Restore this configuration’ which will revert the configuration to the previous one. This comes in very handy while designing CI pipelines where in frequent changes/additions are made to the build process.

This is a must have plugin if you are a Jenkins user. 🙂

Hope this is helpful 🙂

Regards,

VJ

Jenkins: Error Building Binaries – Windows OS

Hi all,

Recently I came across an issue on Jenkins while building a project on Windows OS.

What was happening was that while running a build script locally in the Windows OS the building of binaries was successful, but while doing the same using Jenkins I was getting error building binaries. It was not able to take the local settings of the machine which includes various configurations of Visual Studio 2008.

Solution: After some debugging, I found out that the root cause was that I was running the Jenkins slave as a windows service. When I stopped the service and ran the .jnlp file on the slave, the build process was successfuly.  Another important point I’m starting to realise about Jenkins slaves on Windows is that it is best to launch the slave via jnlp and not as a service.

Regards,

VJ

Jenkins + Selenium Error: org.openqa.selenium.firefox.NotConnectedException

Hi all,

A small background : I run my automation suite using Jenkins on a nightly basis. The suite is maintained as a Maven Project. I run ‘mvn site’ to execute the test suite.

I encountered the following error when Latest Firefox version 36 was released and I had to upgrade my selenium jars to the latest version i.e from 2.44.0 to 2.45.0. :-

Firefox_NotConnectedException

The error seen is

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1...

I had promptly downloaded the latest selenium standalone jar 2.45.0 and configured the build path with the latest jar. The scripts were executing successfully while being run individually but while running as a test suite using the ‘mvn site’ command, my execution was failing.

 Solution: Initially I thought that the execution was failing due to some configuration on Jenkins. But later after some debugging I realised that I had not updated pom.xml with the latest selenium version.

<dependency>

<groupId>org.seleniumhq.selenium</groupId>

<artifactId>selenium-server</artifactId>

<version>2.45.0</version>

</dependency>

Next time Selenium releases a new version, I know what to do now! 😀

Regards,

VJ

SVN Checkout Error in Jenkins : E200030 : BUSY

Hey all,

You might come across this error while trying to setup a fresh CI pipeline on Jenkins with SVN as repository :-

Caused by: org.tmatesoft.svn.core.SVNException: svn: E200030: BUSY

SVN E200030 BUSY

Solution :-

Check if the root folder of the job has a .svn folder(which is hidden). Delete this folder & try to checkout once again. This should solve your problem. Basically this .svn folder has some svn keys/credentials stored temporarily. These might come in conflict with some other keys which are already used on the machine for other purposes.

There is also a useful plugin which is available on Jenkins which is used in all of my jobs to solve this issue – The ‘Workspace Cleanup Plugin’. More info available @ https://wiki.jenkins-ci.org/display/JENKINS/Workspace+Cleanup+Plugin

Hope this post helps!

Regards,

VJ