renevanosnabrugge / vsts-promotepackage-task

Promote a package in VSTS to a Release View
MIT License
21 stars 25 forks source link

Can't use '*' to specify version in YAML; works in Release pipeline #72

Open Erich-McMillan opened 1 year ago

Erich-McMillan commented 1 year ago

What I'd like to do:

I'd like to promote the latest version of a package in the feed from 'local' to 'release'. Want to specify '*' for the version.

What I've tried:

The error:

https://pkgs.dev.azure.com/MYPROJECT/_apis/packaging/feeds/7e237d53-b4c4-44b5-b7fa-49f7f33477eb/UPack/packages/MYPACKAGE/versions/*?api-version=5.0-preview.1
##[debug]PATCH https://pkgs.dev.azure.com/MYPROJECT/_apis/packaging/feeds/7e237d53-b4c4-44b5-b7fa-49f7f33477eb/UPack/packages/MYPACKAGE/versions/*?api-version=5.0-preview.1 with -1-byte payload
##[debug]Caught exception from task script.
##[debug]Error record:
##[debug]Invoke-RestMethod : {"$id":"1","innerException":null,"message":"A potentially dangerous Request.Path value was detected from the client (*).","typeName":"System.Web.HttpException, System.Web","typeKey":"HttpException","errorCode":0,"eventId":0}
##[debug]At D:\a\_tasks\rvo-vsts-promotepackage-task_7ca5869f-a901-4012-a50d-d0f9d436ffec\3.0.9\vsts-promotepackage-task.ps1:162 char:17
##[debug]+ ... $response = Invoke-RestMethod -Uri $releaseViewURL -Headers $requestC ...
##[debug]+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##[debug]    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc    eption
##[debug]    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
##[debug]Script stack trace:
##[debug]at Set-PackageQuality, D:\a\_tasks\rvo-vsts-promotepackage-task_7ca5869f-a901-4012-a50d-d0f9d436ffec\3.0.9\vsts-promotepackage-task.ps1: line 162
##[debug]at Run, D:\a\_tasks\rvo-vsts-promotepackage-task_7ca5869f-a901-4012-a50d-d0f9d436ffec\3.0.9\vsts-promotepackage-task.ps1: line 286
##[debug]at <ScriptBlock>, D:\a\_tasks\rvo-vsts-promotepackage-task_7ca5869f-a901-4012-a50d-d0f9d436ffec\3.0.9\vsts-promotepackage-task.ps1: line 308
##[debug]at <ScriptBlock>, <No file>: line 1
##[debug]at <ScriptBlock>, <No file>: line 22
##[debug]at <ScriptBlock>, <No file>: line 18
##[debug]at <ScriptBlock>, <No file>: line 1
##[debug]Exception:
##[debug]System.Net.WebException: The remote server returned an error: (400) Bad Request.
##[debug]   at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request)
##[debug]   at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()
##[error]The remote server returned an error: (400) Bad Request.

Conclusion

Package promotion feels like it should work with '*' version provided. Happy to help implement a fix if you can point me in the right direction :)

jessehouwing commented 1 year ago

Try %2A

MortenRa commented 11 months ago

I have the same issue anyone solved this.