Azure / Azure/azure-devops-cli-extension

NuGet package promotion fails using 'az devops invoke'

Open
#1,063 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
682
Forks
278
Avg merge
3d 23h
Merged PRs (30d)
3

Description

## Describe the bug

Adding a NuGet package to a view fails using `az devops invoke`. Using `--area nuget` seems to direct the call to `artifacts.dev.azure.com` instead of `pkgs.dev.azure.com` causing the command to fail.

Is this caused by duplicate `nuget` areas listed by `https://dev.azure.com/{org}/_apis/ResourceAreas` (one referencing `artifacts.dev.azure.com`, and one referencing `pkgs.dev.azure.com`)? Or how can I make the command go look at the correct area?

`az devops invoke --org {org} --query "[?area=='nuget' && resourceName=='Versions']"`:
```
[
{
"area": "nuget",
"id": "36c9353b-e250-4c57-b040-513c186c3905",
"maxVersion": 6.1,
"minVersion": 2.0,
"releasedVersion": "0.0",
"resourceName": "Versions",
"resourceVersion": 1,
"routeTemplate": "{project}/_apis/packaging/feeds/{feedId}/{area}/packages/{packageName}/{resource}/{packageVersion}"
}
]
```

REST API: https://docs.microsoft.com/en-us/rest/api/azure/devops/artifactspackagetypes/nuget/update%20package%20version?view=azure-devops-rest-6.1

**Command Name**
`az devops invoke
Extension Name: azure-devops. Version: 0.18.0.`

**Errors:**
```
ValidationError: --resource and --api-version combination is not correct
```

## To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

- `az devops invoke --api-version 6.1-preview --area nuget --org {org} --resource Versions --route-parameters feedId={feedId} packageName={packageName} packageVersion={packageVersion} --http-method PATCH --in-file body.json --output json`
- `body.json`:
```
{
"views" : {
"op" : "add",
"path" : "/views/-",
"value" : "{viewId}"
}
}
```

## Expected Behavior

Package is added to the provided view.

## Environment Summary
```
Windows-10-10.0.16299-SP0
Python 3.6.8
Installer: MSI

azure-cli 2.12.1

Extensions:
azure-devops 0.18.0

```
## Additional Context

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.