Merge "Update Delivery Pipeline plugin to use convert xml"

This commit is contained in:
Jenkins 2016-08-18 15:16:35 +00:00 committed by Gerrit Code Review
commit 0a4e62fe2c
10 changed files with 40 additions and 22 deletions

View File

@ -39,6 +39,7 @@ from jenkins_jobs.errors import InvalidAttributeError
from jenkins_jobs.errors import JenkinsJobsException
from jenkins_jobs.errors import MissingAttributeError
import jenkins_jobs.modules.base
from jenkins_jobs.modules.helpers import convert_mapping_to_xml
def builds_chain_fingerprinter(parser, xml_parent, data):
@ -616,20 +617,28 @@ def delivery_pipeline(parser, xml_parent, data):
:arg str description: task description template for this job
(default '')
Example:
Minimal Example:
.. literalinclude::
/../../tests/properties/fixtures/delivery-pipeline1.yaml
/../../tests/properties/fixtures/delivery-pipeline-minimal.yaml
:language: yaml
Full Example:
.. literalinclude::
/../../tests/properties/fixtures/delivery-pipeline-full.yaml
:language: yaml
"""
pipeline = XML.SubElement(xml_parent,
'se.diabol.jenkins.pipeline.'
'PipelineProperty')
XML.SubElement(pipeline, 'stageName').text = data.get('stage', '')
XML.SubElement(pipeline, 'taskName').text = data.get('task', '')
XML.SubElement(pipeline, 'descriptionTemplate').text = str(
data.get('description', ''))
pipeline = XML.SubElement(
xml_parent, 'se.diabol.jenkins.pipeline.PipelineProperty')
pipeline.set('plugin', 'delivery-pipeline-plugin')
mapping = [
('stage', 'stageName', ''),
('task', 'taskName', ''),
('description', 'descriptionTemplate', ''),
]
convert_mapping_to_xml(pipeline, data, mapping, fail_required=True)
def zeromq_event(parser, xml_parent, data):

View File

@ -1521,18 +1521,27 @@ def delivery_pipeline(parser, xml_parent, data):
:arg bool set-display-name: Set the generated version as the display name
for the build (default false)
Example:
Minimal Example:
.. literalinclude:: /../../tests/wrappers/fixtures/delivery-pipeline1.yaml
.. literalinclude::
/../../tests/wrappers/fixtures/delivery-pipeline-minimal.yaml
:language: yaml
Full Example:
.. literalinclude::
/../../tests/wrappers/fixtures/delivery-pipeline-full.yaml
:language: yaml
"""
pvc = XML.SubElement(xml_parent,
'se.diabol.jenkins.pipeline.'
'PipelineVersionContributor')
XML.SubElement(pvc, 'versionTemplate').text = data.get(
'version-template', '')
XML.SubElement(pvc, 'updateDisplayName').text = str(data.get(
'set-display-name', False)).lower()
pvc = XML.SubElement(
xml_parent, 'se.diabol.jenkins.pipeline.PipelineVersionContributor')
pvc.set('plugin', 'delivery-pipeline-plugin')
mapping = [
('version-template', 'versionTemplate', ''),
('set-display-name', 'updateDisplayName', False),
]
convert_mapping_to_xml(pvc, data, mapping, fail_required=True)
def matrix_tie_parent(parser, xml_parent, data):

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<properties>
<se.diabol.jenkins.pipeline.PipelineProperty>
<se.diabol.jenkins.pipeline.PipelineProperty plugin="delivery-pipeline-plugin">
<stageName>Stage</stageName>
<taskName>Task</taskName>
<descriptionTemplate>Task-Description</descriptionTemplate>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<properties>
<se.diabol.jenkins.pipeline.PipelineProperty>
<se.diabol.jenkins.pipeline.PipelineProperty plugin="delivery-pipeline-plugin">
<stageName/>
<taskName/>
<descriptionTemplate/>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<buildWrappers>
<se.diabol.jenkins.pipeline.PipelineVersionContributor>
<se.diabol.jenkins.pipeline.PipelineVersionContributor plugin="delivery-pipeline-plugin">
<versionTemplate>1.0.0-${BUILD_NUMBER}</versionTemplate>
<updateDisplayName>true</updateDisplayName>
</se.diabol.jenkins.pipeline.PipelineVersionContributor>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<buildWrappers>
<se.diabol.jenkins.pipeline.PipelineVersionContributor>
<se.diabol.jenkins.pipeline.PipelineVersionContributor plugin="delivery-pipeline-plugin">
<versionTemplate/>
<updateDisplayName>false</updateDisplayName>
</se.diabol.jenkins.pipeline.PipelineVersionContributor>