You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
Hi awesome community!
So automated housekeeping is good. If you want you can checkout (Cleanup-Jira-Part-1, Cleanup-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.
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()
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()
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()
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
Gonchik Tsymzhitov
Community LeaderSolution architect | DevOps
Atlassian community
Russia, St. Petersburg
118 accepted answers
Catch up with Atlassian Product Managers in our 2020 Demo Den round-up! From Advanced Roadmaps to Code in Jira to Next-Gen Workflows, check out the videos below to help up-level your work in the new ...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
4 comments