Merge "Fix !include parsing with variable"
This commit is contained in:
commit
4fb2dd1200
@ -433,8 +433,10 @@ class LazyLoader(object):
|
||||
return "%s %s" % (self._cls.yaml_tag, self._node.value)
|
||||
|
||||
def format(self, *args, **kwargs):
|
||||
self._node.value = self._node.value.format(*args, **kwargs)
|
||||
return self._cls.from_yaml(self._loader, self._node)
|
||||
node = yaml.ScalarNode(
|
||||
tag=self._node.tag,
|
||||
value=self._node.value.format(*args, **kwargs))
|
||||
return self._cls.from_yaml(self._loader, node)
|
||||
|
||||
|
||||
def load(stream, **kwargs):
|
||||
|
65
tests/yamlparser/fixtures/lazy-load-jobs-multi002.xml
Normal file
65
tests/yamlparser/fixtures/lazy-load-jobs-multi002.xml
Normal file
@ -0,0 +1,65 @@
|
||||
<?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>#!/bin/bash
|
||||
#
|
||||
# version 1.1 of the echo vars script
|
||||
|
||||
MSG="hello world"
|
||||
VERSION="1.1"
|
||||
|
||||
[[ -n "${MSG}" ]] && {
|
||||
# this next section is executed as one
|
||||
echo "${MSG}"
|
||||
echo "version: ${VERSION}"
|
||||
exit 0
|
||||
}
|
||||
</command>
|
||||
</hudson.tasks.Shell>
|
||||
</builders>
|
||||
<publishers/>
|
||||
<buildWrappers/>
|
||||
</project>
|
||||
|
||||
<?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>#!/bin/bash
|
||||
#
|
||||
# version 1.2 of the echo vars script
|
||||
|
||||
MSG="hello world"
|
||||
VERSION="1.2"
|
||||
|
||||
[[ -n "${MSG}" ]] && {
|
||||
# this next section is executed as one
|
||||
echo "${MSG}"
|
||||
echo "version: ${VERSION}"
|
||||
exit 0
|
||||
}
|
||||
</command>
|
||||
</hudson.tasks.Shell>
|
||||
</builders>
|
||||
<publishers/>
|
||||
<buildWrappers/>
|
||||
</project>
|
13
tests/yamlparser/fixtures/lazy-load-jobs-multi002.yaml
Normal file
13
tests/yamlparser/fixtures/lazy-load-jobs-multi002.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
- job-template:
|
||||
name: "test-job-{job_name}"
|
||||
builders:
|
||||
- shell:
|
||||
!include-raw: 'lazy-load-scripts/echo_vars_{job_name}.sh'
|
||||
|
||||
- project:
|
||||
name: 'test-project'
|
||||
job_name:
|
||||
- 1.1
|
||||
- 1.2
|
||||
jobs:
|
||||
- "test-job-{job_name}"
|
Loading…
Reference in New Issue
Block a user