-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[NuGet BaGet]: Added new BaGet service (Self hosted NuGet server) #9805
Conversation
Sorry it has taken quite a while to respond to this. Given you say that there is no public instance of BaGet, this seems like a badge that would only be relevant to users who self host a shields instance. Would that be a reasonable assessment? In general, we don't add these. Related reading: Lines 31 to 36 in b1f5aec
and I did start an issue about a possible way to deal with this at #9787 but I'm not sure it will go anywhere. I don't think any of us are convinced on the tradeoffs. All of that said, quite a common thing we do is support compatibility with a private or self-hosted version of a centralised service as long as your private instance is API compatible with the centralised version. So our GitLab badges will work with your self-hosted GitLab as long as it is running a version that is API-compatible with https://gitlab.com/ . Our Packagist badges will work with your private packagist install as long as it is running a version that is API-compatible with https://packagist.org/ and so on. Essentially, if we can test everything against a public instance and also tack on a So here's my question: There are some BaGet-specific customisations going on in this PR, but would it be possible to deliver a subset of what you're trying to do here by bolting an optional parm onto NuGet and documenting that it also works with BaGet, or is BaGet not quite API compatible enough for that to work? i.e: are the changes in this PR BaGet-related enhancements or are they fundamentally necessary to get the thing to work? |
I understand the concerns about maintaining an integration with a provider that can't easily be tested. Reading the issues that you linked, is this something that should be implemented using the |
The dynamic json badge has the advantage that you can make custom badges just by constructing a URL. So using a URL that returns JSON like https://pypi.org/pypi/pip-abandoned/json I can construct a URL like https://img.shields.io/badge/dynamic/json?query=info.requires_python&label=python&url=https%3A%2F%2Fpypi.org%2Fpypi%2Fpip-abandoned%2Fjson that extracts a value from it and puts it on a badge. The downside of this is that it can only take you so far. If you want to do something more advanced than just extract a value and display it, for example:
you can't do that with the dynamic badge. With the endpoint badge, the sky's the limit. You can have all that and a bag of chips, but you do need to host the endpoint that can call your API, do whatever processing you need, and serve a JSON document conforming to the badge schema somewhere, and we recognise this does represent some additional overhead. |
This PR adds support for version & download badges from a BaGet server.
I'm not sure how to add examples / tests for this new service due to it's self hosted nature and no public instance being available (that I'm aware of)
I've tested badge generation against our local (private) BaGet instance with the following commands:
I've extended the logic from
nuget-v3-service-family
to support the small differences in API in the BaGet server api implementation, mainly searching without thepackageid
parameter and the package version being available in the response, without need for lookup in theversions
array (which is also sorted in DESC, not ASC)