Azure / Azure/azure-devops-cli-extension
[Bug] az devops invoke --area build contains two resources named "changes"
- Dominant language
- Python
- Stars
- 682
- Forks
- 278
- Avg merge
- 3d 23h
- Merged PRs (30d)
- 3
Description
**Describe the bug**
When I use ```az devops invoke``` for [Builds - Get Build Changes](https://docs.microsoft.com/en-us/rest/api/azure/devops/build/builds/get%20build%20changes?view=azure-devops-rest-5.1) it fails and prompts for parameters for [Builds - Get Changes Between Builds](https://docs.microsoft.com/en-us/rest/api/azure/devops/build/builds/get%20changes%20between%20builds?view=azure-devops-rest-5.1)
My investigation suggests there are 2 endpoints with the same _area_ and _resourceName_.
```bash
az devops invoke --query "[?area=='build' && resourceName=='changes']"
```
produces the following:
```json
[
{
"area": "build",
"id": "f10f0ea5-18a1-43ec-a8fb-2042c7be9b43",
"maxVersion": 6.0,
"minVersion": 2.1,
"releasedVersion": "0.0",
"resourceName": "changes",
"resourceVersion": 3,
"routeTemplate": "{project}/_apis/{area}/{resource}"
},
{
"area": "build",
"id": "54572c7b-bbd3-45d4-80dc-28be08941620",
"maxVersion": 6.0,
"minVersion": 2.0,
"releasedVersion": "5.1",
"resourceName": "changes",
"resourceVersion": 2,
"routeTemplate": "{project}/_apis/{area}/builds/{buildId}/{resource}"
}
]
```
**To Reproduce**
Azure Cli Version: 2.7.0
Azure-Devops extension version: 0.18.0
Steps to reproduce the behavior:
1. login using az login
2. setup defaults for organization
3. Run the following (with proper values for project and buildId)
```
az devops invoke --area build --resource changes --route-parameters project=myProject buildId=1234 --api-version 5.1-preview
```
4. Fails with the following error: ```fromBuildId or toBuildId is null. Supply a valid value and try again.```
The debug logs confirm that the 1st resource template is being used:
```
3108 : 2020-06-07 18:11:38,681 : DEBUG : azext_devops.devops_sdk.client : Route template: {project}/_apis/{area}/{resource}
3108 : 2020-06-07 18:11:38,682 : DEBUG : azext_devops.devops_sdk.client : Api version '5.1-preview'
3108 : 2020-06-07 18:11:38,683 : DEBUG : azext_devops.devops_sdk.client : GET https://dev.azure.com/my-org/my-projectname/_apis/build/changes
```
**Expected behavior**
Given that there are two endpoints with the same area and resource, it appears to be using the first one instead of the second. Is there a way to provide more information to the command-line to ensure the 2nd one is used?
Contributor guide
Assessment
This issue has not been assessed yet.