Jira: Housekeeping or continuous cleanup of the Agile activity artifacts

 Hi awesome community! 

 

So automated housekeeping is good. If you want you can checkout (Cleanup-Jira-Part-1Cleanup-Jira-2,)

Today, I would like to share use cases related to the cleanup Agile boards related stuff.

So to make the continuous cleanup I just use the groovy code, which is can be run on any app with support groovy like Scriptrunner, myGroovy, Grooviouli. 

Let’s start it.

Use case #1: Users are experimenting with Agile boards, own private boards, sometime you do migration. Then once your sprint reports shows incorrectly, where filters shows interesting things. Please, see below screenshot:

Action: Let’s remove Future Sprint data in Closed issues.

image.png

String jqlSearch = 'Sprint  in futureSprints() and status in (Closed, Done)  '


SearchService.ParseResult parseResult = searchService.parseQuery(loggedInUser, jqlSearch)
if (parseResult.isValid()) {
def searchResult = searchService.search(loggedInUser, parseResult.getQuery(), PagerFilter.getUnlimitedFilter())
def issues = searchResult.issues.collect { issueManager.getIssueObject(it.id) }

for (issue in issues) {
def customFieldsSprints = sprintField.getValue(issue)
log.debug customFieldsSprints
def newSprintValues = []
def changed = false
for (sprint in customFieldsSprints){
if (sprint.state == Sprint.State.FUTURE && !sprint.active){
changed = true
continue;
}
newSprintValues.add(sprint)
}
if (newSprintValues.size == 0) { newSprintValues = null; changed = true; }

sb.append("Removing future sprint for ${issue.key} <br />\n")
if ( changed && !isPreview ){
sprintField.updateValue(null, issue, new ModifiedValue(null, newSprintValues), new DefaultIssueChangeHolder())
boolean wasIndexing = ImportUtils.isIndexIssues()
ImportUtils.setIndexIssues(true);
log.debug("Reindex issue ${issue.key}")
issueIndexingService.reIndex(issue)
ImportUtils.setIndexIssues(wasIndexing)
}
}
}

return sb.toString()

Full reference: in git

Conclusion: Time to time automated activities is efficient.

 

Use case #2: Once you do search using  JQL, like sprint = 12332, and total issues is 0. So You made reindexing, after you start to think, is this just some scrum master create Sprints and forgot to put issues. After investigation, you can find a lot of Sprints. As result, of that, most users are confused by searching by sprints. 

Action: Let’s remove unused sprints from our Jira instance.

sprintManager.getAllSprints().value.findAll {
!it.closed
}.findAll { Sprint sprint ->
def query = jqlQueryParser.parseQuery("sprint = $sprint.id")
def hasNoIssues = !searchService.searchCount(user, query)
if (hasNoIssues) {
log.warn("Found sprint '${sprint.name}' with no issues.")
sb.append("Found sprint '${sprint.name}' with no issues.<br />\n")
}
hasNoIssues
}.each { Sprint sprint ->
if (!isPreview) {
sb.append("Removing sprint ${sprint.name} <br />\n")
log.warn("Removing sprint ${sprint.name}")
sprintManager.deleteSprint(sprint)
}
}

return sb.toString()

Full reference in git: 

Conclusion: Good to have copy/paste solution :)

 

 

Use case #3: Users are working frequently with filters, like add, edit, remove. (Of course, after that feature in our company filter stoped growing like exist situation https://confluence.atlassian.com/adminjiraserver0713/managing-shared-filters-964984171.html). Time to time, you can find unaccessible agile boards, which is lost long time ago a filters and users are already create a new one, because they just removed filters, instead of  remove first referenced agile board, dashboards and then filter.

 

Action: Let’s remove Agile boards without core filters.

sb.append("<b>Board id</b> - Name - <b> Owner </b><br />\n")
rapidViewManager.getAll(new NoCheck()).value.each { b ->
if (srm.getSearchRequestById(b.savedFilterId) == null) {
if (!isPreview) {
def res = rapidViewManager.delete(b)
}
sb.append("${b.id} - ${b.name} - ${b.owner}<br />\n")
}
}

return sb.toString()

Full reference in git 

 

I hope it helps for you. ( all info you checkout here https://github.com/gonchik/cleanup-scripts/tree/master/groovy/agile)

Have a good cleaning.

 

Cheers,

Gonchik Tsymzhitov

Comments

  1. It is truly a well-researched content and excellent wording. I got so engaged in this material that I couldn’t wait to read. Read more info about professional housekeeping Toronto. I am impressed with your work and skill. Thanks.

    ReplyDelete
  2. Excellent job, this is great information which is shared by you. This info is meaningful and factual for us to increase our knowledge about it. about Buy floor scrubber tennant Online USA So please always keep sharing this type of information.

    ReplyDelete
  3. I generally check this kind of article and I found your article carpet cleaning Aylesbury which is related to my interest. Genuinely it is good and instructive information. Thankful to you for sharing an article like this.

    ReplyDelete

Post a Comment

Popular posts from this blog

How only 2 parameters of PostgreSQL reduced anomaly of Jira Data Center nodes

Atlassian Community, let's collaborate and provide stats to vendors about our SQL index usage

Stories about detecting Atlassian Confluence bottlenecks with APM tool [part 1]