0

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 ?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62

1 Answers1

0

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.

HAL9256
  • 12,384
  • 1
  • 34
  • 46
  • OK I understand. What I don't understand is why --top 1000 option is ignored. I fact it is taken into account up until 100. Any idea how I could bypass that limit without having to redesign my request - I mean without running the REST call myself? – david habibi Jan 17 '20 at 13:33
  • It's not necessarily that the `top` option is ignored, and it doesn't matter if you make the REST call yourself. The API currently still only returns 100 results. They need to add the capability to the API to return more than 100 results or allow more filtering, or paging to get around this limitation. – HAL9256 Jan 17 '20 at 14:32