-
Notifications
You must be signed in to change notification settings - Fork 25
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
A new strategy for templates and versioning #274
Comments
Would it make sense to not rely on the zip at all but instead to introduce the concept of a template "source" . If we have a dedicated templates directory, which we judiciously tag, we could just pull the template as needed. In my head it looks something like this:
We could consolidate 2 and 3 if we come up with a well-defined template structure and we could optimize suborbital template repositories . i.e. Just food for thought, either way excellent report. |
@rnpridgeon I like this idea, but I think I would still rather pin the versions to git tags. The main problem I see is that templates are more than a single file. Maybe it could point to a manifest file in that subdirectory? Something like... template.yaml name: tinygo-db
language: tinygo
description: A sample TinyGo Runnable with database capabilities
compatible:
reactr: >0.15.0 and then the actual template files could be stored in a standard folder structure adjacent to the manifest file. The major benefit I see for something like this is that we could have multiple templates per language. It would also be neat to have "base templates" that could be imported and composed together, but that's probably too wild. |
Yep you get the idea, we come up with a well-defined structure for template metadata and use that as a means to reference a specific template resource itself. I haven't put a terrible amount of thought into exactly what that looks like but the idea is to keep metadata and data separate while maintaining a stable relationship between the two. |
I think it would be helpful to bake in the release templates, into the release binary. We can still give people the ability to specify a repo/branch or zip somewhere, but most people aren't going to need that. This way for 99% of users, we can assure that |
Related issue: #167
Background
What is a Template?
A Template can be any one of these things
These templates are currently kept in one of two places: in the
suborbital/subo
repository in thetemplates
directory, or in a separate repository with the same structure (e.g.suborbital/runnable-templates
). By default Subo grabs its templates from themain
branch of the Subo repository. The repository and/or branch can be overridden:Why do we want customizable templates?
If you want to include extra libraries in your Runnables you need a custom template. This is important for Compute clients, who may want to provide something more specific to their use case than the default Reactr
func run(input []byte) ([]byte, error)
Runnable signature. For example, in Rocketship we use a customized template that presents the user (i.e. the person writing Runnables) with a slightly different signature:Compared to default AssemblyScript template has this signature:
Problems
Subo keeps a local cache of templates and does not update them by default.
This has caused a bunch of issues in the past and has the potential to break things very badly in the future. By default, for example, a fresh installation of
subo
downloads its templates fromsuborbital/subo
on themain
branch, which is not guaranteed to be stable or compatible with the builders thatsubo
spawns. Most of the time it does work fine because Runnable templates aren't updated very often and the Docker image tags themselves are parameterized in the templates.Because templates are not updated by default, it is possible to get stuck with old templates because we cache them aggressively.
The
--update-templates
flag exists to force an update for this reason.There isn't a nice way to get old templates
subo
always fetches frommain
. It would be good to be able to fetch older templates for compatibility reasons.This is less of a problem for local Runnable development, but it can be a problem in SCN where the code snippet is injected into a fresh template every time. Runnables are pinned to a specific Reactr version, but the templates are not. It should always be possible to build a Runnable with the template it was first written for, and optionally upgrade the template if that is desired.
The
runnable-templates
idea only applies to Runnable templates.As mentioned above,
subo
uses its templates directory for more than just Runnables. Atmo projects and Docker/K8s definition files are also generated by Subo. I suggest using renaming that repo tosubo-templates
so that it is named better.Runnable templates are pretty hard to write
TODO.
Tasks
Subo CLI tasks:
Tasks related to moving templates into
suborbital/subo-templates
The text was updated successfully, but these errors were encountered: