Skip to content
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

Fixed deadlock on IsNuGetPublished #152

Merged
merged 2 commits into from
Oct 11, 2023

Conversation

genriquez
Copy link

@genriquez genriquez commented Aug 17, 2023

Whenever IsNuGetPublished is used with a source that returns a non-200 HTTP result, IsNugetPublished deadlocks and cake script stalls.

Description

Getting general resource information from the NuGet repository is not caught, failing in background. Happens with any non-200 HTTP result. Error is now trapped and dismissed in same way as other errors when fetching dependency info of the package.

Logging was added so users can see the actual error when using Diagnostic verbosity.

Original issue can be easily replicated with the following script:

#addin nuget:?package=Cake.ExtendedNuGet&version=5.0.0

Task("Test")
    .Does(ctx =>
    {    
        // Note the nuget URL is actually missing the `api.` subdomain
        var exists = ctx.IsNuGetPublished(new FilePath("test.nupkg"), "https://nuget.org/v3/index.json");
        Console.Write($"Package exists: {exists}");
    });

RunTarget("Test");

Motivation and Context

We are using private nuget repositories, which require user/password auth. API was replying with 401 causing the cake script to stall.

How Has This Been Tested?

Published locally and tested with our own private nuget repository.

Screenshots (if appropriate):

image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@nils-a
Copy link
Contributor

nils-a commented Sep 10, 2023

Thank you for getting this done, @genriquez.
Was there a specific reason you merged master into this PR?

@nils-a nils-a added the Bug label Oct 11, 2023
@nils-a nils-a added this to the vNext milestone Oct 11, 2023
Copy link
Contributor

@nils-a nils-a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@nils-a nils-a merged commit 10114dc into cake-contrib:develop Oct 11, 2023
5 checks passed
@nils-a
Copy link
Contributor

nils-a commented Oct 11, 2023

@genriquez your changes have been merged, thanks for your contribution 👍

@augustoproiete thanks for getting this sorted!

@nils-a nils-a modified the milestones: vNext, 6.0.0 Dec 13, 2023
@cake-contrib-bot
Copy link

🎉 This issue has been resolved in version 6.0.0 🎉
The release is available on:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants