Fix macro call with null parameters
Change-Id: I48bfa50d4011068bcb0206456be1009c1f9fde54
This commit is contained in:
parent
eebfb9c961
commit
84fe78ad90
@ -277,6 +277,7 @@ class ModuleRegistry(object):
|
||||
expander = self._params_expander
|
||||
else:
|
||||
expander = self._expander
|
||||
component_data = {} # It may be None.
|
||||
expander_params = {**component_data, **(job_data or {})}
|
||||
elements = macro.elements
|
||||
if isinstance(elements, BaseYamlObject):
|
||||
|
19
tests/yamlparser/job_fixtures/macro_with_null_params.xml
Normal file
19
tests/yamlparser/job_fixtures/macro_with_null_params.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?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 {hello}</command>
|
||||
</hudson.tasks.Shell>
|
||||
</builders>
|
||||
<publishers/>
|
||||
<buildWrappers/>
|
||||
</project>
|
17
tests/yamlparser/job_fixtures/macro_with_null_params.yaml
Normal file
17
tests/yamlparser/job_fixtures/macro_with_null_params.yaml
Normal file
@ -0,0 +1,17 @@
|
||||
- builder:
|
||||
name: sample-macro
|
||||
builders:
|
||||
# Add parameter to check if macro behaves the same way as if no params were provided.
|
||||
# That is, it should not be expanded.
|
||||
- shell: 'echo {hello}'
|
||||
|
||||
- job-template:
|
||||
name: sample-job
|
||||
builders:
|
||||
# Place colon but define no parameters.
|
||||
- sample-macro:
|
||||
|
||||
- project:
|
||||
name: sample-project
|
||||
jobs:
|
||||
- sample-job
|
Loading…
Reference in New Issue
Block a user