microsoft / microsoft/azure-devops-python-api

Is there a way to get the same contents from the python sdk as from the az cli?

未關閉
#403 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
Python
星號
684
分支
218
平均合併
8 天 10 小時
30 天內合併 PR
1

描述

I'm trying to harvest information from our pipelines/repositories for governance purposes. I want to create a dashboard of some sort. For this I need to pull information from our project and all its repos and pipelines.
If I use the python sdk's pipeline_client I get this output:

{
 '_links': {},
  'folder': '\\',
  'id': 337,
  'name': 'pipelineName',
  'revision': 37,
  'url': 'https://dev.azure.com/orgnanization/d48489-c201-8sun3-952e-83e5a8593c66/_apis/pipelines/337?revision=37'
}

If I use the azure cli I get a lot more informaiton, including e.g. the dictionaries
authoredBy and repository.

Exploring the code, i found this:

as_dict(self, keep_readonly=True, key_transformer=<function attribute_transformer at 0x7f8b1f4aa0d0>, **kwargs)
| Return a dict that can be JSONify using json.dump.
|
| Advanced usage might optionaly use a callback as parameter:
|
| .. code::python
|
| def my_key_transformer(key, attr_desc, value):
| return key

Probably I'm just having trouble parsing this information. Is this something I could use to achieve my purpose?

I'd like to know which pipelines are triggered form which repos, so that I can trace them back to the dev teams and create a report on this. If this is not possible with python, I might then need to use the CLI and a bash script, but that's not what I'd like the most.

Thanks

貢獻指南

這個儲存庫沒有索引到貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 Python SDK 的 pipeline_client 及其 as_dict 方法開始,然後將它們傳回的 pipeline 資料與 issue 中描述的 Azure CLI 輸出進行比較。確認是否公開了 authoredBy、repository 和 trigger 關係;當記錄或實作一種清楚的方式來取得治理報告所需的 repository-to-pipeline 資訊時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
azure, python
領域
api, devops
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
30/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。