jenkins-job-builder/tests/yamlparser/fixtures/jinja-yaml04-deepcopy.yaml
Adam Romanek c4e2f03776 Fix support for !j2-yaml tag on project level (missing deepcopy impl)
The properties of 'project' objects are deepcopied in
YamlParser._expandYamlForTemplateJob(), including any Jinja2YamlLoader
objects produced by !j2-yaml tag. Because of the missing __deepcopy__()
definition in Jinja2YamlLoader, the parent class' implementation was
used, causing the deepcopied object be of Jinja2Loader type.
Consequently the rendered value was always a string, not an instance of
LateYamlLoader as it supposed to be.

This change fixes the issue in Jinja2YamlLoader and potentially in
LateYamlLoader, however the latter is currently not deepcopied anywhere
so no test could be written to cover it.

Change-Id: I24fda368a4af0e9aac7b78c478ac7b4eddf27b9b
2021-02-01 23:35:39 +01:00

29 lines
639 B
YAML

- job-template:
name: 'test-job-template-{variant}'
builders:
- shell:
echo "{repos}"
- project:
name: test-project
repos_common:
- repo-1
- repo-2
jobs:
- 'test-job-template-{variant}':
variant: 'a'
repos: !j2-yaml: |
{% for repo in repos_common %}
- {{ repo }}
{% endfor %}
- repo-a1
- repo-a2
- 'test-job-template-{variant}':
variant: 'b'
repos: !j2-yaml: |
{% for repo in repos_common %}
- {{ repo }}
{% endfor %}
- repo-b1
- repo-b2