Open ollerhll opened 7 years ago
related to https://github.com/fnproject/fn/issues/135
@rdallman @zootalures This affects what I am doing on the severless integration and I would like to reopen this convo so that we can figure it out. Since duplicating and maintaining what the language helpers do in the cli to the serverless integration would be a hassle and not maintainable.
👊 Bump
@hibooboo2 This work/branch is currently on hold - what are you proposing exactly? Not exactly clear how the serverless integration dictates things here?
Was hoping to separate language helpers from the cli so that they could be used by serverless. After our convo, seems better to leave as is and just dup for now. So will go that route.
The Problem
Currently LanguageHelpers are part of the CLI source code. This means that support for a given language must be hardcoded in, forcing users to re-download the CLI every time a new language is added, and also not allowing people to provide support for their own language of choice.
Proposed solution
Implement the language helpers as a docker image-based plugin, downloaded/run upon calling
fn init
orfn build
. This has a number of benefits:init.go
andcommon.go
will become slightly less complex, and thelangs
directory is entirely removed.Details
Currently the plan is as follows:
fn init
orfn build
is called, the CLI will run the container from that image, and retrieve the information required as a JSON encoded struct.--runtime
flag (or theruntime
field in thefunc.yaml
will directly refer to a docker image, in which case that image will be pulled from Dockerhub - this is what allows users to use non-official images for their projects.--runtime
flag does not refer to a docker image (i.e. it does not contain a/
), then the image name required is decided dynamically using a naming convention that is yet to be completely decided, but something akin tofnproject/fn-langhelper-$RUNTIME:latest
.Progress
I have begun work on this already, and am approaching a presentable proof of concept in the form of a docker plugin for the java LangHelper; discussion and feedback is greatly welcomed.
tl;dr
To provide an easy, flexible, and pluggable way for developers and users to add support for a given language, without updating the CLI source code.