renevanosnabrugge / vsts-promotepackage-task

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

Not working with public feed #29

Closed clairernovotny closed 4 years ago

clairernovotny commented 5 years ago

Trying to promote a package on a public feed is not working. I get this:

2019-08-01T15:57:18.3076627Z ##[section]Starting: Promote package to Release View
2019-08-01T15:57:18.3181304Z ==============================================================================
2019-08-01T15:57:18.3181398Z Task : Promote package to Release View
2019-08-01T15:57:18.3181468Z Description : Promotes a package to a Release View in VSTS Package Management
2019-08-01T15:57:18.3181546Z Version : 2.0.2
2019-08-01T15:57:18.3181878Z Author : Rene van Osnabrugge
2019-08-01T15:57:18.3181979Z Help : Version: 2.0.2. [More Information](https://github.com/renevanosnabrugge/vsts-promotepackage-task/wiki)
2019-08-01T15:57:18.3182057Z ==============================================================================
2019-08-01T15:57:19.6479549Z Promoting package(s) by reading metadata from package file(s) matching pattern '**/*.nupkg !**/*.symbols.nupkg' from root directory 'D:\a\r1\a\CI\artifacts'
2019-08-01T15:57:20.1552760Z Matching paths found:
2019-08-01T15:57:20.1553159Z D:\a\r1\a\CI\artifacts\System.Interactive.4.0.0-preview.7.build.829.nupkg D:\a\r1\a\CI\artifacts\System.Interactive.Async.4.0.0-preview.7.build.829.nupkg D:\a\r1\a\CI\artifacts\System.Interactive.Async.Providers.4.0.0-preview.7.build.829.nupkg D:\a\r1\a\CI\artifacts\System.Interactive.Providers.4.0.0-preview.7.build.829.nupkg D:\a\r1\a\CI\artifacts\System.Linq.Async.4.0.0-preview.7.build.829.nupkg D:\a\r1\a\CI\artifacts\System.Linq.Async.Queryable.4.0.0-preview.7.build.829.nupkg
2019-08-01T15:57:20.3510522Z Promoting version of package from feed 5afc77bd-23b4-46f8-b725-40ebedab630c to view Prerelease
2019-08-01T15:57:20.6963229Z ##[error]Unhandled exception while reading feed 5afc77bd-23b4-46f8-b725-40ebedab630c
System.Net.WebException: The remote server returned an error: (404) Not Found.
at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request)
at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()at Get-FeedId, D:\a\_tasks\rvo-vsts-promotepackage-task_7ca5869f-a901-4012-a50d-d0f9d436ffec\2.0.2\vsts-promotepackage-task.ps1: line 46
at Set-PackageQuality, D:\a\_tasks\rvo-vsts-promotepackage-task_7ca5869f-a901-4012-a50d-d0f9d436ffec\2.0.2\vsts-promotepackage-task.ps1: line 135
at Run, D:\a\_tasks\rvo-vsts-promotepackage-task_7ca5869f-a901-4012-a50d-d0f9d436ffec\2.0.2\vsts-promotepackage-task.ps1: line 280
at <ScriptBlock>, D:\a\_tasks\rvo-vsts-promotepackage-task_7ca5869f-a901-4012-a50d-d0f9d436ffec\2.0.2\vsts-promotepackage-task.ps1: line 286
at <ScriptBlock>, <No file>: line 1
at <ScriptBlock>, <No file>: line 22
at <ScriptBlock>, <No file>: line 18
at <ScriptBlock>, <No file>: line 1
2019-08-01T15:57:20.7273286Z ##[section]Finishing: Promote package to Release View
NightOwl888 commented 5 years ago

I suspect this is probably the same issue as #27, for which I have already submitted a PR #28. What is the XML namespace in the .nuspec file that is inside of your .nupkg files?

clairernovotny commented 5 years ago

The nuspec looks like this

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/01/nuspec.xsd">
  <metadata minClientVersion="2.12">
    <id>System.Interactive</id>
    <version>4.0.0-preview.7.build.829</version>
    <authors>Microsoft</authors>
    <owners>Microsoft</owners>
    <requireLicenseAcceptance>true</requireLicenseAcceptance>
    <license type="expression">Apache-2.0</license>
    <projectUrl>https://github.com/dotnet/reactive</projectUrl>
    <iconUrl>https://raw.githubusercontent.com/dotnet/reactive/0f837d11385cfaf575861ccc5a5fbcafb22d888f/Rx.NET/Resources/Artwork/Logo.png</iconUrl>
    <description>Interactive Extensions Main Library used to express queries over enumerable sequences.</description>
    <copyright>Copyright (c) .NET Foundation and Contributors.</copyright>
    <tags>Ix Interactive Extensions Enumerable</tags>
    <repository type="git" url="https://github.com/dotnet/reactive" commit="62ca8775f8c0381999656207c92675e4a3b97fdb" />
    <dependencies>
      <group targetFramework=".NETFramework4.5" />
      <group targetFramework=".NETStandard1.0">
        <dependency id="NETStandard.Library" version="1.6.1" exclude="Build,Analyzers" />
      </group>
      <group targetFramework=".NETStandard2.0" />
    </dependencies>
  </metadata>
</package>
clairernovotny commented 5 years ago

After the XML namespace issue, it's still not working:

2019-08-19T15:56:54.2829662Z Promoting version 2.0.41 of package MSBuild.Sdk.Extras from feed 3773a966-220c-4410-a273-f6d772116a25 to view Prerelease
2019-08-19T15:56:54.7703355Z ##[error]Unhandled exception while reading feed 3773a966-220c-4410-a273-f6d772116a25
System.Net.WebException: The remote server returned an error: (404) Not Found.
at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request)
at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()at Get-FeedId, D:\a\_tasks\rvo-vsts-promotepackage-task_7ca5869f-a901-4012-a50d-d0f9d436ffec\2.0.4\vsts-promotepackage-task.ps1: line 46
at Set-PackageQuality, D:\a\_tasks\rvo-vsts-promotepackage-task_7ca5869f-a901-4012-a50d-d0f9d436ffec\2.0.4\vsts-promotepackage-task.ps1: line 135
at Run, D:\a\_tasks\rvo-vsts-promotepackage-task_7ca5869f-a901-4012-a50d-d0f9d436ffec\2.0.4\vsts-promotepackage-task.ps1: line 279
at <ScriptBlock>, D:\a\_tasks\rvo-vsts-promotepackage-task_7ca5869f-a901-4012-a50d-d0f9d436ffec\2.0.4\vsts-promotepackage-task.ps1: line 285
at <ScriptBlock>, <No file>: line 1
NightOwl888 commented 5 years ago

Hmm, this doesn't happen to be on a private on-site Azure DevOps server would it? Do note that it is not currently supported, although I don't imagine it would take much work to support it - it is just a matter of working out the URL schemes that are used, I think.

clairernovotny commented 5 years ago

No, this is a public feed on Azure DevOps.

NightOwl888 commented 5 years ago

Which domain is it hosted on?

  1. dev.azure.com
  2. vsrm.dev.azure.com
  3. <org>.visualstudio.com
  4. None of the above
clairernovotny commented 5 years ago

dev.azure.com.

You can see it here: https://dev.azure.com/onovotny/GitBuilds/_packaging?_a=feed&feed=MSBuildSdkExtras

NightOwl888 commented 5 years ago

One other thing comes to mind - semver metadata, which probably needs some URL escaping to be able to work. What is the version number you are trying to promote? Does it contain a + or something else that needs URL escaping?

clairernovotny commented 5 years ago

In this case, no SemVer. Just 2.0.41. The log shows that it parsed the correct version.

What I do notice is that the "Views" dropdown in the Task editor doesn't populate.

NightOwl888 commented 5 years ago

Looks like Microsoft botched this one. They released a new API version, 5.1-preview.1 which has added a {project} segment to the URL.

Version 5.1-preview.1:
PATCH https://feeds.dev.azure.com/{organization}/{project}/_apis/packaging/Feeds/{feedId}/views/{viewId}?api-version=5.1-preview.1

Version 5.0-preview.1:
PATCH https://feeds.dev.azure.com/{organization}/_apis/packaging/Feeds/{feedId}/views/{viewId}?api-version=5.0-preview.1

https://docs.microsoft.com/en-us/rest/api/azure/devops/artifacts/feed%20%20management/update%20feed%20view?view=azure-devops-rest-5.0 https://docs.microsoft.com/en-us/rest/api/azure/devops/artifacts/feed%20%20management/update%20feed%20view?view=azure-devops-rest-5.1

We are passing the API version as 5.0-preview.1, which is hard coded in the task, but the new API version seems to be ignoring it.

clairernovotny commented 5 years ago

Is the fix to increase the api version in the task?

renevanosnabrugge commented 5 years ago

Worth a try...

Verstuurd vanaf mijn iPhone

Op 19 aug. 2019 om 18:56 heeft Oren Novotny notifications@github.com<mailto:notifications@github.com> het volgende geschreven:

Is the fix to increase the api version in the task?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Frenevanosnabrugge%2Fvsts-promotepackage-task%2Fissues%2F29%3Femail_source%3Dnotifications%26email_token%3DABOH2WX4423D5GHTSWLTAQLQFLGDVA5CNFSM4IISFN7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4TTNNQ%23issuecomment-522663606&data=02%7C01%7C%7C213118d0368b4e1323d408d724c62cbf%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637018305875804413&sdata=V54491ZyP8dZ%2Fep4e0eNPb0Ir03nHSZqJII6gO1kmXk%3D&reserved=0, or mute the threadhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABOH2WQP7274DREQIFLJ35TQFLGDVANCNFSM4IISFN7A&data=02%7C01%7C%7C213118d0368b4e1323d408d724c62cbf%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637018305875814400&sdata=ZHWY5KIuR9rOM7gj76Q0fauS7AuYRbyU%2FpRddKaC6Uo%3D&reserved=0.

NightOwl888 commented 5 years ago

I suggest increase the version number and also fix the base URL behavior to include the extra parameter. It is unclear whether the API affects the visualstudio.com domain in some way.

NightOwl888 commented 5 years ago

Or I suppose another "fix" is to report and wait for Microsoft to patch it. No doubt others will be complaining about this as well, because it is a breaking change.

clairernovotny commented 5 years ago

I'm not sure what the breaking change is?

Public feeds require the project in it as thy're project-scoped. Guess that means they require 5.1? what's breaking?

NightOwl888 commented 5 years ago

APIs are always supposed to build in backward compatible behavior. That is the reason for the specification of 5.0-preview.1 in the URL: to make sure that if a newer version is released that the specified version's behavior is respected.

I don't know if Microsoft is considering the fact that the version is "preview" as a license to break this rule, but no doubt a lot of code is now broken because of this API update. I would expect that if this was an intentional break, the documentation would have lots of warnings in it that this is in preview and there could be breaking changes ahead.

clairernovotny commented 5 years ago

I'm sorry if I'm dense and not following.... it seems like public feeds cannot be represented with the 5.0 api. Nothing has changed otherwise.

What am I missing? I can raise this with the team, I'm just trying to understand what the expected vs actual behavior is.

NightOwl888 commented 5 years ago

it seems like public feeds cannot be represented with the 5.0 api

Well, you may be right. Normally the version number is at the beginning of the URL (i.e. a folder) so new versions can be deployed side-by-side with the old ones. That way if the rest of the URL structure changes, it doesn't break.

version 1.0:
https://www.somewhere.com/api/1.0/{organization}/feed

version 1.1:
https://www.somewhere.com/api/1.1/{organization}/{project}/feed

There is nothing wrong with using a URL parameter to do it, as long as you build the backward compatible behavior into the new version. It is expected that if you pass in the old URL, it will still work after the next version is deployed.

// Used to work, now doesn't:
https://feeds.dev.azure.com/{organization}/_apis/packaging/Feeds/{feedId}/views/{viewId}?api-version=5.0-preview.1

// (probably) works after the update:
https://feeds.dev.azure.com/{organization}/{project}/_apis/packaging/Feeds/{feedId}/views/{viewId}?api-version=5.1-preview.1

Humans don't call APIs, programs do. In order to keep those programs from suddenly breaking for no apparent reason, those who maintain the APIs must make sure backward compatibility is respected.

I am not saying that we shouldn't update to the new API version, but we shouldn't be forced to do it because of a break, we should be able to do it on our own schedule.

clairernovotny commented 5 years ago

I am not saying that we shouldn't update to the new API version, but we shouldn't be forced to do it because of a break, we should be able to do it on our own schedule.

I guess it depends on definition of break. Public feeds are considered a new feature, so no existing thing could be thought of supporting them.

renevanosnabrugge commented 5 years ago

I agree. If it worked with previous version the back compat should be fixed.

We can use the other url for now. But this is not how an api should work.

Verstuurd vanaf mijn iPhone

Op 19 aug. 2019 om 20:14 heeft Oren Novotny notifications@github.com<mailto:notifications@github.com> het volgende geschreven:

I am not saying that we shouldn't update to the new API version, but we shouldn't be forced to do it because of a break, we should be able to do it on our own schedule.

I guess it depends on definition of break. Public feeds are considered a new feature, so no existing thing could be thought of supporting them.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Frenevanosnabrugge%2Fvsts-promotepackage-task%2Fissues%2F29%3Femail_source%3Dnotifications%26email_token%3DABOH2WRIVEULAOTGF5PWZMDQFLPJRA5CNFSM4IISFN7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4T2ZSA%23issuecomment-522693832&data=02%7C01%7C%7C8404939ed5174d3bb1ed08d724d11fbf%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637018352904409644&sdata=WCBOoW89LK9DURR5rbLP%2FsIOzr9iiPXNRMUUP1iHJjw%3D&reserved=0, or mute the threadhttps://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABOH2WXUPFGB36CSBT6ATRTQFLPJRANCNFSM4IISFN7A&data=02%7C01%7C%7C8404939ed5174d3bb1ed08d724d11fbf%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637018352904419655&sdata=5fWoG%2FF%2Fw%2FP7dXJKQ%2FlV%2BT2teIxG070wrwEoOMQSAXo%3D&reserved=0.

ferwe commented 5 years ago

So what is the next step in this issue? Fixing the url in the extension or something else? :)

scrhicks commented 4 years ago

Any progress? I have the latest version of the plugin and still can't publish packages to my project feed.

renevanosnabrugge commented 4 years ago

I raised an issue with the product team. There is a work around. Make the feed organization wide.

As fix I am thinking of getting all feed details in the powershell script. But not much time to implement. PR welcome :)

Verstuurd vanaf mijn iPhone

Op 24 dec. 2019 om 19:35 heeft Przemysław Pogorzelec notifications@github.com het volgende geschreven:



Any progress? I have the latest version of the plugin and still can't publish packages to my project feed.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Frenevanosnabrugge%2Fvsts-promotepackage-task%2Fissues%2F29%3Femail_source%3Dnotifications%26email_token%3DABOH2WT44GOHSRKMK724X23Q2JI7LA5CNFSM4IISFN7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHTQSIQ%23issuecomment-568789282&data=02%7C01%7C%7C4fa10e384aec423e5a0e08d788a00fb1%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637128093341490254&sdata=DgotBNLddnAQ37lPgY%2FcqzEYH0bQG%2Bug4DlIYOtEc9I%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABOH2WVFACNQV7FBHNITNXLQ2JI7LANCNFSM4IISFN7A&data=02%7C01%7C%7C4fa10e384aec423e5a0e08d788a00fb1%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637128093341500250&sdata=99UL7aKfqI6p%2Bi7lAlEUBz8DFnsjd4eE%2BHh8QJ%2BMcbw%3D&reserved=0.

itsjusth commented 4 years ago

Project-scoped feeds are the default for new Feeds created in ADO: https://docs.microsoft.com/en-us/azure/devops/artifacts/feeds/project-scoped-feeds?view=azure-devops

It is not possible to change the scope to Organization.

renevanosnabrugge commented 4 years ago

should be fixed in the latest version

jjburr commented 4 years ago

This still appears to be an issue, when using the task and selecting any public feed nothing will populate :(

image

renevanosnabrugge commented 4 years ago

fixed in https://github.com/renevanosnabrugge/vsts-promotepackage-task/pull/54 .