Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] az devops invoke --area build contains two resources named "changes" #1012

Open
bryanbcook opened this issue Jun 7, 2020 · 3 comments
Labels
Area: ProToCol The bugs under ProToCol Team bug

Comments

@bryanbcook
Copy link

Describe the bug
When I use az devops invoke for Builds - Get Build Changes it fails and prompts for parameters for Builds - Get Changes Between Builds

My investigation suggests there are 2 endpoints with the same area and resourceName.

az devops invoke --query "[?area=='build' && resourceName=='changes']"

produces the following:

[
  {
    "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
  1. 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?

@bryanbcook bryanbcook added Area: ProToCol The bugs under ProToCol Team bug labels Jun 7, 2020
@bryanbcook
Copy link
Author

As a suggestion, could the definition be changed to:

  {
    "area": "build",
    "id": "54572c7b-bbd3-45d4-80dc-28be08941620",
    "maxVersion": 6.0,
    "minVersion": 2.0,
    "releasedVersion": "5.1",
    "resourceName": "buildchanges",
    "resourceVersion": 2,
    "routeTemplate": "{project}/_apis/{area}/builds/{buildId}/changes"
  }

@bryanbcook
Copy link
Author

Perhaps an alternative would allow the author to provide the --id instead of using 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}"
  }
az devops invoke --id "54572c7b-bbd3-45d4-80dc-28be08941620" `
        --route-parameters `
                project=myProject `
                area=build `
                buildId=1234 `
                resource=changes `
         --api-version 5.1-preview

@SAi-NetRom
Copy link

Hi all,
I can confirm the same bug in 7.2-preview version. Are there any solutions to switch between one or the other?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: ProToCol The bugs under ProToCol Team bug
Projects
None yet
Development

No branches or pull requests

2 participants