Merge "Document use of | character for variable defaults"
This commit is contained in:
commit
96f112e915
@ -474,6 +474,16 @@ For example, having a configuration file with that option enabled:
|
|||||||
Will prevent JJb from failing if there are any non-initialized variables used
|
Will prevent JJb from failing if there are any non-initialized variables used
|
||||||
and replace them with the empty string instead.
|
and replace them with the empty string instead.
|
||||||
|
|
||||||
|
.. tip::
|
||||||
|
|
||||||
|
Defaults for variables can be set by using the ``|`` character
|
||||||
|
``{var|default_value}``. This is useful if we want to allow users of the
|
||||||
|
job-template to not have to pass a setting if there is a common default for
|
||||||
|
it.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
.. literalinclude:: /../../tests/yamlparser/fixtures/variable_defaults.yaml
|
||||||
|
|
||||||
Yaml Anchors & Aliases
|
Yaml Anchors & Aliases
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
39
tests/yamlparser/fixtures/variable_defaults.xml
Normal file
39
tests/yamlparser/fixtures/variable_defaults.xml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<actions/>
|
||||||
|
<description><!-- Managed by Jenkins Job Builder --></description>
|
||||||
|
<keepDependencies>false</keepDependencies>
|
||||||
|
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
|
||||||
|
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
|
||||||
|
<concurrentBuild>false</concurrentBuild>
|
||||||
|
<canRoam>true</canRoam>
|
||||||
|
<properties/>
|
||||||
|
<scm class="hudson.scm.NullSCM"/>
|
||||||
|
<builders>
|
||||||
|
<hudson.tasks.Shell>
|
||||||
|
<command>echo yolo</command>
|
||||||
|
</hudson.tasks.Shell>
|
||||||
|
</builders>
|
||||||
|
<publishers/>
|
||||||
|
<buildWrappers/>
|
||||||
|
</project>
|
||||||
|
<BLANKLINE>
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<actions/>
|
||||||
|
<description><!-- Managed by Jenkins Job Builder --></description>
|
||||||
|
<keepDependencies>false</keepDependencies>
|
||||||
|
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
|
||||||
|
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
|
||||||
|
<concurrentBuild>false</concurrentBuild>
|
||||||
|
<canRoam>true</canRoam>
|
||||||
|
<properties/>
|
||||||
|
<scm class="hudson.scm.NullSCM"/>
|
||||||
|
<builders>
|
||||||
|
<hudson.tasks.Shell>
|
||||||
|
<command>echo override</command>
|
||||||
|
</hudson.tasks.Shell>
|
||||||
|
</builders>
|
||||||
|
<publishers/>
|
||||||
|
<buildWrappers/>
|
||||||
|
</project>
|
16
tests/yamlparser/fixtures/variable_defaults.yaml
Normal file
16
tests/yamlparser/fixtures/variable_defaults.yaml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
- job-template:
|
||||||
|
name: '{name}-variable-defaults'
|
||||||
|
|
||||||
|
builders:
|
||||||
|
- shell: '{script|echo yolo}'
|
||||||
|
|
||||||
|
- project:
|
||||||
|
name: default
|
||||||
|
jobs:
|
||||||
|
- '{name}-variable-defaults'
|
||||||
|
|
||||||
|
- project:
|
||||||
|
name: override
|
||||||
|
jobs:
|
||||||
|
- '{name}-variable-defaults'
|
||||||
|
script: echo override
|
Loading…
x
Reference in New Issue
Block a user