microsoft / microsoft/azure-devops-python-api

Azure Python how to link child/related tickets to an already created ticket?

未关闭
#405 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
684
派生
218
平均合并
8 天 10 小时
30 天内合并 PR
1

描述

I am trying to use the azure-devops python pip package in order to migrate a large amount of Epic/Story/Feature tickets into Azure Devops. I can create singular tickets just fine, but I'm having trouble linking those tickets together by specifying the hierarchy (ticket A is a parent to child tickets B / C / D)

In order to create an EPIC ticket I'm running code like this:

    #set field
    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
    )

Which works, but now I'm trying to figure out how to give this Epic ticket a linked Child ticket.

In the github repo for this azure-devops python package, I can see that in the definition for create_work_item there is a string variable expand which has an option for Relations

https://github.com/microsoft/azure-devops-python-api/blob/master/azure-devops/azure/devops/v5_1/work_item_tracking/work_item_tracking_client.py#L1578

:param str expand: The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }.

It's also discussed in the official azure-devops documentation for the create_work_item function:
https://docs.microsoft.com/en-us/rest/api/azure/devops/wit/work-items/create?view=azure-devops-rest-6.0#workitemexpand

But if I add expand='Relations' to my code it results in an error:

    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,
        expand='Relations'
    )

TypeError: WorkItemTrackingClient.create_work_item() got an unexpected keyword argument 'expand'

Am I using this 'expand' variable correctly? Or is there a different way I should add a child ticket to an epic in azure using python? Thanks

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 azure-devops/azure/devops/v5_1/work_item_tracking/work_item_tracking_client.py 中的 create_work_item 附近开始,将其生成的签名与链接的 REST 文档进行比较。检查现有的 work-item relation 测试或客户端模型,以确定受支持的方式;当差异或受支持的链接工作流已记录并由适当的测试覆盖时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
azure, python
领域
api, devops
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。