Our Favorite Continuous Delivery Tools
Join the DZone community and get the full member experience.
Join For FreeWe’re working hard in the Logentries towers to integrate our continuous delivery tools, so we can identify and track issues as easily as possible. This saves us time that we can spend on important things like adding new features (or playing pool!).
We use a lot of tools to manage our development cycle, and we’ve made them interact too.
We use JIRA (by Atlassian) to plan our work, Gitlab to manage our code, and Jenkins for our continuous integration.
Does Mr Jenkins Approve?
Merge requests (a.k.a. a pull request in github) aren’t accepted in Logentries until Mr Jenkins is happy with it.
Mr Jenkins is listening, and whenever a new merge request is submitted, he’ll go through it with a fine-tooth comb. If he’s not happy, he’ll reject it.
People don’t like Mr Jenkins, he’s pedantic.
Not only does he perform all of our tests (which the developer will have run before submitting a merge request, but you never know…), he also performs style checks and static analysis depending on the language:
Once he’s done with his tests, Mr. Jenkins will vote on the merge request:
Implementation
This integration is actually very simple to implement thanks to a great Jenkins plugin: theGitlab Merge Request Builder Plugin. Once you create Mr. Jenkins’ account on your gitlab site and install the plugin, you can have automatic builds running in 5 minutes.
Why You Should Bother
If you run Jenkins builds against code before it gets merged into a central branch, it can be fixed before it gets accepted!
You have to work on Stories
<—>
We don’t think we’re unique in planning our work.
We hope we’re not unique in planning our work…
We use JIRA to write stories which our developers work on, along with the occasional bug, and we’ve integrated our JIRA stories into Gitlab.
Gitlab can be customised to perform pre-receive checks on any commits pushed to the server.
We’ve written a Ruby script that checks every commit pushed to our gitlab server, and confirms the commit message mentions a JIRA issue that’s in progress or blocked.
If no issue is mentioned, the push is rejected. Ouch.
If an issue is mentioned, the script goes ahead and comments on the mentioned JIRA issue to say that a commit has been made.
- Now we can track all the work that’s been done on a story in JIRA.
- Now we can see the JIRA issue that each commit relates to in Gitlab.
Awesome.
Implementation
Jira has a well documented API which is pleasant to use.
You need to update your pre-receive hook file in:
${Git installation directory}/gitlab-shell/hooks/
Then, check if the commit message mentions a jira issue
$oldrev = ARGV[1]$newrev = ARGV[2] revision_list = IO.popen(%W(git rev-list ^#{$oldrev} #{$newrev})).read revision_list.split(“\n”).each do |rev|commit_msg = IO.popen(%W(git log –format=%B -n 1 #{rev})).readissues = commit_msg.scan(/(jira[- ]?\d+)/i)if issues.empty?puts “No issue mentioned”exit 1endend |
Once you’ve found issue IDs, check if the issues are open using the JIRA api, and then post a comment. These steps are long, but not complicated.
An Easy Shortcut for Lazy Developer
It can be a bit of a pain remembering the exact code of your issue (and typing it in every time), so our developers just put the JIRA issue ID in the branch name and use a handy script we found here to automatically put the branch name in each commit message.
BRANCH_NAME=$(git symbolic-ref –short HEAD)if [ -n "$BRANCH_NAME" ] && [ "$BRANCH_NAME" != "master" ]; thensed -i.bak -e “1s/$/ [$BRANCH_NAME]/” $1fi |
Why You Should Bother
Having your git push rejected seems like a huge irritation, but most people are used to a little rejection(#risqué joke), and after a couple of failures, you’ll remember to mention the right ID.
This results in a huge amount of time saved for planners, because they now know exactly what’s being done on that. We also have a great, interlocked, history between our revision control system and our planning system.
All Over the Shop
All of this data is a pain to manage and compare when it’s spread across so many products.
Happily enough, we have just the ticket to fix that… There’ll be another blog post soon on how we’ve integrated our CD tooling into Logentries and how we’re using it.
Published at DZone with permission of Trevor Parsons, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments