microsoft / microsoft/azure-devops-python-api

Add support for using generic query in get_builds or rather any API call that supports AZ Cli --query parameter

Open
#404 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 am trying to get builds which triggers only on pull requests to main.

az pipelines runs list  --query [? contains(sourceBranch,'refs/pull')]

Above command gives me all builds that uses source branch as refs/pull/<pr_number>/merge

In get_builds method of build client there is no way to do this.

branch_name parameter works only when you specify explicit branch name.

I realized that I could use "reason_filter=pullRequest" but it would be helpful if generic query parameter is supported in all those API calls where, AZ cli has --query parameter.

Is there any way to specify query in such API requests?

def get_builds(self, project, definitions=None, queues=None, build_number=None, min_time=None, max_time=None, requested_for=None, reason_filter=None, status_filter=None, result_filter=None, tag_filters=None, properties=None, top=None, continuation_token=None, max_builds_per_definition=None, deleted_filter=None, query_order=None, branch_name=None, build_ids=None, repository_id=None, repository_type=None):

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 BuildClient.get_builds entry point and compare its parameters with the Azure CLI --query behavior shown in the issue. Determine which API calls should accept a generic query and how that fits their existing signatures; done means the requested filtering works for get_builds and the supported scope is covered by tests.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.