Azure / Azure/azure-devops-cli-extension
Npm package promotion fails using 'az devops invoke'
- Dominant language
- Python
- Stars
- 682
- Forks
- 278
- Avg merge
- 3d 23h
- Merged PRs (30d)
- 3
Description
## Describe the bug
Adding a Npm package to a view fails using `az devops invoke` with `--area npm`, `--resource Versions`, and `--route-parameters feedId={feedId} packageName={packageName} packageVersion={packageVersion}`.
Is this caused by duplicate `npm`/`Versions`? Or how can I make the command use the correct resource block?
`az devops invoke --org {org} --query "[?area=='npm' && resourceName=='Versions']"`:
```
[
{
"area": "npm",
"id": "e93d9ec3-4022-401e-96b0-83ea5d911e09",
"maxVersion": 6.1,
"minVersion": 2.0,
"releasedVersion": "0.0",
"resourceName": "Versions",
"resourceVersion": 1,
"routeTemplate": "{project}/_apis/packaging/feeds/{feedId}/{area}/@{packageScope}/{unscopedPackageName}/{resource}/{packageVersion}"
},
{
"area": "npm",
"id": "ed579d62-67c9-4271-be66-9b029af5bcf9",
"maxVersion": 6.1,
"minVersion": 2.0,
"releasedVersion": "0.0",
"resourceName": "Versions",
"resourceVersion": 1,
"routeTemplate": "{project}/_apis/packaging/feeds/{feedId}/{area}/{packageName}/{resource}/{packageVersion}"
}
]
```
REST API: https://docs.microsoft.com/en-us/rest/api/azure/devops/artifactspackagetypes/npm/update%20package?view=azure-devops-rest-6.1
**Note: Command works if when using the first returned route, i.e. `--route-parameters feedId={feedId} packageScope={packageScope} unscopedPackageName={packageName} packageVersion={packageVersion}`** (REST API: https://docs.microsoft.com/en-us/rest/api/azure/devops/artifactspackagetypes/npm/update%20scoped%20package?view=azure-devops-rest-6.1)
**Command Name**
`az devops invoke
Extension Name: azure-devops. Version: 0.18.0.`
**Errors:**
```
'packageScope'
Traceback (most recent call last):
Temp\pip-unpacked-wheel-tuw8_17y\knack\cli.py, ln 215, in invoke
cli\core\commands\__init__.py, ln 654, in execute
cli\core\commands\__init__.py, ln 718, in _run_jobs_serially
cli\core\commands\__init__.py, ln 709, in _run_job
azext_devops\dev\common\exception_handler.py, ln 31, in azure_devops_exception_handler
reraise(*sys.exc_info())
...
azure-devops\azext_devops\devops_sdk\client.py, ln 116, in _create_request_message
url = self._client.format_url(route_template, **route_values)
Temp\pip-unpacked-wheel-482xwhov\msrest\service_client.py, ln 151, in format_url
KeyError: 'packageScope'
```
## 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 npm --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
Assessment
This issue has not been assessed yet.