How you can achieve compact and easy-to-maintain workflows in your JIRA( Server)

This approach requires you to have the JIRA administrative rights.

The main aim of this article is to help you achieve an organized, easy-to-maintain workflows in your JIRA instance thereby, reducing maintenance complexity, and this is specially dedicated to the JIRA administrator or any one responsible for managing workflows in JIRA. In order to achieve this aim, you may need to consider the following points.

  • Merging similar workflows to be used in several projects.
  • Eliminating workflows and workflows schemes that are not currently used.
  • Re-using workflows as much as possible.

 

Merging similar workflows: At some point in time you may realize that your workflow structure looks like a spider’s nest. Therefore, you would need to deal with this situation. First of all, merging workflows can be tedious and time consuming but worth it. You will need to identify all workflows with the same steps by:

  • logging in as JIRA administrator,
  • going to Administration icon > Issues > Workflows,
  • in this view, iterating through all workflows and filtering all those with the same steps. You could copy and keep them in your Word document or any text editor of your choice.

I would suggest that steps column should have the possibility of being sorted, this will make it easy to get all steps(similar) by just sorting them and copying the list to your text file unfortunately, such a feature has not been implemented in JIRA.

In the same workflows view mode, you are able to see all the workflow schemes which the workflow is assigned to - click on the link to navigate and see all the projects using this workflow. Do the same for the next workflow with the same steps to find all projects using this workflow and so on. Since they have the same steps, check the workflow settings, and then decide which one of them to use from the list. You will  need to associate issue type(s) to this workflow in these projects which you have found by:

  • going to Administration icon > Issues > Workflow schemes,
  • searching for the scheme - there you can associate an issue type to a workflow.

Sometimes, you may need to use the same workflow scheme for these projects since the projects  are using these same workflow mapping to issue types except for the workflow that has the same steps mapped to any other issue type.

One may ask the question; “what if I have workflows with same steps but different settings  in conditions, validators, post functions, triggers, properties? Why should I merge these workflows together? ” Well the answer is that you will need to decide whether you want to have the same settings for multiple projects or to not have any of these settings at all, since many projects could use the same settings depending on  the workflow requirements. I have encountered many cases where I could use similar workflows  in different projects.

In conclusion to this point, you are able to reduce similar un-necessary workflows by  using one instead of many similar workflows. After merging workflows, in the long run you would realize that you have reduced complexity. Please Note if you don’t have to merge similar workflows then don’t .

Remove un-necessary workflow schemes:

  • log in as JIRA administrator,
  • go to the administration icon > Issues > Workflow schemes,
  • scroll down and look for > inactive,
  • expand it by clicking > to see the list of schemes that are not in use.

To clean them up, it can be cumbersome to delete them one after the other. I was doing it manually until I decided to automate this process thanks to Script runner plugin for JIRA /Groovy programming language.




//Here is a  working groovy script: script should surely work for JIRA 7.x  and above

//Minor variable change from  my side




import com.atlassian.jira.component.ComponentAccessor

def schemeManager = ComponentAccessor.workflowSchemeManager


def delete_workflow_scheme= new StringBuffer()


schemeManager.schemeObjects.each {

 try{

   if(schemeManager.getProjectsUsing(schemeManager.getWorkflowSchemeObj(it.id)).size() == 0) {

     delete_workflow_scheme.append("Deleting workflow scheme: ${it.name}\n")

     schemeManager.deleteScheme(it.id)

   }

 }

 catch(Exception e) {

   delete_workflow_scheme.append("Error: " + e + "\n");

 }

}

 return delete_workflow_scheme.toString()

 

Reference: @Bill Neff  Thanks for the inspiring code.

Remove all in-active workflows :

  • Login in as JIRA administrator,
  • go to the Administration icon >Issues >Workflows,
  • scroll down and look for > inactive,
  • expand it by clicking > to see the list of workflows that are not in use.

Please note ! in order to delete inactive workflows you will have to remove workflow schemes, then you can now go ahead to remove workflows not in use.

 

//Here is a  working Groovy script: script should  surely work in JIRA 7.x  and above

//Minor variable change from  my side




import com.atlassian.jira.component.ComponentAccessor

def workflowManager = ComponentAccessor.workflowManager

def schemeManager = ComponentAccessor.workflowSchemeManager




def Delete_Work_Flow = new StringBuffer()


workflowManager.workflows.each {

    if(!it.systemWorkflow) {

        def schemes = schemeManager.getSchemesForWorkflow(it)

        if (schemes.size() == 0) {

            Delete_Work_Flow.append("Deleting workflow: ${it.name}\n")

            workflowManager.deleteWorkflow(it)

        }

    }

}




return Delete_Work_Flow.toString()

Reference: @Jeff Ward  Thanks for the inspiring code

Re-use workflows:

To achieve this in a proper manner, if your organization uses JIRA to support development teams, internal users who are using JIRA projects to manage their  products, then I recommend that you create a special project, for example JIRA-Refinement(JIR) that users could create request ticket in this project for the creation of  new Jira projects by the JIRA administrator. You can add the workflow  field on the create issue screen  for example

 

Capture.PNG

From the image above, you can see that users need to choose already existing ones  or  new workflow, most times already existing ones are being choosing since you have already discussed with various teams regarding workflows A, B and C; if at all they  choose new, then they would need to add attachment to show a vivid picture on how the workflow should look like. Check whether or not the workflow which  they have requested for already exist without any special settings in workflow, then  reuse it this way you keep workflows compact. Note that when you create a new project in JIRA default work is automatically added. Thus, you will  need to change the workflow / workflow scheme in this project. Default workflow for the project will  move to inactive workflow / workflow schemes :) we know how to remove them !

 

I hope that some one find's this article useful.

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events