Add template-name as a variable that can be used in a template
In complex configurations it may be useful to have a template print out its name so that a given job can be easily traced to its definition. Change-Id: I1cfed9c27a58b45ba48aeed04839bfc8f54a831e
This commit is contained in:
parent
294dea66b2
commit
7ef05f7373
@ -294,6 +294,7 @@ class YamlParser(object):
|
||||
if key not in params:
|
||||
params[key] = template[key]
|
||||
|
||||
params['template-name'] = template_name
|
||||
expanded = deep_format(template, params, allow_empty_variables)
|
||||
|
||||
job_name = expanded.get('name')
|
||||
|
@ -104,6 +104,9 @@
|
||||
</com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
|
||||
</triggers>
|
||||
<builders>
|
||||
<hudson.tasks.Shell>
|
||||
<command>echo JJB template: complete001_{version}</command>
|
||||
</hudson.tasks.Shell>
|
||||
<hudson.tasks.Shell>
|
||||
<command>#!/usr/bin/env python
|
||||
#
|
||||
|
@ -99,6 +99,7 @@
|
||||
- pre-scm-shell-ant
|
||||
- copy-files
|
||||
builders:
|
||||
- shell: 'echo JJB template: {template-name}'
|
||||
- shell: |
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
|
Loading…
x
Reference in New Issue
Block a user