Skip to end of metadata
Go to start of metadata

Plugin Information

View description setter on the plugin site for more information.

This plugin sets the description for each build, based upon a RegEx test of the build log file.
To use the plug in, you must tick it in the Post Build Actions, in your job configuration page. Once ticked, you will notice that it asks for a RegEx. This RegEx is used to scan the build log file, line by line (multi lines are not supported), and it will take the first line that matches your RegEx. The description that is then set for that particular build, is by default taken from the first Capturing Group. You must specify at least one capturing group in your RegEx by putting the part you want to select between parentheses (if you specify more, these will be ignored).

You can thus use this to have your build script echo out some particular information such as the modifying authors from SCM, or the datestamp, or the published version number, or....

For example, if your build file contains the lines

...
[version] My Application Version XYZ
...

Then in order to set the build description to My Application Version XYZ, you would set the RegEx to be:

\[version\] (.*)

A Maven release build would typically have a line like:

...
[INFO] Uploading project information for my.project.name 0.4.0
...

So the following regex would select the version:

 .*\[INFO\] Uploading project information for [^\s]* ([^\s]*)

People interested in this plugin might also find Build Name Setter Plugin useful, as it does similar thing for the display name, instead of description.

Using multiple capture groups

You can now use different groups captured by the RegEx (e.g. "foo \1 bar \2") by referencing them in the Description field. (If you leave the description field empty, the first match group will be used.)

Changelog

Release 1.9 (Jun 13, 2014)

  • Set description during build as a build step (JENKINS-23097)
  • Updated maven pom to use repo.jenkins-ci.org repository
  • Localization for ja

Release 1.8 (Mar 26, 2011)

  • Handle regex matches even when the match group element is null.

Release 1.7 (Dec 31, 2010)

Release 1.6 (Dec 1, 2009)

  • Bugfix (1.5 is only usable for matrix projects)

Release 1.5

  • Large parts are rewritten. Should be backwards compatible -- create an issue if not.
  • You can now use groups captured by the regex in descriptions (e.g. "foo \1 bar \2"). Default is still to use the first group as description.
  • Also works for matrix projects

Release 1.4

  • Added option "Use explicit description instead of regexp".  Allows user to hard code the description instead of doing a regexp search of build log.  Default is off.

Release 1.3

  • Fixes an issue where the RegEx could return only 1 item and cause and array out of bounds problem. 

Release 1.2

  • Add ability to set the description for failed builds. On your job configuration page you will need to check the box for setting description upon build failure and if you wish to use a different RegEx then the main one you can enter it in the text box below.

36 Comments

  1. Unknown User (nhahn)

    Is the description available as an environment variable for another plug-in (i.e Editable Email Notification) to use?

    1. Unknown User (rakesh.second@gmail.com)

      Hi,

      I also have the same requirement. I want the description exposed as a variable so that it can be sent in an email.

      --Rakesh

  2. Is it possible to use environment variables in the description? I tried to use the build number like:

    ${env['BUILD_NUMBER']}
    

    but it didn't get expanded :(

    1. Can you try ${BUILD_NUMBER}

  3. Unknown User (dvsreddy@cisco.com)

    Is it possible to format the data in description tab? If yes example please .

    If no any suggestions, would like to format a huge string in multiple lines.

    1. The description can contain formatted html

      1. I don't manage to add new line in description field. I try formatted html (with <br> for example) but it don't work

        Can you please give an example to achieve this ?

  4. Hi,

    I'd like to be able to also set the display name.  It would be very convenient to be able to do this in the same plugin.  I don't see an easy way to accomplish the same thing with the Build Name Setter plugin.

    Thank you

  5. Hi,

    An example on how to set dynamic image (QR code) in description to download generated artifact.

    http://jmlaboratory.blogspot.com/2012/02/qr-code-to-test-your-android.html

    Regards,

    Jean-Marc

  6. The plugin help documentation (when ? icon in the job) seem to be outdated regarding the replacement string.

  7. Could anyone please tell me, May I create the regular expression to look the slave job log for setting/displaying description in Master job ?

  8. That's a nice plugin but I think it messes with my exit status from scripts. The output I get is

    Script exited with status 512
    Description set: 'Build failure for CS2893774'
    Finished: SUCCESS

    Is it possible that the description execution is overriding the exit status?

    1. Scratch that - exit code 512 is not recognized in csh.

      Great plugin!

  9. Use \1 .. \x to reffer to regex groups in the description field

  10. Use \1 .. \x to reffer to regex groups in the description field

  11. Is it possible to have the last line that match instead of the first one?

    1. +1 on this request. Bonus points if it could be a configuration option to select first or last.

      Thanks for the useful plugin!

  12. The latest update makes the plugin append the description instead of replacing it. (See https://issues.jenkins-ci.org/browse/JENKINS-26671 ) This can be a problem when using matrix configurations. Even with only a post-build step, my description ends up being something like:

    2.0.1.1400
    2.0.1.1400
    2.0.1.1400
    2.0.1.1400

    if there are 4 configurations in the matrix.

    Could the "append" behavior be optional?

  13. I would like to update a JOB's description as a build step. NOT the BUILD description.

    Are there any plans for this? 

  14. I can only successfully use the first capturing group and I'm unable to extract a string from the second capturing group.

    I am entering the following in the "Regular Expression" field:

    (FirstString.*)|(SecondString.*)/g

    Then in the "Description" field I have:

    FirstGroup is \1 SecondGroup is \2

    Anyone see what i'm doing wrong?

  15. Is it still possible to set the description for failed builds ? 

     don't see any checkbox on the configuration page of my job.

    1. Yes, but you need to add "Set build description" in "Post-build Actions" section instead of in "Build" section. Then, click on the button "Advanced..."  :)

      1. Unfortunately I don't see this choice in the Post-build Actions section ..

        1. Solved.

          My "matrix-project" plugin was too recent for my Jenkins version. Anyway, thanks for the quick response.

      2. Wow, thanks! I really missed that part that it is hidden under "Advanced..." for failed builds!

        Probably need to make it equal to Successful builds by default if regex for failure is empty.

  16. Hi, can someone please explain a bit more about "Set description on multi-configuration build" checkbox?

    It says something about "multi-configuration" builds, but what is it?

    If it is about those builds created with help of MultiJob plugin, then:

    - Does this mean that the Upstream build description will be set to one of Downstream builds?

    - Where should I set it - in the Upstream build or in the Downstream build or both?

    Thanks,

    Pavel

    1. Multi-configuration builds are using the "Matrix Project" plugin, a.k.a. "Multi-configuration project" in the "new job" page. The checkbox makes it so that the matrix parent build will be assigned a description from one of the child builds.

  17. Am I correct in assuming this plugin won't be needed for Jenkins Pipeline job types since the job DSL allows direct appending/setting of currentBuild.description ?? In which case, I wonder how we reproduce the console output regex-matching of this plugin.

  18. I'll update the topic of multi-configuration builds. This is how it's stated to work:

    Also set the description on a multi-configuration build.  - The first description found for any of the invididual builds will be used as description for the multi-configuration build. This only applies to multi-configuration projects.

    Unfortunately it's not working that way anymore. Right now (tested on 1.10) it's appending description of each sub-builds to description of main multiconfig build. In my case it was setting svn revition in descriptions about 20 times. This case is described here:

    https://issues.jenkins-ci.org/browse/JENKINS-28006

    It was supposedly fixed within other ticked but not released yet - fix is from September 2015 which points that this plugin is not properly released for quite some time.

    https://issues.jenkins-ci.org/browse/JENKINS-30167

    You can download sources and build plugin with maven but if you're lazy enough, you can always use what I've already built :)

    description-setter-plugin-1.11-SNAPSHOT.tar.gz

    description-setter-plugin-1.11-SNAPSHOT.zip

    1. I found out that this improvement was not applied to matrix build description. I've done small fix so current setting is also applied to matrix build description.

      description-setter-plugin-1.11.2-SNAPSHOT.tar.gz

      description-setter-plugin-1.11.2-SNAPSHOT.zip

      PR also created.

  19. Hi, I face the following situation. I have a build, and the log contains multiple values that I would like to append in the description. All these informations match the same regex. I saw in the code that only the first match is treated. Is there a simple way to treat all matches and to add them all ?

    Damien

    1. I think the easiest way is to use flexible publish which will let you to run description setter for a few times and modify this informations and regex to be a bit different (like enumerate them). Then you can add multiple description setter regexes which would match just one of them at the time and append all of them to description.

      1. Well, it's a way to do it, but right I would have prefered not to change my regex ..
        My build consist in a shell script that run a loop over a bunch of commands. So the outputs are almost the same, and match the same regex. Slightly changing the ouput for each loop does not arrange me. I will work into this, but if anyone has another idea, speak up ;)
        Well, it's a way to do it, but right I would have prefered not to change my regex ..

        My build consist in a shell script that run a loop over a bunch of commands. So the outputs are almost the same, and match the same regex. Slightly changing the ouput for each loop does not arrange me. I will work into this, but if anyone has another idea, speak up ;)

        Damien

  20. OK, I made some ugly code to enable a 'all matches' feature.
    Now if appendMode is enable, you can append all the matches to the description. I'm not a developer, I know it's kind of ugly ... but it works for me.

    The code is here : https://github.com/keydam/description-setter-plugin

  21. I don't manage to add new line in description field. I try formatted html (with <br> for example) but it don't work

    Someone can give an example to achieve this please ?

  22. We use this plugin to create a static link that triggers another project in the same Jenkins. How can we pass the value of the logged in user to the job that is being triggered? 

    Failed using →  http://<myJenkins>/job/dummyJob/buildWithParameters?token=dummyToken&USER=${BUILD_USER}