New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check NuGet.org for SiteExtensions #2568
Conversation
@EricSten-MSFT, It will cover your contributions to all .NET Foundation-managed open source projects. |
@EricSten-MSFT, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request. |
packages = packages.Concat(foundUIPackages); | ||
} | ||
} | ||
packages.OrderByDescending(p => p.DownloadCount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you meant to assign it back? If you don't it's a no op!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally I had:
packages.Concat(await remoteRepo.Search(string.IsNullOrWhiteSpace(filter) ? string.Empty : filter, filterOptions: filterOptions));
but it turns out that .Concat doesn't actually concat to packages; it simply returns the concatination of packages + 1st arg. This was the cause of the last bug fix.
From the description of foo.Concat(bar) , I foolishly thought that it would concatenate bar to foo in-place. I was wrong; foo is not modified by .Concat().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None of the Linq methods ever have side effects. It's all about building new enumerations over existing ones.
var foundUIPackages = await remoteRepo.Search(string.IsNullOrWhiteSpace(filter) ? string.Empty : filter, filterOptions: filterOptions); | ||
if (null != foundUIPackages) | ||
{ | ||
packages = packages.Concat(foundUIPackages); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does that deal with packages that are on both feeds? I think we need find duplicates and only keep the latest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the mission was to find the ones on the NuGet.org feed first, and add the ones from siteextensions.org second. I didn't know there was a requirement to eliminate duplicates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose we could tell people that once they transition to nuget.org, they should hide all the packages from siteextensions.net.
package = await remoteRepo.GetLatestPackageByIdFromSrcRepo(id); | ||
foreach (SourceRepository remoteRepo in remoteRepos) | ||
{ | ||
package = await remoteRepo.GetLatestPackageByIdFromSrcRepo(id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure this is quite correct, as this will return any package from nuget.org, even if it doesn't have our AzureSiteExtension
tag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you're right. Only .Search() has the special logic to automagically add the AzureSiteExtension magic tag. I'll have to figure out the best place to put this magic to avoid duplicating code everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side Question: is "AzureSiteExtension" case sensitive? And do we need to worry about collisions?
e.g. "DefinitelyNotAnAzureSiteExtension" vs. "AzureSiteExtension"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about the casing, but I highly doubt that it is sensitive (you'll have to try it on NuGet.org with the one package we have there).
No, I'm not worried about those collisions. The tag is unique enough that it won't happen accidentally.
package = await remoteRepo.GetPackageByIdentity(id, version); | ||
foreach (SourceRepository remoteRepo in remoteRepos) | ||
{ | ||
package = await remoteRepo.GetPackageByIdentity(id, version); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as previous comment.
repoPackage = await remoteRepo.GetLatestPackageByIdFromSrcRepo(id); | ||
foreach (SourceRepository rr in remoteRepos) | ||
{ | ||
repoPackage = await rr.GetLatestPackageByIdFromSrcRepo(id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same AzureSiteExtension
issue
repoPackage = await remoteRepo.GetPackageByIdentity(id, version); | ||
foreach (SourceRepository rr in remoteRepos) | ||
{ | ||
repoPackage = await rr.GetPackageByIdentity(id, version); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same AzureSiteExtension
issue
A good way to see the problem is to try to install the |
// is the best we can do based on how nuget.org works | ||
searchTerm = $"tags:AzureSiteExtension title:\"{searchTerm}\""; | ||
searchTerm = $"tags:AzureSiteExtension id:\"{searchTerm}\""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm switching this to id:
, since the functional tests pass a package Id instead of a title in places. If this is too much of a breaking change, I can change the functional tests to pass package Titles instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EricSten-MSFT you can assume that no one is using the nuget.org branch of the current code, so don't worry about breaking changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EricSten-MSFT as I'm trying to finally make this transition happen, this change from title
to id
seems problematic, because it cause search to only work for exac match. e.g. compare:
- Search by 'counter' successfully finds filecounter package when using
title:counter
: https://www.nuget.org/packages?q=tags%3AAzureSiteExtension+title%3Acounter - The same doesn't find it when using
id:counter
: https://www.nuget.org/packages?q=tags%3AAzureSiteExtension+id%3Acounter
If the only issue here was a functional test, I think we should revert back to title. Do you know what test was failing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I moved back to title and updated the tests. 59d0283
@davidebbo Re: |
|
||
if (!string.IsNullOrEmpty(info.FeedUrl)) | ||
{ | ||
isNuGetPackage = System.Text.RegularExpressions.Regex.IsMatch( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use the helper that does that check to avoid duplication?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I was too lazy to refactor IsNuGetRepo to take a string instead of a SourceRepository. I'll fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get it in after fixing the nuget.org check duplication.
Can you also squash/rebase over latest?
Actually, I think I can get GitHub to do the Squash & Merge. |
&& version.Equals(localPackageVersion, StringComparison.OrdinalIgnoreCase) | ||
&& rr.PackageSource.Source.Equals(localPackageFeedUrl, StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
isInstalled = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is actually incorrect when the version is blank, as it prevents upgrading from the first feed to the second feed if you already have the latest from the first (but second has newer one).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidebbo : Fixed. Submitted a new pull request with the fix.
commit f3f98a6 Merge: 9b5da52 b3f8936 Author: Eric Stenson <ericsten@php.net> Date: Thu Oct 5 16:14:37 2017 -0700 merge in upstream stuff commit 9b5da52 Author: Eric Stenson <ericsten@php.net> Date: Thu Oct 5 15:56:15 2017 -0700 Fix site extension version check across multiple repos commit b3f8936 Author: Ahmed ElSayed <ahmels@microsoft.com> Date: Fri Sep 29 17:37:17 2017 -0700 Reduce size of test_data for ARM requests to 8MB/2 commit 8665f80 Author: Ahmed ElSayed <ahmels@microsoft.com> Date: Fri Sep 29 17:16:41 2017 -0700 Return 409 on functions secret api if the storageType is set to blob. commit 82791e9 Author: Nick Walker <nickwalk@microsoft.com> Date: Tue Oct 3 11:35:42 2017 -0700 Zip push-to-deploy feature (projectkudu#2570) commit 1d5f917 Author: Suwath Ch <suwatch@microsoft.com> Date: Sun Oct 1 12:57:21 2017 -0700 Convert Dropbox v1 to v2 tests commit f0de225 Author: Eric Stenson <ericsten@php.net> Date: Wed Sep 27 13:44:51 2017 -0700 simplify some csproj files commit 75a3839 Author: Eric Stenson (work) <EricSten-MSFT@users.noreply.github.com> Date: Wed Sep 27 13:40:08 2017 -0700 Check NuGet.org for SiteExtensions (projectkudu#2568) Check NuGet.org for SiteExtensions commit 60f1c5d Author: Eric Stenson <ericsten@php.net> Date: Wed Sep 27 11:48:41 2017 -0700 Eliminate regex duplication for IsNuGet commit 319dec8 Author: Eric Stenson <ericsten@php.net> Date: Tue Sep 19 15:57:22 2017 -0700 even more fixes to get functional tests passing commit 0891d0e Author: Eric Stenson <ericsten@php.net> Date: Mon Sep 18 13:07:46 2017 -0700 more fixes to get functional tests passing commit 5e3102e Author: Eric Stenson <ericsten@php.net> Date: Fri Sep 15 19:03:54 2017 -0700 bug fixes for functional tests commit 150dab5 Author: Nick Walker <nickwalk@microsoft.com> Date: Fri Sep 15 12:33:43 2017 -0700 Assorted Linux fixes/updates (projectkudu#2563) - Open the first 10 Docker logfiles before reading their FileInfos to update the CIFS metadata. CIFS metadata on Linux "lags", and fresh data (esp. size) may be needed for some callers. - Fix "Location" header URL value in FetchHandler - Put link to Docker logs (both API and zip endpoints) on Kudu homepage on Linux - Restore VFS link on Kudu homepage on Linux commit ed2c183 Author: David Ebbo <david.ebbo@gmail.com> Date: Thu Sep 14 17:51:14 2017 -0700 Version 66 commit 9676026 Author: bala16 <balag@outlook.com> Date: Thu Sep 14 10:03:39 2017 -0700 Fix ArgumentNullException when enumerating WebHooks commit dc41d86 Merge: dbbd3b4 6152ca9 Author: Eric Stenson <ericsten@php.net> Date: Wed Sep 13 17:17:27 2017 -0700 Merge remote-tracking branch 'upstream/master' commit dbbd3b4 Author: Eric Stenson <ericsten@php.net> Date: Wed Sep 13 17:14:16 2017 -0700 Because VS cares... commit 00dc549 Author: Eric Stenson <ericsten@php.net> Date: Wed Sep 13 17:12:04 2017 -0700 Check NuGet.org for SiteExtensions commit 6152ca9 Author: Nick Walker <nickwalk@microsoft.com> Date: Fri Sep 8 16:24:50 2017 -0700 Fix for projectkudu#2547 occasional null HttpContext on Mono (projectkudu#2556) commit bb683db Author: bala16 <balag@outlook.com> Date: Thu Sep 7 17:13:17 2017 -0700 Add git/mingw32/bin to path commit af2029b Author: shucai <shucai@microsoft.com> Date: Thu Sep 7 09:31:57 2017 -0700 remove checks for host.json when deploying a functionApp
No description provided.