-
Notifications
You must be signed in to change notification settings - Fork 30
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
Plugin system and "renderers" #288
base: master
Are you sure you want to change the base?
Conversation
13698c6
to
0ece687
Compare
Looking forward to this :-)
I would advise leaving this for later, in order to
To expand on 2., I will admit here to be very nervous about anything that looks like packaging and distribution, and anything that does automatic downloads. The first bout of nerves is that it will effectively determine how packaging works for everything to do with |
0ece687
to
9f926c0
Compare
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.
Wooo RFC \o/
plugin(kind: string, url: string, input: JSON) -> JSON | ||
``` | ||
|
||
- `kind` is the kind of plugin invoked (eg. `render`). Plugin binaries can |
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.
What does kind
actually affect? I don't see it mentioned after here.
`https://jkcfg.github.io/plugins/helm/0.1.0/plugin.json`. This JSON file is | ||
really plugin metadata (see next section). It is highly recommended, for | ||
reproducibility, to ensure the plugin definition and binaries the URL points | ||
to be immutable to encode a version in the URL. |
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.
"... to be to encode"
1. Packaging. One goal is to be able to package all the dependencies needed | ||
for a `jk` script to run. Having the plugin abstraction with metadata | ||
allows that. | ||
|
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 reckon it's worth mentioning |
here -- i.e., no plugins, just pipe the output of another command into jk
(or write files and use them as input to jk
, etc.). One of the problems I remember from our discussions of this is that you can't have more than one source of input via |
; another (slightly harder to pin down) is that it's better to have control from within JavaScript code, so you can e.g., encapsulate the fact of the external tooling.
|
||
For development purposes it is possible to point the `plugin` RPC call to a | ||
local file by giving a relative path to the JSON plugin definition. The | ||
`binaries` fields can point at plugins present in the `PATH`. |
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.
Another formulation of this would be to expect a relative path to the binary. This would make sense if the binaries are shipped with the code wrapping them, for example.
|
||
VERSION := $(shell git describe --tags) | ||
|
||
jk: pkg/__std/lib/assets_vfsdata.go FORCE | ||
ifneq ($(RW),yes) |
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 guessing the motivation here is that occasionally it's a pain to have it not build because you've introduced a new dependency. You can just issue go mod tidy
when that's the case.
Co-Authored-By: Michael Bridgen <[email protected]>
Co-Authored-By: Michael Bridgen <[email protected]>
Co-Authored-By: Michael Bridgen <[email protected]>
Wouldn't it be nice if we could bring into
jk
objects from external sources? For instance we could render a helm chart, bring the result intojk
as an array of objects, modify objects as we see fit and write the final result to files.This PR introduces plugins and the first type of plugins:
Renderer
. ARenderer
takes a js object as input and returns a js value. This PR includes a testEcho
Renderer
plugin that simply outputs the input it receives.Plugins are identified by a json document with some metadata about the plugin, including where to find plugin binaries for the current OS/architecture.
echo.json
simple usage example
TODO:
Support downloading the plugin description and the plugin binaries from http URLsdecided not to do this.@jkcfg/kubernetes
(helm plugin kubernetes#55)Updates: #133