Fix macro call with null parameters

Change-Id: I48bfa50d4011068bcb0206456be1009c1f9fde54
This commit is contained in:
Vsevolod Fedorov 2023-04-17 10:38:26 +03:00
parent eebfb9c961
commit 84fe78ad90
3 changed files with 37 additions and 0 deletions

View File

@ -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):

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<actions/>
<description>&lt;!-- Managed by Jenkins Job Builder --&gt;</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>

View 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