-
-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Sometimes it is useful to know the target name, and possibly also the (top level) template name being processed.
e.g. Shippable CI supports running from a .travis.yml, as mentioned at http://docsv2.readthedocs.io/en/latest/config.html#shippable-yml , however there are some perticular differences, like python: 3.4.4 doesnt work because Shippable expects only x.y. (coala uses 3.4.4 )
While it is currently possible to handle this minor difference by creating shippable.yml.jj2 which overrides blocks of travis.yml.jj2 , if the difference is removing only .4 it would be nice to include this inside travis.yml.jj2
{% if __target__ != 'shippable.yml' %}.4{% endif %}and then the template is invoked twice at
targets:
- .travis.yml: travis.yml.jj2
- shippable.yml: travis.yaml.jj2The same thing can be achieve slightly better if the top level template name is also exposed, which creates a more logical form of polymorphism.
symlink shippable.yml.jj2 -> travis.yaml.jj2
then inside travis.yml.jj2,
{% if __template__ != 'shippable.yml.jj2' %}.4{% endif %}