【发布时间】:2019-12-21 08:13:34
【问题描述】:
我正在尝试建立一个集成,使我们能够使用 Zapier 每天报告当前 sprint 的问题、子任务和每个任务的状态。
理想情况下,我会运行一些循环遍历 JIRA 响应的 python,我返回以返回带有名称、状态的问题列表,但如果问题的问题类型为 name:"Sub-task",则不返回。
我打的两个电话是:
- 积极冲刺
https://company.atlassian.net/rest/agile/1.0/board/51/sprint?state=active
- 在 sprint 中解决问题
https://company.atlassian.net/rest/agile/1.0/sprint/<value_from_above>/issue?fields=key,status,summary,issuetype&maxResults=200
这给出了所有票证的 JSON 输出,格式如下:
{
expand: "schema,names",
startAt: 0,
maxResults: 200,
total: 97,
issues: [
{
expand: "operations,versionedRepresentations,editmeta,changelog,renderedFields",
id: "43685",
self: "https://company.atlassian.net/rest/agile/1.0/issue/43685",
key: "ENG-431",
fields: {
summary: "Summary",
issuetype: {
self: "https://company.atlassian.net/rest/api/2/issuetype/4",
id: "4",
description: "An improvement or enhancement to an existing feature or task.",
iconUrl: "https://company.atlassian.net/secure/viewavatar?size=medium&avatarId=10610&avatarType=issuetype",
name: "Improvement",
subtask: false,
avatarId: 10610
},
status: {
self: "https://company.atlassian.net/rest/api/2/status/10010",
description: "",
iconUrl: "https://company.atlassian.net/images/icons/statuses/closed.png",
name: "Done",
id: "10010",
statusCategory: {
self: "https://company.atlassian.net/rest/api/2/statuscategory/3",
id: 3,
key: "done",
colorName: "green",
name: "Done"
}
}
}
},
{
expand: "operations,versionedRepresentations,editmeta,changelog,renderedFields",
id: "45729",
self: "https://company.atlassian.net/rest/agile/1.0/issue/45729",
key: "ENG-636",
fields: {
summary: "Summary",
issuetype: {
self: "https://company.atlassian.net/rest/api/2/issuetype/5",
id: "5",
description: "The sub-task of the issue",
iconUrl: "https://company.atlassian.net/secure/viewavatar?size=medium&avatarId=10616&avatarType=issuetype",
name: "Sub-task",
subtask: true,
avatarId: 10616
},
status: {
self: "https://company.atlassian.net/rest/api/2/status/10010",
description: "",
iconUrl: "https://company.atlassian.net/images/icons/statuses/closed.png",
name: "Done",
id: "10010",
statusCategory: {
self: "https://company.atlassian.net/rest/api/2/statuscategory/3",
id: 3,
key: "done",
colorName: "green",
name: "Done"
}
}
}
},
{
expand: "operations,versionedRepresentations,editmeta,changelog,renderedFields",
id: "45727",
self: "https://company.atlassian.net/rest/agile/1.0/issue/45727",
key: "ENG-634",
fields: {
summary: "Summary",
issuetype: {
self: "https://company.atlassian.net/rest/api/2/issuetype/1",
id: "1",
description: "A problem which impairs or prevents the functions of the product.",
iconUrl: "https://company.atlassian.net/secure/viewavatar?size=medium&avatarId=10603&avatarType=issuetype",
name: "Bug",
subtask: false,
avatarId: 10603
},
status: {
self: "https://company.atlassian.net/rest/api/2/status/10010",
description: "",
iconUrl: "https://company.atlassian.net/images/icons/statuses/closed.png",
name: "Done",
id: "10010",
statusCategory: {
self: "https://company.atlassian.net/rest/api/2/statuscategory/3",
id: 3,
key: "done",
colorName: "green",
name: "Done"
}
}
}
}
]
}
理想情况下它会显示如下:
"Issue 1" | Issue type | To do
"Issue 2" | Issue type | In Progress
"Issue 3" | Issue type | Done
"Issue 4" | Issue type | In Progress
任何想法都非常感谢,谢谢!
更新:
我正在从 Zapier 以这种格式 (https://i.imgur.com/MEOTGxL.png) 接收数据,所以我想知道这些调用是否应该在一次 Python 代码执行中进行,并解析结果以提供上面列出的输出。
【问题讨论】:
-
使用python有必要吗?您还可以使用 JQL 使用“project = MyProject AND Sprint in openSprints()”之类的过滤器来获得此结果,然后只显示您需要的 JIRA 字段列(Key | IssueType | Status)。这也将消除您的听众的 Python 知识水平的问题。有关详细信息,请参阅Atlassian documentation。
-
这份报告的输出是什么?这绝对可以做到,但是这些信息是如何被消耗的呢?通过电子邮件发送电子表格、BI 工具、电子邮件正文等?