azure-devops-python-api icon indicating copy to clipboard operation
azure-devops-python-api copied to clipboard

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

Open romahamu opened this issue 4 years ago • 0 comments

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):

romahamu avatar Feb 22 '22 21:02 romahamu