Hi, I am trying to use jinja2 to construct a list in a project stanza to be used to realize a job-template, however apparently the list endss up "literal" in the job definition. This example will clarify:
-------------------------------------------------------------------
$ cat test.yaml
- project:
name: foo
param: !j2: "{{ [1, 2] }}"
jobs:
- bar-{param}
- project:
name: foo2
param: !j2-yaml: |
{% for x in [3, 4] %}
- {{ x }}
{% endfor %}
jobs:
- bar-{param}
- job-template:
name: bar-{param}
-------------------------------------------------------------------
$ jenkins-jobs test test.yaml 2>&1 | grep "Job name" 2>/dev/null
INFO:jenkins_jobs.builder:Job name: bar-[1, 2]
INFO:jenkins_jobs.builder:Job name: bar-[3, 4]
-------------------------------------------------------------------
What I'd expect are of course the following jobs: bar-1, bar-2, bar-3, bar-4. Am I missing the correct usage of j2 or is this somehow not supported by JJB? This is with JJB 5.0.2:
$ jenkins-jobs --version
Jenkins Job Builder version: 5.0.2
Thanks!