Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remote template repositories (#437)
* feat: remote template repositories * Update cmd/create.go Co-authored-by: Lance Ball <lball@redhat.com> * docs: extensible templates * feat: remote template repositories * Update docs/guides/language-packs.md * Update docs/guides/language-packs.md Co-authored-by: Lance Ball <lball@redhat.com> * Update docs/guides/language-packs.md Co-authored-by: Lance Ball <lball@redhat.com> * Update docs/guides/templates.md Co-authored-by: Lance Ball <lball@redhat.com> Co-authored-by: Lance Ball <lball@redhat.com>
- Loading branch information
Showing
32 changed files
with
401 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Language Packs | ||
|
||
A Language Pack is the mechanism by which the Functions binary can be extended to support additional runtimes, function signatures, even operating systems and installed tooling for a function. A Language Pack includes | ||
- a .builders.yaml file containing a reference to a builder OCI image reference, which conforms to the buildpack builder specification, and contains references to buildpacks supporting this Language Pack | ||
- one or more template directories illustrating the Language Pack's recognized function signatures | ||
- tests and documentation for the templates | ||
|
||
Built in to the Functions library is a basic language pack for each supported language. | ||
|
||
For an example external language pack, see [https://github.com/lance/gcf-kn/tree/main/ruby] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Templates | ||
|
||
When a Function is created, an example implementation and a Function metadata file are written into the new Function's working directory. Together, these files are referred to as the Function's Template. Included are the templates 'http' and 'events' for each supported language runtime. | ||
|
||
These embedded templates are minimal by design. The Function contains a minimum of external dependencies, and the 'func.yaml' defines a final environment within which the Funciton will execute that is devoid of any extraneous packages or services. | ||
|
||
To make use of more complex inital Function implementions, or to define runtime environments with arbitrarily complex requirements, the templates system is fully pluggable. | ||
|
||
## External Git Repositories | ||
|
||
When creating a new Function, a Git repository can be specified as the source for the template files. For example, the Boson Project maintains a set of example Functions at https://github.com/boson-project/templates which can be used during project creation. | ||
|
||
For example, the Boson Project Templates repository contains an example "Hello World" Function implementation in each of the officially supported languages. To use this template via the CLI, use the flags: | ||
|
||
func create <name> --template hello-world --repository https://github.com/boson-project/templates | ||
|
||
## Locally Installing Repositories | ||
|
||
Template Repositories can also be installed locally by placing them in the Functions configuration directory. | ||
|
||
To install the Boson Project templates locally, for example, clone the repository and name it `boson` using `git clone https://github.com/boson-project/templats ~/.config/func/repositories/boson` | ||
|
||
Once installed, the Boson Hello World template can be specified: | ||
|
||
func create <name> --template boson/hello-world | ||
|
||
## Language Packs | ||
|
||
In addition to example implementations, a template includes a `func.yaml` which includes metadata about the Function. By default this is populated with things like the new Function's name. It also includes a reference to the specific tooling which compiles and packages the Function into its deployable form. This is called the Builder. By customizing this metadata, it is more than just a template; it is referred to as a Language Pack. See [Project Configuration with func.yaml](func_yaml.md). | ||
|
||
A Language Pack can support additional function signatures and can fully customize the environment of the final running Function. For more information see the [Language Pack Guide](language-packs.md). | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.