Hello, everybody.
I am proposing new patchset to Jenkins Jobs Builder which will break backward compatibility. I plan to release it as the next version, 6.0.
It's purpose is to unify variable and tag expansion inside jobs and macros.
Currently, we have different style for variable expansion and
different effect of some tags depending on where they are used.
Variables are expanded inside job templates and inside macros
which are called with parameters, but not expanded inside jobs and
macros called without parameters.
Tag !include-raw: tag expands file contents if called
inside job templates and macros with parameters, but does not
expand if called from jobs and macros without parameters.
Tag !include-raw-escape: tag does not expand file contents
if called inside job templates and macros with parameters, but
doubles curly braces if called inside jobs and macros without
parameters.
So, when someone wants to copy or move contents between jobs and
job templates, between macros called with and without parameters,
or when someone just adds first parameter to a macro, he should be
aware of this and not forget to change that contents accordingly.
All of these are described in two stories:
https://storyboard.openstack.org/#!/story/2010963
Expand jobs the same way as job templates are expanded
https://storyboard.openstack.org/#!/story/2010588
Expand macros even if called without arguments
So, with this patchset this behaviour will be unified: jobs and
macros without parameters will work the same way as job templates
and macros with parameters: all variables will be expanded, and
tag !include-raw: will expand it's contents. If contents
should not be expanded, tag !include-raw-escape: should be
used instead. If you want to use curly braces not for variable
expansion, you should double them the same way you do this inside
job templates and macros with parameters.
Also, you can now use variable defaults (like: '{branch|master}')
inside macros and be able to call those macros both way: with and
without parameters. And values from global or custom defaults will
be also used inside jobs, not just job templates.
See these patchsets for details:
900745: Add example for variable expansion
inside macros and jobs |
https://review.opendev.org/c/jjb/jenkins-job-builder/+/900745
900858: Unify variable and tags expansion inside jobs and macros
| https://review.opendev.org/c/jjb/jenkins-job-builder/+/900858
Vsevolod.