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 摘要。