JIRA とカンバンは初めてです。エピックを作成し、いくつかのストーリーとタスクをそれにリンクするとき、私はそれを期待していました. エピックにリンクされているすべてのストーリーとタスクが完了すると、エピックのステータスが自動的に変更されます (完了など)。しかし、そうではないようです。リンクされたタスクとストーリーがまだバックログにある場合でも、エピックをバックログから完了列に移動できます。JIRA でそれが起こらないようにする方法はありますか?
3511 次
3 に答える
1
多分それはあなたを助けるでしょう:私はシステム言語を「ロシア語」に設定してjiraを使用しました(そして私はグルービーが苦手です)、それが以下のスクリプトに言語の依存関係が含まれている理由です(私のjiraシステム言語とは異なるものを使用する場合はコードを編集する必要があります!最小の変更)
- Scrip Runner プラグインを使用する
「カスタム リスナー」を作成し、コードを貼り付けます (コードはあまり良くありませんが、機能しています)。
import com.atlassian.jira.component.ComponentAccessor; import com.atlassian.jira.issue.IssueManager; import com.atlassian.jira.issue.Issue; import com.atlassian.jira.issue.link.IssueLinkManager; import com.atlassian.jira.issue.link.IssueLink; import com.atlassian.jira.issue.ModifiedValue; import com.atlassian.jira.issue.util.DefaultIssueChangeHolder; import com.atlassian.jira.issue.customfields.option.Options; import com.atlassian.jira.issue.customfields.option.Option; import com.atlassian.jira.issue.fields.config.FieldConfig; import com.atlassian.jira.issue.customfields.manager.OptionsManager; import com.atlassian.jira.ComponentManager; ComponentManager componentManager = ComponentManager.getInstance(); def groupMan = ComponentAccessor.getGroupManager() def authCon = ComponentAccessor.getJiraAuthenticationContext() def customFieldManager = ComponentAccessor.getCustomFieldManager() def changeHolder = new DefaultIssueChangeHolder(); IssueManager issueManager = ComponentAccessor.getIssueManager(); OptionsManager optionsManager = componentManager.getComponentInstanceOfType(OptionsManager.class); IssueLinkManager issueLinkManager = ComponentAccessor.getIssueLinkManager() def curUser = authCon.getUser() def issue = event.issue def epicLinkCf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Epic Link'} if(!epicLinkCf) {log.warn "No Epic Link field"; return} log.warn "Existing Epic Link: ${epicLinkCf.getValue(issue)}" String epicIssue = epicLinkCf.getValue(issue) Issue epic = issueManager.getIssueObject(epicIssue) // epicKey is passed into your script // Check if Epic link is exist if(!epic) return true def newEpicState = "Сделано" log.warn "Epic: " + epic List<IssueLink> allOutIssueLink = issueLinkManager.getOutwardLinks(epic.getId()); for (Iterator<IssueLink> outIterator = allOutIssueLink.iterator(); outIterator.hasNext();) { IssueLink issueLink = (IssueLink) outIterator.next(); log.warn "child link type: " + issueLink.getIssueLinkType().getName() // Check status of all issues from epic if (issueLink.getIssueLinkType().getName() == "Epic-Story Link") { Issue chIssue = issueLink.getDestinationObject(); log.warn "child state: " + chIssue.getStatusObject().getName() if(chIssue.getStatusObject().getName() == "В процессе") { newEpicState = "В процессе" } else if (chIssue.getStatusObject().getName() != "Закрыто" && newEpicState != "В процессе") { newEpicState = "Сделать" } } } def epicStatusCf = customFieldManager.getCustomFieldObjects(epic).find {it.name == 'Epic Status'} log.warn "Current epic status: " + epicStatusCf.getValue(epic) FieldConfig epicStatusFieldConfig = epicStatusCf.getRelevantConfig(epic); String oldStatus = epicStatusCf.getValue(epic) log.warn "New epic status: " + newEpicState // Set new status if it necessary if (oldStatus != newEpicState) { Options epicStatusOptions = optionsManager.getOptions(epicStatusFieldConfig); Option epicStatusDoneOption = epicStatusOptions.getOptionForValue(newEpicState, null); epicStatusCf.updateValue(null, epic, new ModifiedValue(epic.getCustomFieldValue(epicStatusCf),epicStatusDoneOption),changeHolder) log.warn "Epic status is updated!" }
于 2016-07-14T07:59:28.063 に答える
0
Scriptrunner を使用している場合は、scriptrunner コードを使用することをお勧めします。scriptrunner からこのコードを確認してください。
// Add the next line as a condition to the script listener, so it gets executed only for epic issues, the line must be written uncommented:
// issue.isEpic
// Check if the resolution has been changed
def resolutionChange = changelog.items.find {
(it as Map).field == 'resolution'
} as Map
logger.info("The resolution change of issue '${issue.key}': ${resolutionChange}.")
if (!resolutionChange) {
logger.info("The resolution didn't change.")
return
}
// Compute the 'Epic Status' value to set based on the resolution value
def newEpicStatusValue = (resolutionChange.toString == 'Done') ? 'Done' : 'To Do'
// Get the 'Epic Status' field ID
final epicStatusField = get("/rest/api/2/field")
.asObject(List)
.body
.find {
(it as Map).name == 'Epic Status'
} as Map
def epicStatusFieldId = epicStatusField.id
logger.info("Updating Epic Status field (${epicStatusFieldId}) to '${newEpicStatusValue}'.")
// Update the 'Epic Status' field value
put("/rest/api/2/issue/${issue.key}")
.queryString("overrideScreenSecurity", Boolean.TRUE)
.header("Content-Type", "application/json")
.body([
fields: [
(epicStatusFieldId): [value: newEpicStatusValue]
]
])
.asString()
このコードは、後処理または jira の自動化で自動化できます。詳細については、このリンクを参照してください。
于 2021-12-03T14:07:42.160 に答える