Added support for Delivery Pipeline Plugin
Change-Id: I54cfa9153700e141d8ba78c881998553b8081658
This commit is contained in:
parent
5f86055a8a
commit
b4b0b9d9ab
@ -533,6 +533,27 @@ def heavy_job(parser, xml_parent, data):
|
||||
data.get('weight', 1))
|
||||
|
||||
|
||||
def delivery_pipeline(parser, xml_parent, data):
|
||||
"""yaml: delivery-pipeline
|
||||
Requires the Jenkins `Delivery Pipeline Plugin.
|
||||
<https://wiki.jenkins-ci.org/display/JENKINS/Delivery+Pipeline+Plugin>`_
|
||||
|
||||
:arg str stage: Name of the stage for this job (default: '')
|
||||
:arg str task: Name of the task for this job (default: '')
|
||||
|
||||
Example:
|
||||
|
||||
.. literalinclude:: \
|
||||
/../../tests/properties/fixtures/delivery-pipeline1.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', '')
|
||||
|
||||
|
||||
class Properties(jenkins_jobs.modules.base.Base):
|
||||
sequence = 20
|
||||
|
||||
|
@ -923,6 +923,34 @@ def logstash(parser, xml_parent, data):
|
||||
key_sub_element.text = str(redis_config.get('key', 'logstash'))
|
||||
|
||||
|
||||
def delivery_pipeline(parser, xml_parent, data):
|
||||
"""yaml: delivery-pipeline
|
||||
If enabled the job will create a version based on the template.
|
||||
The version will be set to the environment variable PIPELINE_VERSION and
|
||||
will also be set in the downstream jobs.
|
||||
|
||||
Requires the Jenkins `Delivery Pipeline Plugin.
|
||||
<https://wiki.jenkins-ci.org/display/JENKINS/Delivery+Pipeline+Plugin>`_
|
||||
|
||||
:arg str version-template: Template for generated version e.g
|
||||
1.0.${BUILD_NUMBER} (default: '')
|
||||
:arg bool set-display-name: Set the generated version as the display name
|
||||
for the build (default: false)
|
||||
|
||||
Example:
|
||||
|
||||
.. literalinclude:: /../../tests/wrappers/fixtures/delivery-pipeline1.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()
|
||||
|
||||
|
||||
class Wrappers(jenkins_jobs.modules.base.Base):
|
||||
sequence = 80
|
||||
|
||||
|
4
setup.py
4
setup.py
@ -92,6 +92,8 @@ setuptools.setup(
|
||||
'priority-sorter=jenkins_jobs.modules.properties:priority_sorter',
|
||||
'promoted-build=jenkins_jobs.modules.properties:promoted_build',
|
||||
'throttle=jenkins_jobs.modules.properties:throttle',
|
||||
('delivery-pipeline=jenkins_jobs.modules.properties:'
|
||||
'delivery_pipeline'),
|
||||
],
|
||||
'jenkins_jobs.parameters': [
|
||||
'bool=jenkins_jobs.modules.parameters:bool_param',
|
||||
@ -222,6 +224,8 @@ setuptools.setup(
|
||||
'timestamps=jenkins_jobs.modules.wrappers:timestamps',
|
||||
('workspace-cleanup=jenkins_jobs.modules.wrappers:'
|
||||
'workspace_cleanup'),
|
||||
('delivery-pipeline=jenkins_jobs.modules.wrappers:'
|
||||
'delivery_pipeline'),
|
||||
],
|
||||
'jenkins_jobs.modules': [
|
||||
'builders=jenkins_jobs.modules.builders:Builders',
|
||||
|
9
tests/properties/fixtures/delivery-pipeline1.xml
Normal file
9
tests/properties/fixtures/delivery-pipeline1.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<properties>
|
||||
<se.diabol.jenkins.pipeline.PipelineProperty>
|
||||
<stageName>Stage</stageName>
|
||||
<taskName>Task</taskName>
|
||||
</se.diabol.jenkins.pipeline.PipelineProperty>
|
||||
</properties>
|
||||
</project>
|
4
tests/properties/fixtures/delivery-pipeline1.yaml
Normal file
4
tests/properties/fixtures/delivery-pipeline1.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
properties:
|
||||
- delivery-pipeline:
|
||||
stage: Stage
|
||||
task: Task
|
9
tests/properties/fixtures/delivery-pipeline2.xml
Normal file
9
tests/properties/fixtures/delivery-pipeline2.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<properties>
|
||||
<se.diabol.jenkins.pipeline.PipelineProperty>
|
||||
<stageName/>
|
||||
<taskName/>
|
||||
</se.diabol.jenkins.pipeline.PipelineProperty>
|
||||
</properties>
|
||||
</project>
|
2
tests/properties/fixtures/delivery-pipeline2.yaml
Normal file
2
tests/properties/fixtures/delivery-pipeline2.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
properties:
|
||||
- delivery-pipeline
|
9
tests/wrappers/fixtures/delivery-pipeline1.xml
Normal file
9
tests/wrappers/fixtures/delivery-pipeline1.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<buildWrappers>
|
||||
<se.diabol.jenkins.pipeline.PipelineVersionContributor>
|
||||
<versionTemplate>1.0.0-${BUILD_NUMBER}</versionTemplate>
|
||||
<updateDisplayName>true</updateDisplayName>
|
||||
</se.diabol.jenkins.pipeline.PipelineVersionContributor>
|
||||
</buildWrappers>
|
||||
</project>
|
4
tests/wrappers/fixtures/delivery-pipeline1.yaml
Normal file
4
tests/wrappers/fixtures/delivery-pipeline1.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
wrappers:
|
||||
- delivery-pipeline:
|
||||
version-template: 1.0.0-${BUILD_NUMBER}
|
||||
set-display-name: true
|
9
tests/wrappers/fixtures/delivery-pipeline2.xml
Normal file
9
tests/wrappers/fixtures/delivery-pipeline2.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<buildWrappers>
|
||||
<se.diabol.jenkins.pipeline.PipelineVersionContributor>
|
||||
<versionTemplate/>
|
||||
<updateDisplayName>false</updateDisplayName>
|
||||
</se.diabol.jenkins.pipeline.PipelineVersionContributor>
|
||||
</buildWrappers>
|
||||
</project>
|
2
tests/wrappers/fixtures/delivery-pipeline2.yaml
Normal file
2
tests/wrappers/fixtures/delivery-pipeline2.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
wrappers:
|
||||
- delivery-pipeline
|
Loading…
x
Reference in New Issue
Block a user