<div dir="ltr">Hi,<br><div><br><br></div><div>macros do not get substitution performed unless you provide a variable to be substituted in.<br><br><br></div><div>Following would trigger the behaviour:<br><br><br>- job-template:<br> name: '{foo}-test'<br> builders:<br> - test_builder:<br> FOO_BAR: hello<br> - shell: |<br> echo ${{FOO_3}}<br><br></div><div><br></div><div>Definitely a bit confusing, essentially the macro is added in through a lookup in the register.ModuleRegistry.dispatch() method, where only if the component is a dict is a substitution performed:<br><a href="https://github.com/openstack-infra/jenkins-job-builder/blob/4a8b93b8c2d517c8dc27d91437454890cc49a640/jenkins_jobs/registry.py#L149-L168">https://github.com/openstack-infra/jenkins-job-builder/blob/4a8b93b8c2d517c8dc27d91437454890cc49a640/jenkins_jobs/registry.py#L149-L168</a><br></div><div><br><br></div><div>I wonder if jinja templating would avoid some of the quirks we run into around using python's string formatting for substitution?<br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 13 August 2015 at 07:05, Ian Wienand <span dir="ltr"><<a href="mailto:iwienand@redhat.com" target="_blank">iwienand@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Just trying to get my head around this from [1]:<br>
<br>
---<br>
<br>
- builder:<br>
name: test_builder<br>
builders:<br>
- shell: |<br>
echo ${FOO_1}<br>
echo ${{FOO_2}}<br>
<br>
- job-template:<br>
name: '{foo}-test'<br>
builders:<br>
- test_builder<br>
- shell: |<br>
echo ${{FOO_3}}<br>
<br>
- project:<br>
name: 'foo'<br>
jobs:<br>
- '{foo}-test':<br>
foo: bar<br>
<br>
---<br>
<br>
that's going to output a job basically<br>
<br>
---<br>
echo ${FOO_1}<br>
echo ${{FOO_2}}<br>
echo ${FOO_3}<br>
---<br>
<br>
Why do I *not* get a "FOO_1 parameter missing" for test_builder? If I<br>
do<br>
<br>
---<br>
<br>
- test_builder:<br>
FOO_1: bar<br>
<br>
---<br>
<br>
it does actually come out with "echo $bar" as you might expect.<br>
<br>
Or the same question in reverse: why *do* I get an error about a<br>
missing parameter if I have just "${FOO_3}" in the job-template?<br>
<br>
I can't find a clear explanation for this, although there might be<br>
one I'm missing. If I can find one, I'll add it to some sort of<br>
documentation.<br>
<br>
-i<br>
<br>
[1] <a href="https://review.openstack.org/#/c/212246" rel="noreferrer" target="_blank">https://review.openstack.org/#/c/212246</a><br>
<br>
_______________________________________________<br>
OpenStack-Infra mailing list<br>
<a href="mailto:OpenStack-Infra@lists.openstack.org" target="_blank">OpenStack-Infra@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-infra" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-infra</a><br>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Darragh Bailey<br>"Nothing is foolproof to a sufficiently talented fool"</div>
</div>