MethodsAndPractices / vsteam

PowerShell module for accessing Azure DevOps Services and Azure DevOps Server (formerly VSTS or TFS)
https://methodsandpractices.github.io/vsteam-docs/
MIT License
444 stars 155 forks source link

Update-VSTeamNuGetPackageVersion is missing project path #421

Closed asbiin closed 2 years ago

asbiin commented 2 years ago

The Update-VSTeamNuGetPackageVersion cmdlet does not include the project in the api call. See microsoft documentation: the template is

PATCH https://pkgs.dev.azure.com/{organization}/{project}/_apis/packaging/feeds/{feedId}/nuget/packages/{packageName}/versions/{packageVersion}?api-version=6.1-preview.1

The {project} should be part of the API call, or we can see it is not included in https://github.com/MethodsAndPractices/vsteam/blob/7325dbd3eeee2e06d1474811c99a884f35cd58c2/Source/Public/Update-VSTeamNuGetPackageVersion.ps1#L31

SebastianSchuetze commented 2 years ago

Question. Do you get an exception or not? Does this work for you?

I am asking because I tried e.g. Get-VSTeamFeed and the docs say also you need a project in the URL, but it works without:

 Get-VSTeamFeed -Verbose
VERBOSE: Team Module/7.4.0 (Windows) PowerShell/7.1.4
VERBOSE: GET https://feeds.dev.azure.com/razorspoint-test/_apis/packaging/feeds?api-version=6.0-preview with 0-byte payload
VERBOSE: received 2030-byte response of content type application/json
VERBOSE: Content encoding: utf-8
VERBOSE: return type: PSCustomObject
VERBOSE: @{count=1; value=System.Object[]}
VERBOSE: @{description=; url=https://feeds.dev.azure.com/razorspoint-test/0c9b07d1-ddcf-4dbf-a1cb-798376138c31/_apis/Packaging/Feeds/ba8eca10-9bdc-4daf-ace8-bb2193f497d0; _links=; hideDeletedPackageVersions=True; defaultViewId=24402b8c-2567-45db-b940-26966add258d; id=ba8eca10-9bdc-4daf-ace8-bb2193f497d0; name=Test; upstreamEnabled=True; viewId=; viewName=; fullyQualifiedName=Test; fullyQualifiedId=ba8eca10-9bdc-4daf-ace8-bb2193f497d0; upstreamSources=System.Object[]; capabilities=defaultCapabilities; project=}

Name Description Id
---- ----------- --
Test             ba8eca10-9bdc-4daf-ace8-bb2193f497d0
SebastianSchuetze commented 2 years ago

@asbiin I tested it and the cmdlet is not wrong, but also not complete. The current cmdlet can only update packages if they are an org wide feed. If it's a project feed then you need the project. I will change the cmdlet to support both.

asbiin commented 2 years ago

@SebastianSchuetze YEs that's exactly he behavior. project feed have been introduced some months ago. BTW I'm pretty sure Update-VSTeamNuGetPackageVersion is not the only cmdlet that has this problem, but I did not tested every cmdlet.

SebastianSchuetze commented 2 years ago

Merged the code to fix it. So, it is closed. But currently we cannot release because of a bug in the pipeline can't figure out currently.