Skip to content

Instantly share code, notes, and snippets.

@esutton
Last active July 12, 2018 18:21
Show Gist options
  • Save esutton/6b5251dbc47d0a30d959ac8934e9b563 to your computer and use it in GitHub Desktop.
Save esutton/6b5251dbc47d0a30d959ac8934e9b563 to your computer and use it in GitHub Desktop.
Jenkins Plugin Git Changelog Setup for Bugzilla

Jenkins Plugin Git Changelog Setup for Bugzilla

How to setup Jenkins Plugin Git Changelog and support custom issues.

  1. Select job > Configure
  2. At bottom, select Add post-build action > Git Changelog

Create File

ToDo: This needs improvement. It is hard to distinguish grouping of gits commit hash and issues.

<h1> Git Changelog changelog </h1>

<p>
Field Scout Git Changelog
</p>

{{#tags}}
<h2> {{name}} </h2>
 {{#issues}}
  {{#hasIssue}}
   {{#hasLink}}
<h2> {{name}} <a href="{{link}}">{{issue}}</a> {{title}} </h2>
   {{/hasLink}}
   {{^hasLink}}
<h2> {{name}} {{issue}} {{title}} </h2>
   {{/hasLink}}
  {{/hasIssue}}
  {{^hasIssue}}
<h2> {{name}} </h2>
  {{/hasIssue}}

  {{#commits}}
<a href="https://subsite.visualstudio.com/DefaultCollection/_git/field-scout/commit/{{hashFull}}">{{hashFull}}</a> {{authorName}} <i>{{commitTime}}</i>
<p>
<h4>{{{messageTitle}}}</h4>

{{#messageBodyItems}}
 <li> {{.}}</li> 
{{/messageBodyItems}}
</p>
  {{/commits}}

 {{/issues}}
{{/tags}}

Custom Issues

  • This works but does not sort by most recent date first?
  • Can sorting be controlled in template so everything is assorted by most recent date first??

How sorting works:

  1. It seems to work by sorting in ascending bug number order; 123, 124, 126
  2. Appends remaining commits with missing "Bug" prefix, sorted most recent date first.

Assuming:

  • Git commit comments are in the format of "BUG 1234 - Fixed memory leak"
    • git commit -am 'BUG 1234 - Fixed memory leak
  • Bugzilla server URL format to display Bug 1234
    • http://server/bugzilla/show_bug.cgi?id=1234

The template references parameters: name, link, issue, and title.

Example:

<h2> {{name}} <a href="{{link}}">{{issue}}</a> {{title}} </h2>
   {{/hasLink}}
   {{^hasLink}}

Setup Custom Issue

Note: First three fields seem to be required before input will be saved? Title can be blank.

  • Name: *
  • Pattern: Bug\s([0-9]+)(.*)
  • Link: http://server/bugzilla/show_bug.cgi?id=${PATTERN_GROUP_1}
  • Title:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment