DevOps Zone is brought to you in partnership with:

Alex Soto discovered Java during second year of his studies in computer science and wrote his Master's Thesis on Emergent Intelligence applied to Data Mining, winning the second prize of Hermano Salvador González contest. During his 11 years of software development, Alex has worked in several companies as technical consultant, and currently is working as technical analyst at a major international pharmaceutical company developing in-vitro medical software meeting FDA standards, where performance and safety is "a must". Alex also works as tutor at Open University of Catalonia (UOC), teaching Compilers course. He spends his free time to write in his blog (http://www.lordofthejars.com) where some posts are published in sites like dzone, theserverside and springsource. Alex has spoken at Devoxx 2011 and Linuxtag 2012. Currently is developing NoSQLUnit, a JUnit extension for testing NoSQL systems. Alex is a DZone MVB and is not an employee of DZone and has posted 32 posts at DZone. You can read more from them at their website. View Full User Profile

Jenkins Description Setter Plugin for Improving Continuous Delivery Visibility

01.25.2013
| 3781 views |
  • submit to reddit

In Continuous Delivery each build is potentially shippable. This fact implies among a lot of other things, to assign a none snapshot version to your components as fast as possible so you can refer them through all the process. I suggest creating a release branch, assign the version to the project and then start the typical pipeline (compile, tests, code quality ...) steps to release branch.
If you are using Jenkins, your build job screen will look something like:
Note that we have released the project many times, but there is no quick way to know exactly which version has been constructed in build number 40. To avoid this problem and having a quick overview of which version has been executed in each build job instance, we can use Jenkinsdescription setter plugin. This plugin sets the description for each build, based upon a regular expression of the build log file.

So your build job screen will look something like:
Much better, now we know exactly the result of a build job and which product version has been generated.So first step is installing the plugin by simply going to:Jenkins -> Manage Jenkins -> Manage Plugins -> AvailableAfter installation you can open Build Job configuration screen and add a post-build action called "Set build description". Then add a regular expression for extracting the version number. In this case the regular expression is:\[INFO\]         from version 0\.0\.1-SNAPSHOT to (.*)Take a look at next fragment of build log file:

[INFO] Scanning for projects...
[INFO]                                                                        
[INFO] ------------------------------------------------------------------------
[INFO] Building hello 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- versions-maven-plugin:2.0:set (default-cli) @ hello ---
[INFO] Searching for local aggregator root...
[INFO] Local aggregation root: /jobs/helloworld-inital-build/workspace
[INFO] Processing com.lordofthejars.helloworld:hello
[INFO]     Updating project com.lordofthejars.helloworld:hello
[INFO]         from version 0.0.1-SNAPSHOT to 1.0.43
Props: {project.version=1.0.43, project.artifactId=hello, project.groupId=com.lordofthejars.helloworld}

At line 12 we are logging the final version of our product for current pipeline execution, so we create a regular expression which parses that line and the part between brackets are used as decorator.Depending on log traces the regular expression will differ from this one. In this case, we are always using the same SNAPSHOT version in development and only when product is going to be released (this could be 3 times per day or every night) the final version is generated and set.Hope this plugin helps you to make your builds more clear.

Published at DZone with permission of Alex Soto, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Dejan Stojadinovic replied on Mon, 2013/01/28 - 3:24pm

Thanks for the tip, Alex :)

It seems that two similar plugins can be used for a project description:
https://wiki.jenkins-ci.org/display/JENKINS/Description+Setter+Plugin
https://wiki.jenkins-ci.org/display/JENKINS/Project+Description+Setter+Plugin

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.