Merge "Support additional features in Build Flow project"

This commit is contained in:
Jenkins 2015-03-10 11:19:40 +00:00 committed by Gerrit Code Review
commit be8def7829
6 changed files with 44 additions and 0 deletions

View File

@ -25,6 +25,13 @@ In order to use it for job-template you have to escape the curly braces by
doubling them in the DSL: { -> {{ , otherwise it will be interpreted by the
python str.format() command.
:Job Parameters:
* **dsl** (`str`): The DSL content. (optional)
* **needs-workspace** (`bool`): This build needs a workspace. \
(default false)
* **dsl-file** (`str`): Path to the DSL script in the workspace. \
Has effect only when `needs-workspace` is true. (optional)
Job example:
.. literalinclude::
@ -35,6 +42,11 @@ Job template example:
.. literalinclude::
/../../tests/yamlparser/fixtures/project_flow_template002.yaml
Job example runninng a DSL file from the workspace:
.. literalinclude::
/../../tests/yamlparser/fixtures/project_flow_template003.yaml
"""
import xml.etree.ElementTree as XML
@ -51,4 +63,11 @@ class Flow(jenkins_jobs.modules.base.Base):
else:
XML.SubElement(xml_parent, 'dsl').text = ''
needs_workspace = data.get('needs-workspace', False)
XML.SubElement(xml_parent, 'buildNeedsWorkspace').text = str(
needs_workspace).lower()
if needs_workspace and 'dsl-file' in data:
XML.SubElement(xml_parent, 'dslFile').text = data['dsl-file']
return xml_parent

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<com.cloudbees.plugins.flow.BuildFlow>
<dsl/>
<buildNeedsWorkspace>false</buildNeedsWorkspace>
<actions/>
<keepDependencies>false</keepDependencies>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>

View File

@ -6,6 +6,7 @@ parallel (
{ build(&quot;job2b&quot;) }
)
</dsl>
<buildNeedsWorkspace>false</buildNeedsWorkspace>
<actions/>
<description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
<keepDependencies>false</keepDependencies>

View File

@ -7,6 +7,7 @@ parallel (
)
build(&quot;job2c&quot;)
</dsl>
<buildNeedsWorkspace>false</buildNeedsWorkspace>
<actions/>
<description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
<keepDependencies>false</keepDependencies>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<com.cloudbees.plugins.flow.BuildFlow>
<dsl/>
<buildNeedsWorkspace>true</buildNeedsWorkspace>
<dslFile>script.groovy</dslFile>
<actions/>
<description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
<keepDependencies>false</keepDependencies>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<concurrentBuild>false</concurrentBuild>
<canRoam>true</canRoam>
<properties/>
<scm class="hudson.scm.NullSCM"/>
<publishers/>
<buildWrappers/>
</com.cloudbees.plugins.flow.BuildFlow>

View File

@ -0,0 +1,5 @@
- job:
name: test_job
project-type: flow
needs-workspace: true
dsl-file: script.groovy