Feature #13240
Ability to render one job template from another, including importing inputs from the referenced template
Status:
Closed
Priority:
Normal
Assignee:
Category:
Foreman
Target version:
Fixed in Releases:
Found in Releases:
Description
The use cases for this feature:
- ability to specialize some template for some case, such as 'package install' for more general 'package action' with overriding some input values,
or having a 'install foreman' job, and 'install foreman with remote execution' - ability to render snippets with providing inputs
- pre-requisite for developer-api, where the user can map the existing templates to the ones that comply with some feature requirements about inputs
Related issues
Associated revisions
History
#1
Updated by Ivan Necas over 6 years ago
- Blocks Feature #10756: Developer API for the integration of remote execution plugin with other plugins/core added
#2
Updated by The Foreman Bot over 6 years ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/foreman_remote_execution/pull/119 added
#3
Updated by Ivan Necas over 6 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset foreman_plugin|d23df31923b8bee3d22c79ca0c2ec6ec9db39475.
#4
Updated by Marek Hulán over 6 years ago
- Legacy Backlogs Release (now unused) set to 109
Fixes #13240 - ability to render one template from another
Usage:
In template, on can reference another template by using:
```
render_template("Run Command - SSH Default", 'command' => 'hello world')
```
It's also possible to import inputs defined on one template into another.
It's done by adding 'Foreign Input Set' to the template (in the job tab under
inputs definition). One can either load all inputs from the target template,
define some exceptions (values that will be overridden by the template and
makes no sense to ask user for them) or explicitly include some.
By default, when rendering a sub-template, it looks at the foreign input sets
and uses the values when a match is found. To explicitly provide
the values regardless of the foreign input sets one can use:
```
render_template("Run Command - SSH Default", {'command' => 'hello world'}, { :with_foreign_input_set => false })
```
In the current behaviour, we check that two inputs with the same name are
not included twice in the template (we need to do it both on template
preparation validation, as well as at job invocation time to cover some edge
cases).