Search This Blog

Showing posts with label JIRA. Show all posts
Showing posts with label JIRA. Show all posts

Monday, 5 August 2013

JIRA Split Regex Mail Hander & Multiple Mail Clients

As a follow up to when I first played with this and my organisation was a Domino shop things have moved on.  Now an Outlook AND Domino shop, and the proliferation of mobile devices meant this simple regex wasn't working for heaps of mail clients.

Atlassian documentation is (currently) sparse on the subject, or maybe my lack of regex fu is the problem.  But found this answer on the 'Answers' site :

https://answers.atlassian.com/questions/54911/jira-comments-from-email

My new regex is :

/From: *|___.*|On .*wrote:|----Orig.*|On .*(JIRA).*/
But the power is now in my hands!

Wednesday, 27 February 2013

JIRA Jelly script - Transition to Closed

Over the past year or so I've become a big fan of Atlassians JIRA. I've managed to frig around and get a pretty neat ticket/request solution in place for my company but in doing so I've also become the defacto goto person.

A new project needed to just receive emails, create an issue and then close it. Steps 1 & 2 are simple with IMAP & Mail listeners. But I wasn't aware of a way to carry out 3.

Enter stage left Jelly Scripts. Scripting language supported within JIRA. Turned out to be rather simple and a couple of hours work turned out :

<!-- This script will parse all tickets matching "${filterNum}" and transition them to Closed state. -->
<!-- Paul Regan 27/2/2013 (Thats a UK Date people !) -->
<JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.enterprise.JiraTagLib" xmlns:core="jelly:core" xmlns:log="jelly:log">
<!-- Login as automation user  -->
      <jira:Login username="<jira-user>" password="<password>">

<!-- Set Some variables  -->
      <!-- 2 = Close Issue Transition (NB//TRANSITION NOT STATUS).  Can be seen on the transition URL -->
      <core:set var="workflowStep" value="2" />
      <core:set var="workflowUser" value="<jira-user>" />
      <core:set var="comment" value="This topic has been closed by jelly script automation" />
      <!-- Run the SearchRequestFilter Against a filer.  15231 = All Tickets -1 Day or 15232 = All Open Tickets-->
      <!--The numeric comes from the filters URL -->
      <core:set var="filterNum" value="15232" />
      
<!--Run the search using filter defined above -->
<jira:RunSearchRequest filterid="${filterNum}" var="issues" />

<!-- Build array of issues matching filter & run through it -->
      <core:forEach var="issue" items="${issues}">
      <!-- Log updates are written to /opt/atlassian/jira/data/log/atlassian-jira.log. -->
                <log:warn>Closing issue ${issue.key}</log:warn>
                <jira:TransitionWorkflow key="${issue.key}" user="${workflowUser}" workflowAction="${workflowStep}" comment="${comment}"/>
                
                <!-- Useful debugging aid.  Remark the actions and just use this to write a comment in results -->
                <!-- <jira:AddComment comment="This would be closed" issue-key="${issue.key}"/> -->
                <!-- Useful debugging aid.  Remark the actions and just use this to display results -->
                <!-- ${issue.key} -->

      </core:forEach>
      </jira:Login>
</JiraJelly>



Tuesday, 14 June 2011

JIRA Regex mail handler and Domino

I've been building a JIRA project to consolidate a number of tickets systems that we use. As a previous JIRA hater I started the project with some trepidation. After a month I've actually come right around. I've managed to build something which now has pretty much the same functions as the other bespoke domino systems we use/used and extra. Including some nice workflows for ops work which would impact dev and production.

Something thats bugged us all is the email reply into comments. Our primary mail client, Domino, really wants you to use reply with history, its top of all the menu's, its hard not to pick it. But doing this with JIRA means ALL the email, including history goes into the comment. When a few people get going on email the ticket very quickly becomes un-readable.

Using just 'reply' or 'reply internet style' can be made to work, but both require a conscious decision.

Looking for a way around this the regex mail handler looked promising. My initial attempt :

project=NAME, issuetype=##, createusers=false, splitregex=/From:/gi

Failed, the regex looks OK to me. A ticket with Atlassian came back with the suggestion :

project=NAME, issuetype=##, createusers=false, splitregex=/From:*/

Which works fine .. no more email junk even if the user replies with history.