-
Notifications
You must be signed in to change notification settings - Fork 18
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
[RFC] Custom Providers #7
Comments
Thanks for drafting this initial pass! One thought that occurs to me is that, if the single parameter is JSON, it should be standard JSON, and not the loose JSON accepted by the Another thought is that the "streaming output to |
Yes, we would absolutely do that. Though FYI, I just updated the docs last night to list "experimental commands": https://dotslash-cli.com/docs/flags/ FYI, today you can do:
to get the "pure JSON" of a DotSlash file, if that's helpful for any sort of tooling you build around DotSlash. |
Proposal for Custom Providers
Today, the docs state:
But we have already seen interest in custom providers, so it seems like we should start discussing possible solutions. Note this will likely require some sort of configuration file, which, as a reminder, we would like to avoid having to read in the case of a cache hit.
While the design for the configuration file is still under discussion, let's assume for the moment that at least two locations for provider-specific data are supported:
$XDG_STATE_HOME/dotslash/provider/
where providers installed by the user live/etc/dotslash
or some location for system-wide configuration. In practice, an entity might push enterprise-wide providers to this folder with the expectation that end-users should not write this folder directly.Provider is an executable
Today, the things a provider needs to know are:
One option would be to pass everything thing needs to the executable via a single JSON argument and then stream the stdout from the provider invocation directly to the path where the artifact should be written. This way, the provider does not get any direct knowledge about the layout of the
$DOTSLASH_CACHE
.Because the provider can be an executable, it makes sense for the provider to be a DotSlash file. For example, we could have:
where
<provider-name>
is the name of the DotSlash file, which must also match the"type"
used in the"providers"
section of a DotSlash file. (The"name"
in the DotSlash file should probably also be required to match.) Note that this file will always be executed by DotSlash itself, so there is no need for any special Windows stuff.How to install a provider
A simple option is to support a subcommand like
dotslash -- install-provider URL_TO_PROVIDER
that would fetch the specified URL, verify it contains a DotSlash file, and then write it to$XDG_STATE_HOME/dotslash/provider/<provider-name>
, as appropriate.Another option (we'll call this the "DotSlash Inception" option) would be to enable a DotSlash file to include metadata about how to obtain a provider referenced in the file. Example:
The idea is that when
example-cli
is run for the first time, DotSlash sees that it should use themy-custom-cas
provider. If the user does not have it installed, DotSlash can use the information in theproviders
section to install the provider first and then use it to fetchexample-cli
.There are a lot of questions on how strict we might be on the requirements for a provider. There are also questions around how to know when to install a new version of a provider, or what to do if multiple DotSlash files try to provide different implementations of a provider (particularly with respect to defending against attackers).
The text was updated successfully, but these errors were encountered: