Versioner sammenlignet

Nøgle

  • Linjen blev tilføjet.
  • Denne linje blev fjernet.
  • Formatering blev ændret.

JIRA Jira can be very efficient, but out of the box not no real automation exists..

If the "earlier days", the only way to do this was JellyScript - a horrible XML implementation of scripting, java wrapped in XML..

 

Interfacing

These days several other ways exist:

Script/TypeComments
Automation App

Almost standard now-a-days... (and You get it automatically in cloud)

Some Apps, like JSU App and Script Runner App offer parts of automation

Atlassian CLI
My favorite, used in Making a free JIRA Scheduler 

Can be "integrated via shell calls from script, powershell and other programming languages.

As it is java based, it is virtually platform independant, the main downside is that is is slow.

JIRA JellyScript
Se atlassian
GroovySupported by the Script Runner plugin - This should be very goodREST/SOAP

 

Status
colourRed
titleDeprecated

Script Runner App

See some samples at library.adaptavist.com

REST APIInterfacing with JIRA through webservices

...

- REST, The SOAP and XML-RCP is deprecated


Scheduling

The internal JIRA Scheduler via implemented in Services really sucks - only setting is a "pr. minute" count called delay, and this:


  • Resets when JIRA is restarted

  • Is relative from JIRA Start, so You can't schedule "at midnight"

...


Hence, use another Scheduler if the timing must be right, lige like tweaking my Making a free JIRA Scheduler or buy TheScheduler Plugin

Or create Your own.... 


Hiding Auto Transitions

Problem

Often, You want the Automation and the User to perform the same transitions, or the Scheduler Automation to do extra "invisible" stuff, - a hre You can:This can be tricky, also because any validations not handled in the transitionscript will cause a fail:

Kodeblok
2014-05-05 22:46:30,674 QuartzScheduler_Worker-3 INFO ServiceRunner    CloseResolvedIssues [jira.jelly.service.JellyService] JellyService.run
2014-05-05 22:46:30,803 QuartzScheduler_Worker-3 ERROR anonymous    CloseResolvedIssues [jira.jelly.service.JellyService] file:/pack/jira-jelly/support-closeresolved.xml:48:125: <jira:TransitionWorkflow> The following problems were found:
customfield_12922: ITIL Tag is required.
org.apache.commons.jelly.JellyTagException: file:/pack/jira-jelly/support-closeresolved.xml:48:125: <jira:TransitionWorkflow> The following problems were found:
customfield_12922: ITIL Tag is required.
	at com.atlassian.jira.jelly.tag.JellyUtils.processErrorCollection(JellyUtils.java:24)
	at com.atlassian.jira.jelly.tag.issue.TransitionWorkflow.doTag(TransitionWorkflow.java:133)
	at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:247)


Solution

Create an "automationservices" group

...

Setting fields correctly:

Advarsel

If You encounter this error in the logs:

Kodeblok
2014-06-10 08:01:43,716 QuartzScheduler_Worker-2 WARN automaticservices    CloseinactiveSupportIssues [jelly.tags.log.WarnTag] Inactivating issue MYPROJECT-151
2014-06-10 08:01:43,825 QuartzScheduler_Worker-2 ERROR anonymous    CloseinactiveSupportIssues [jira.jelly.service.JellyService] file:/pack/jira-jelly/support-closeinactivate.xml:48:145: <jira:TransitionWorkflow> Field 'resolution' can not be set on action with no screen
org.apache.commons.jelly.JellyTagException: file:/pack/jira-jelly/support-closeinactivate.xml:48:145: <jira:TransitionWorkflow> Field 'resolution' can not be set on action with no screen

This is typically due to the script is a copy/similarity of https://confluence.atlassian.com/display/JIRA/Jelly+Escalation and the line:

Kodeblok
<jira:TransitionWorkflow key="${issue.key}" user="${workflowUser}" workflowAction="${workflowStep}" comment="${comment}" resolution="Customer Timeout"/>

Setting a field on the Jelly "jira:TransitionWorkflow" requires a screen with the field, therefore - set it in the Post Function

Advarsel

A real-life example:

I created an onComment Listener in Groovy, that transistet Issue when a Comment came in, a code snippet is:

Kodeblok
workflowTransitionUtil.setUsername(currentuser); 
workflowTransitionUtil.setAction (transition) 
// Validate and transition issue 
workflowTransitionUtil.validate(); 
workflowTransitionUtil.progress();

This code is valid, but in the "Post Function" of the Transition was:

Kodeblok
Fire a Issue Commented event that can be processed by the listeners.

Hence, the script re-fired itself, which is not good...