Azure Python 如何将子/相关票证链接到已创建的票证?
我正在使用 Azure Python 工具在 python 脚本中创建 Epic/Story/Feature 工作项,如下所示:
# add fields
jpo = JsonPatchOperation()
jpo.from_ = None
jpo.op = "add"
jpo.path = "/fields/Microsoft.VSTS.Scheduling.FinishDate"
jpo.value = default_field
jpos.append(jpo)
#create work item
createdWorkItem = wit_client.create_work_item(
document=jpos,
project=project.id,
type="EPIC",
validate_only=validate_only,
bypass_rules=bypass_rules,
suppress_notifications=suppress_notifications
)
#save details to local json file
epic_details = {
"op": "add",
"path": "/relations/-",
"value": {
"rel": "System.LinkTypes.Hierarchy-Reverse",
"name": "Parent",
"url": createdWorkItem.url
}
}
我需要将我的票证链接在一起,例如在票证之间添加子/父关系。我试图通过首先创建所有票证,然后在需要的地方将它们链接起来来做到这一点。
如果两个票证都已存在,是否可以使用 Azure Devops Python 工具将子工作项添加到史诗工作项?谢谢。
编辑:我找到了此处引用的函数 ParentChildWIMap
: https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/v5_1/work/models.py#L711 但我不确定如何使用它
I am using the Azure Python tool to create Epic/Story/Feature work items in a python script like so:
# add fields
jpo = JsonPatchOperation()
jpo.from_ = None
jpo.op = "add"
jpo.path = "/fields/Microsoft.VSTS.Scheduling.FinishDate"
jpo.value = default_field
jpos.append(jpo)
#create work item
createdWorkItem = wit_client.create_work_item(
document=jpos,
project=project.id,
type="EPIC",
validate_only=validate_only,
bypass_rules=bypass_rules,
suppress_notifications=suppress_notifications
)
#save details to local json file
epic_details = {
"op": "add",
"path": "/relations/-",
"value": {
"rel": "System.LinkTypes.Hierarchy-Reverse",
"name": "Parent",
"url": createdWorkItem.url
}
}
I need to link my tickets together, such as adding a Child / Parent relationship between tickets. I'm trying to do this by creating all my tickets first, then linking them all where needed.
Is there some way with the Azure Devops Python tool that I can add a child workitem to a epic workitem if both tickets already exist? Thanks.
edit: I've found the function ParentChildWIMap
referenced here:
https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/v5_1/work/models.py#L711
But I'm unsure on how to use it
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用 https://github.com/microsoft/azure-devops-python-api ,你可以尝试这个示例:
If you use https://github.com/microsoft/azure-devops-python-api , you can try this sample:
我也花了相当长的时间才弄清楚这一点。
与前面的答案类似,有关如何根据 yaml 文件中的内容创建具有可选子任务的工作项的示例:
https://github.com/filipjonckers/azure-devops-bulk-workitems
希望这对您有帮助。
Took me quite some time to figure this one out too.
Similar to the previous answer, an example on how to create work items with optional subtasks based on content from yaml files:
https://github.com/filipjonckers/azure-devops-bulk-workitems
Hope this is helpful.