The Mystery of the Failed Jenkins Build

By | September 2, 2013

Lately, I have had the opportunity to set up a Jenkins (http://jenkins-ci.org/) build server and the associated software as well as migrating Jenkins jobs from an old server.
In this process I encountered builds that failed for some mysterious reason that I weren’t able to determine from the console log of the build supplied by Jenkins.
The log below originates from an attempt to perform a Maven release with Jenkins.

It looks like everything is going well until suddenly there is a build failure.

Locating the Workspace

After some time I came to think of the idea to try to perform the Maven release from the Jenkins server.
To do this, I first had to locate the workspace of my Jenkins job – the one that can be viewed from within Jenkins in the following view:

Jenkins Workspace

On the server which Jenkins is deployed, the default Jenkins home directory is a directory with the name “.jenkins” in the home directory of the user which run Jenkins.
In the Jenkins home directory, there is a “jobs” directory in which there will be one directory for each job. If I log into the Jenkins server and change directory to the directory of the failing job, there will be the following files and directories (variations may occur):

Going into the “workspace” directory, there are the following files:

Here I find a Maven pom.xml file, thus this is the directory I want to be located in when attempting a Maven release.

Attempting a Release

I use the Maven release plugin (http://maven.apache.org/maven-release/maven-release-plugin/index.html) to perform my releases, so in the console I enter the following to prepare for a dry-run of the release:

Note that I have on an earlier occasion entered the Subversion credentials needed to connect to my source-code repository.

When Maven is preparing the release, I now see some console output that did not show up in the Jenkins GUI and I am able to determine the cause of the failed build.
If, for some reason, the release preparations do succeed, I continue by attempting a dry-run of the release:

Reasons for Failure

Some of the reasons for a build “mysteriously” failing in Jenkins that I have seen are:

  • Having forgotten to install a Subversion client.
    I use Subversion and, in order for Jenkins to be able to connect to my source-code repository, the “svn” command has to be installed in the Linux environment in which I have deployed Jenkins.
  • A mismatch between the Subversion working copy format version and the working copy format that the “svn” command is able to handle.
    In my case, I had set the working copy format version in Jenkins to a more recent version than the “svn” command were able to handle.
    The solution is either to change the version configured in Jenkins and wipe all workspaces before attempting any builds or to updated the “svn” command.

Leave a Reply

Your email address will not be published. Required fields are marked *