简体   繁体   中英

Workaround need to extract a subset of the releases list from Azure DevOps using CLI

I run az pipelines release list --org $organization --project $project --top 1000 -o table to get all the releases in $project. I just get the first 100 releases - as there is a bug I reported https://github.com/Azure/azure-devops-cli-extension/issues/937 )

To workaround that limitation, I tried to filter the output from az pipelines release list (using --query) based on releaseDefinition name to only get a subset of this dataset and not to hit this 100 items limitation -hoping it filters before it output the dataset. Unfortunately, it did not work as it does not prefilter but instead, it loads the top 100 first items and then filters that dataset.

Does anybody have a workaround ?

I don't regard this as a bug; just not a documented API limitation. It's not an issue with the Azure CLI, as all the CLI is doing is making REST calls to the back end Azure API endpoint.

The 100 result limitation at the API endpoint is a fairly common limitation for API's to keep response request sizes manageable and limit DDOS capability.

But you would expect the --query to pre-filter the results. So let's look at the CLI code on GitHub. Here you can see the CLI making the API call :

...
releases = client.get_releases(definition_id=definition_id,
                               project=project,
                               source_branch_filter=source_branch,
                               top=top,
                               status_filter=status)
return releases

And what we see is that the only filtering at the API level is top . The --query parameter is not passed in the API request. Since the API currently only returns a max of 100 items, that means that the CLI will only get 100 items from the API.

This means that rest of the --query filtering parameters is handled at the Client side by the CLI, which only has a maximum of the top 100 results.

In order to get more than 100 results, they need to add another parameter to the API to allow for more than 100 results to be returned.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM