Incorrect timestamp on the target directory when the Jenkins build is triggered by Gerrit

Our unit tests failures are not being reported by Jenkins. Here's what we see in the build log:

[JENKINS] Recording test results
hudson.AbortException: Test reports were found but none of them are new. Did tests run? 
For example, /home/tomcat/.jenkins/jobs/ws-main-gerrit/workspace/commons/commons-utils/target/surefire-reports/TEST-commons.utils.TransformationUtilsTest.xml is 32 min old

The problem is that when the Jenkins build is triggered by Gerrit it creates the target directory with incorrect (30 minute old) timestamp. The time on the server where Jenkins and Gerrit reside is correct. When I login and do the maven build manually, it correctly reports the failures in the unit tests.

Any ideas what could cause the issue? Thanks in advance!

Answers


The problem was that the NFS where Jenkins resides wasn't using NTP (and was about 30 minutes behind) where the rest of the system was using it. So, that's why the date command was returning the correct timestamp but the files in the target directory where created with the wrong timestamp.


This answer helped me identify the problem but I decided to implement a workaround instead.

I ran this compound command on the Jenkins slave to identify that there was a discrepancy between the slave and the NFS mount that it was using for its workspace:

$ date ; touch this ; ls -l this
Mon Nov 11 10:57:55 CST 2013
rw-rr- 1 davidg devtools 0 Nov 11 10:56 this

I tried the same command on another VM / NFS mount and it had the same discrepancy. I surmised that this is a data center wide issue that may be too difficult to fix very quickly so I decided to workaround the issue by updating the file's modification timestamps manually with the touch command using the "-t" option.

I added the following to an "Execute Shell" build step and Jenkins was finally satisfied that I had current test results to publish:

#!/bin/bash
echo $(hostname)
echo "Touching test results so that the Publish JUnit test result plugin always finds  new results..."
touch -m -t $(date "+%Y%m%d%H%M.%S") ${WORKSPACE}/myjob/target/surefire-reports/*.xml

Need Your Help

Re-painting of JPanel on hover/click of a JMenuItem

java swing jpanel repaint jmenuitem

My desktop Java application has a JMenubar with several JMenuitems, and underneath it is a JPanel which I re-render when an item in the dropdown menu is clicked.

Does assigning objects to null in Java impact garbage collection?

java null garbage-collection

Does assigning an unused object reference to null in Java improve the garbage collection process in any measurable way?