microsoft / microsoft/azure-devops-python-api

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

オープン
#405 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
684
フォーク
218
平均マージ
8日 10時間
マージ済み PR(30日)
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. リポジトリをフォークし、ブランチを切って変更します。
  4. 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 を短くまとめたダイジェスト。