renku template
Manage project templates.
Description
Renku projects are initialized using a project template. Renku has a set of built-in templates that you can use in your projects. These templates can be listed by using:
Commands and options
renku template
Template commands.
renku template [OPTIONS] COMMAND [ARGS]...
ls
Show available templates in Renku or in a template source.
renku template ls [OPTIONS]
Options
- -s, --source <source>
Provide the templates repository url or path
- -r, --reference <reference>
Specify the reference to checkout on the remote template repository
- -v, --verbose
Show detailed description for templates and parameters
set
Set a template for a project.
renku template set [OPTIONS] [TEMPLATE_ID]
Options
- -s, --source <source>
Provide the templates repository url or path
- -r, --reference <reference>
Specify the reference to checkout on the remote template repository
- -p, --parameter <parameters>
Provide parameters value. Should be invoked once per parameter. Please specify the values as follow: –parameter “param1”=”value”
- -f, --force
Override existing template
- -i, --interactive
Ask for overwriting files or parameter values
- -n, --dry-run
Show what would have been changed
Arguments
- TEMPLATE_ID
Optional argument
show
Show detailed template information for a single template.
renku template show [OPTIONS] [TEMPLATE_ID]
Options
- -s, --source <source>
Provide the templates repository url or path
- -r, --reference <reference>
Specify the reference to checkout on the remote template repository
Arguments
- TEMPLATE_ID
Optional argument
update
Update a project’s template.
renku template update [OPTIONS]
Options
- -f, --force
Force an update for fixed template versions
- -i, --interactive
Ask for overwriting files or parameter values
- -n, --dry-run
Show what would have been updated
validate
Validate a template repository and check for common issues.
renku template validate [OPTIONS]
Options
- --json
Return result as JSON.
- -r, --reference <reference>
Git revision/branch/tag to validate the template at.
- -s, --source <source>
Remote template repository to clone and check.
Set a template
You can change a project’s template using renku template set
command:
$ renku template set <template-id>
or use a template from a different source:
$ renku template set <template-id> --source <template-repo-url>
This command fails if the project already has a template. Use --force
flag
to force-change the template.
Note
Setting a template overwrites existing files in a project. Pass
--interactive
flag to get a prompt for selecting which files to keep or
overwrite.
Update a project’s template
A project’s template can be update using:
$ renku template update
If an update is available, this commands updates all project’s files that are
not modified locally by the project. Pass --interactive
flag to select
which files to keep or overwrite.
Passing --dry-run
flags shows the newest available template version and a
list of files that will be updated.
Note
You can specify a template version for a project by passing a
--reference
when setting it (or when initializing a project). This
approach only works for templates from sources other than Renku because
Renku templates are bound to the Renku version. Note that although a
reference can be a git tag, branch or commit SHA, it’s recommended to use
only git tags as a reference.
Note
A template maintainer can disable updates for a template. In this case,
renku update
refuses to update the project. Passing --force
flag
causes Renku to update the template anyways.
Note
Renku always preserve the project’s Renku version that is set in the Dockerfile
even if you overwrite the Dockerfile. The reason is that the project’s metadata
is not updated when setting/updating a template and therefore the project
won’t work with a different Renku version. To update Renku version you need
to use renku migrate
command.
Validating a template repository
If you are developing your own templates in a template repository, there are some rules that templates have to follow. To assist in creating your own templates, you can check that everything is ok with:
$ renku template validate
Running this inside a template repository (not in a Renku project) will check that the manifest and individual templates are correct and follow Renku template conventions, printing warnings or errors if something needs to be changed.