microsoft / microsoft/azure-devops-python-api

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

Open
#403 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
684
Forks
218
Avg merge
8d 10h
Merged PRs (30d)
1

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Python SDK's pipeline_client and its as_dict method, then compare their returned pipeline data with the Azure CLI output described in the issue. Determine whether authoredBy, repository, and trigger relationships are exposed; done means documenting or implementing a clear way to retrieve the repository-to-pipeline information needed for the governance report.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, python
Domain
api, devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.