Child pages
  • Release engineering using Maven and Jenkins

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Unfortunately, configuring Jenkins to perform release engineering is not straightforward. You would hope that it would be a simple case of enabling the Jenkins M2 release plugin for the branch job, but it doesn't work for a couple of reasons:

  • One of our Jenkins slaves build agents uses SVN 1.6 whereas the others use SVN 1.7. Jenkins requires that all workspaces are checked out using the same SVN workspace version, so we have a global "lowest common denominator" setting of 1.6. During a release we check out the working copy as 1.6 but the Maven release plugin attempts to interact with the workspace using the SVN tool's native version, which fails due to incompatibility on all but one of our slaves build agents (the one whose native version is 1.6). The workaround is to lock the Job to a single slave build agent - the one using 1.6, but this applies to all builds - post-commit and release. In addition, I have found various incompatibilities between the 1.6 based slave build agent and various Jenkins plugins (e.g. code coverage is not possible).

  • The Jenkins post job deploy plugins (Artifactory and default) are dumb and don't recognize a release build. Upon completion of a successful release the workspace is left in a state where it contains released artifacts but pom files which have been updated to the next development version. The Jenkins deploy actions then kick in and attempt to redeploy the artifacts which Artifactory correctly refuses due to the version mismatch. The only workaround is to disable the Jenkins deploy actions, and instead deploy directly from Maven during the build (i.e. clean install deploy).

...

  1. lock the job to the SVN 1.6 slave build agent by selecting "Restrict where this project can be run" and specifying the label expression "solaris && x86"

    Also, scroll back up the page to the top section of the configuration to sure that you are using the correct JDK, e.g. set JDK to JDK.

  2. ensure that you have the correct Subversion URL which should point to the branch, e.g: https://svn.forgerock.org/opendj/branches/b2.6-sdk

  3. deselect all build triggers - these builds are triggered manually

  4. configure default build settings, e.g. Maven 3.0.5. The build goals and options are not important since the Maven release plugin will override them I think

  5. enable the M2 release plugin by selecting "Maven release build" in "Build Environment". The goals should look like: "-Dresume=false release:prepare release:perform". Note that you should not enable "Enable Artifactory release management". Set the following "Environment Variables":

    PATH=/opt/SUNWspro/bin:/usr/sfw/bin:/usr/ccs/bin:/usr/local/bin:/usr/bin:/usr/ucb:/bin:/opt/CollabNet_Subversion/bin:/opt/jdk/bin

  6. Remove all "Post Build Actions", especially any that look like they "deploy artifacts".

...

Once you have verified all the settings press "Schedule Maven Release Build" and cross your fingers...