azure-devops-cli-extension
azure-devops-cli-extension copied to clipboard
NuGet package promotion fails using 'az devops invoke'
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
I think you forgot to pass {project}
name like this --route-parameters project=xxxxx
in your script.
I think you forgot to pass
{project}
name like this--route-parameters project=xxxxx
in your script.
This is an organisation scoped feed, so the {project}
parameter should not be supplied.
The issue is the area nuget
is not unquie.
if you do GET https://dev.azure.com/hmcts/_apis/ResourceAreas
you will find two.
the az devops invoke
will choose the first it finds which is
{
"id": "9d3a4e8e-2f8f-4ae1-abc2-b461a51cb3b3",
"name": "nuget",
"locationUrl": "https://artifacts.dev.azure.com/hmcts/"
}
This is not the one I guess you want, as I am having the same issue.
{
"id": "b3be7473-68ea-4a81-bfc7-9530baaa19ad",
"name": "nuget",
"locationUrl": "https://pkgs.dev.azure.com/hmcts/"
}
This means the Resouce doesn't match.
if you add --debug
at the end you can see the request`
bug has been raised here https://github.com/Azure/azure-devops-cli-extension/issues/1012
Can confirm having the same issue. Any workarounds?