diff options
author | Daniel Watkins <daniel.watkins@canonical.com> | 2017-08-14 18:18:51 -0400 |
---|---|---|
committer | Daniel Watkins <daniel.watkins@canonical.com> | 2018-02-23 12:04:45 -0500 |
commit | aa74f8d67cb89c80369d8d3096ee0851da9c5adb (patch) | |
tree | a60eb1566fcfcef8b9d46ac56f74f5887b102fe8 /tests/yamlparser/fixtures | |
parent | bc80e5e2f3d2eb8e871d38d1943a9ae555744dc3 (diff) | |
download | python-jenkins-job-builder-aa74f8d67cb89c80369d8d3096ee0851da9c5adb.tar.gz python-jenkins-job-builder-aa74f8d67cb89c80369d8d3096ee0851da9c5adb.tar.xz python-jenkins-job-builder-aa74f8d67cb89c80369d8d3096ee0851da9c5adb.zip |
Add support for {% include %} in Jinja2 templates
This allows the use of the {% include %} tag[0] within Jinja2 templates,
with the same search path used for looking up other templates (i.e. the
one which LocalLoader is instantiated with).
[0] http://jinja.pocoo.org/docs/2.9/templates/#include
Change-Id: I0403c385ee317e1460a80a9bf717aa4712f37e2f
Diffstat (limited to 'tests/yamlparser/fixtures')
-rw-r--r-- | tests/yamlparser/fixtures/jinja-include01.xml | 23 | ||||
-rw-r--r-- | tests/yamlparser/fixtures/jinja-include01.yaml | 15 | ||||
-rw-r--r-- | tests/yamlparser/fixtures/jinja-include01.yaml.inc | 1 | ||||
-rw-r--r-- | tests/yamlparser/fixtures/jinja-include02.xml | 23 | ||||
-rw-r--r-- | tests/yamlparser/fixtures/jinja-include02.yaml | 14 |
5 files changed, 76 insertions, 0 deletions
diff --git a/tests/yamlparser/fixtures/jinja-include01.xml b/tests/yamlparser/fixtures/jinja-include01.xml new file mode 100644 index 00000000..de5ed018 --- /dev/null +++ b/tests/yamlparser/fixtures/jinja-include01.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <actions/> + <description><!-- Managed by Jenkins Job Builder --></description> + <keepDependencies>false</keepDependencies> + <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding> + <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding> + <concurrentBuild>false</concurrentBuild> + <canRoam>true</canRoam> + <properties/> + <scm class="hudson.scm.NullSCM"/> + <builders> + <hudson.tasks.Shell> + <command>test variable +a +b +c +</command> + </hudson.tasks.Shell> + </builders> + <publishers/> + <buildWrappers/> +</project> diff --git a/tests/yamlparser/fixtures/jinja-include01.yaml b/tests/yamlparser/fixtures/jinja-include01.yaml new file mode 100644 index 00000000..c64bf778 --- /dev/null +++ b/tests/yamlparser/fixtures/jinja-include01.yaml @@ -0,0 +1,15 @@ +- builder: + name: test-builder + builders: + - shell: + !include-jinja2: jinja-include01.yaml.inc + +- job: + name: test-job + builders: + - test-builder: + var: "test variable" + test_list: + - a + - b + - c diff --git a/tests/yamlparser/fixtures/jinja-include01.yaml.inc b/tests/yamlparser/fixtures/jinja-include01.yaml.inc new file mode 100644 index 00000000..7fbaa1cb --- /dev/null +++ b/tests/yamlparser/fixtures/jinja-include01.yaml.inc @@ -0,0 +1 @@ +{% include 'jinja01.yaml.inc' %} diff --git a/tests/yamlparser/fixtures/jinja-include02.xml b/tests/yamlparser/fixtures/jinja-include02.xml new file mode 100644 index 00000000..de5ed018 --- /dev/null +++ b/tests/yamlparser/fixtures/jinja-include02.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <actions/> + <description><!-- Managed by Jenkins Job Builder --></description> + <keepDependencies>false</keepDependencies> + <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding> + <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding> + <concurrentBuild>false</concurrentBuild> + <canRoam>true</canRoam> + <properties/> + <scm class="hudson.scm.NullSCM"/> + <builders> + <hudson.tasks.Shell> + <command>test variable +a +b +c +</command> + </hudson.tasks.Shell> + </builders> + <publishers/> + <buildWrappers/> +</project> diff --git a/tests/yamlparser/fixtures/jinja-include02.yaml b/tests/yamlparser/fixtures/jinja-include02.yaml new file mode 100644 index 00000000..25a43d50 --- /dev/null +++ b/tests/yamlparser/fixtures/jinja-include02.yaml @@ -0,0 +1,14 @@ +- builder: + name: test-builder + builders: + - shell: !j2: "{% include 'jinja01.yaml.inc' %}" + +- job: + name: test-job + builders: + - test-builder: + var: "test variable" + test_list: + - a + - b + - c |