Automated Changelog using JIRA, GitHub, and Jenkins

changelog, github, jenkins, jira

Solution

Since nobody on our team had excess time to devote to this, we ended up throwing together a quick solution.

The Process

- Install and setup the All Changes plugin for Jenkins.

- When we release, we use "build promotion" system which puts stars next to the previous build, so we can easily see the build# looking at the history.

- Copy and paste the relevant output from All Changes into something like notepad++ (human-diff'ing ftw!)

- Run a regex find/replace. Search on the regex string, replace with an empty string. (below -- there's the big-bang option or its broken up for understandability.)

- Manually organize and release in whatever form is the current agreed up standard.

Everything at once

(\s*\(commit:\s[a-z0-9]{40}.\s..detail)|([\r][\n]#.*\B[\r][\n][\r][\n])|(^[ \t]*)

Remove commit hash`\s*\(commit:\s[a-z0-9]{40}.\s..detail`

Remove time and surrounding line breaks`[\r][\n]#.*\B[\r][\n][\r][\n]`

Removing leading whitespace: `^[ \t]*`

The Analysis

Pros:

- Effective overall

- Relatively quick to implement

Cons:

- Not fully automated.

- Need to revert to commit id if you release from multiple Jenkins jobs.

- All Changes history only appears to go back as far as the Jenkins job (I could be mistaken about the specifics of this--I just remember minor grievances with something like this at one point.)

As a whole, the cons are somewhat "the nature of the beast." I'd love to read some other solutions. (For when we have that elusive thing called Time, of course!)

Problem

My team recently switched to all three technologies in the past several months and have worked hard to get it up and running. Next step is automating our changelogs. We have JIRA set up look for the tags (ex. TAG-123) in github commit messages. Jenkins monitors the GitHub commits on a 5 minute timer, pulls, builds, etc. What I would like to see is a changelog generated automatically when a build is marked as "Promoted to Production." I would like to see it do something akin to the following: - Query Jenkins for the previous build marked as a production release and get the corresponding git commit SHA1. - Run a diff in between the current Git commit and the previous commit - Find all JIRA tickets that are referenced - Compile a list of JIRA titles - Have list export to a text file and placed in build drop (bonus if it can be accessed directly through Jenkins as well) Whether this flow is followed as written or not is irrelevant--I'm after the end result and am not looking to re-invent the wheel.. Surely somebody done something like this before? As far as reinvention goes, I was able to find https://wiki.jenkins-ci.org/display/JENKINS/Promoted+Builds+Plugin which allows somebody to piggy-back on the Promote to Production action and run a separate script. It would then be a matter of gathering functionality to accomplish the above. (I also noticed Jenkins can tag the current GitHub commit, which my team would likely do in addition.) Anything closer to accomplishing this would be greatly appreciated. Thank you!

Original source