Add integration with Allure Report plugin.
Allure Report step will now be available from the `publishers` section. Change-Id: Idef39206cf05cd6a4949e87da13bf731b624b577
This commit is contained in:
parent
504f6b78ae
commit
e0178ef02e
jenkins_jobs/modules
tests/publishers/fixtures
@ -40,6 +40,73 @@ from jenkins_jobs.modules import hudson_model
|
||||
import jenkins_jobs.modules.helpers as helpers
|
||||
|
||||
|
||||
def allure(registry, xml_parent, data):
|
||||
"""yaml: allure
|
||||
|
||||
Publish Allure report for the build. Requires the Jenkins
|
||||
:jenkins-wiki:`Allure Plugin <Allure+Plugin>`.
|
||||
|
||||
:arg str jdk: String identifier for a JDK installation in Jenkins
|
||||
:arg str commandline: String identifier for a Allure-commandline tool
|
||||
installation
|
||||
:arg str report-build-policy: String identifier for a report build
|
||||
policy enum. Possible values: 'ALWAYS', 'UNSTABLE', 'UNSUCCESSFUL'.
|
||||
(By default is 'ALWAYS')
|
||||
:arg bool include-properties: Flag to include specified properties
|
||||
:arg list results-paths: List of results directories
|
||||
:arg list properties: List of key:value property pairs
|
||||
|
||||
Minimal Example:
|
||||
|
||||
.. literalinclude:: /../../tests/publishers/fixtures/allure-minimal.yaml
|
||||
:language: yaml
|
||||
|
||||
Full Example:
|
||||
|
||||
.. literalinclude:: /../../tests/publishers/fixtures/allure-full.yaml
|
||||
:language: yaml
|
||||
|
||||
"""
|
||||
publisher_class = 'ru.yandex.qatools.allure.jenkins.AllureReportPublisher'
|
||||
property_class = 'ru.yandex.qatools.allure.jenkins.config.PropertyConfig'
|
||||
results_class = 'ru.yandex.qatools.allure.jenkins.config.ResultsConfig'
|
||||
|
||||
allure_publisher = XML.SubElement(xml_parent, publisher_class)
|
||||
allure_publisher.set('plugin', 'allure-jenkins-plugin')
|
||||
config = XML.SubElement(allure_publisher, 'config')
|
||||
|
||||
results = XML.SubElement(config, 'results')
|
||||
if 'results-paths' in data:
|
||||
for results_path in data['results-paths']:
|
||||
entry = XML.SubElement(results, results_class)
|
||||
path = XML.SubElement(entry, 'path')
|
||||
path.text = results_path['path']
|
||||
|
||||
properties = XML.SubElement(config, 'properties')
|
||||
if 'properties' in data:
|
||||
property_mapping = [
|
||||
('key', 'key', None),
|
||||
('value', 'value', None)
|
||||
]
|
||||
for prop in data['properties']:
|
||||
entry = XML.SubElement(properties, property_class)
|
||||
helpers.convert_mapping_to_xml(entry, prop, property_mapping,
|
||||
fail_required=True)
|
||||
else:
|
||||
properties.set('class', 'empty-list')
|
||||
|
||||
mapping = [
|
||||
('jdk', 'jdk', ''),
|
||||
('commandline', 'commandline', ''),
|
||||
('report-build-policy', 'reportBuildPolicy', 'ALWAYS',
|
||||
['ALWAYS', 'UNSTABLE', 'UNSUCCESSFUL']),
|
||||
('include-properties', 'includeProperties', False)
|
||||
]
|
||||
|
||||
helpers.convert_mapping_to_xml(config, data, mapping,
|
||||
fail_required=True)
|
||||
|
||||
|
||||
def archive(registry, xml_parent, data):
|
||||
"""yaml: archive
|
||||
Archive build artifacts
|
||||
|
27
tests/publishers/fixtures/allure-full.xml
Normal file
27
tests/publishers/fixtures/allure-full.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<ru.yandex.qatools.allure.jenkins.AllureReportPublisher plugin="allure-jenkins-plugin">
|
||||
<config>
|
||||
<results>
|
||||
<ru.yandex.qatools.allure.jenkins.config.ResultsConfig>
|
||||
<path>build/allure-results1</path>
|
||||
</ru.yandex.qatools.allure.jenkins.config.ResultsConfig>
|
||||
<ru.yandex.qatools.allure.jenkins.config.ResultsConfig>
|
||||
<path>build/allure-results2</path>
|
||||
</ru.yandex.qatools.allure.jenkins.config.ResultsConfig>
|
||||
</results>
|
||||
<properties>
|
||||
<ru.yandex.qatools.allure.jenkins.config.PropertyConfig>
|
||||
<key>allure.link.issue.pattern</key>
|
||||
<value>http://test.tms/{}</value>
|
||||
</ru.yandex.qatools.allure.jenkins.config.PropertyConfig>
|
||||
</properties>
|
||||
<jdk>openjdk1.8</jdk>
|
||||
<commandline>allure2</commandline>
|
||||
<reportBuildPolicy>UNSTABLE</reportBuildPolicy>
|
||||
<includeProperties>true</includeProperties>
|
||||
</config>
|
||||
</ru.yandex.qatools.allure.jenkins.AllureReportPublisher>
|
||||
</publishers>
|
||||
</project>
|
13
tests/publishers/fixtures/allure-full.yaml
Normal file
13
tests/publishers/fixtures/allure-full.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
publishers:
|
||||
- allure:
|
||||
results-paths:
|
||||
- path: 'build/allure-results1'
|
||||
- path: 'build/allure-results2'
|
||||
properties:
|
||||
- key: 'allure.link.issue.pattern'
|
||||
value: 'http://test.tms/{}'
|
||||
jdk: openjdk1.8
|
||||
commandline: allure2
|
||||
report-build-policy: UNSTABLE
|
||||
include-properties: true
|
||||
|
19
tests/publishers/fixtures/allure-minimal.xml
Normal file
19
tests/publishers/fixtures/allure-minimal.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<ru.yandex.qatools.allure.jenkins.AllureReportPublisher plugin="allure-jenkins-plugin">
|
||||
<config>
|
||||
<results>
|
||||
<ru.yandex.qatools.allure.jenkins.config.ResultsConfig>
|
||||
<path>build/allure-results</path>
|
||||
</ru.yandex.qatools.allure.jenkins.config.ResultsConfig>
|
||||
</results>
|
||||
<properties class="empty-list"/>
|
||||
<jdk/>
|
||||
<commandline/>
|
||||
<reportBuildPolicy>ALWAYS</reportBuildPolicy>
|
||||
<includeProperties>false</includeProperties>
|
||||
</config>
|
||||
</ru.yandex.qatools.allure.jenkins.AllureReportPublisher>
|
||||
</publishers>
|
||||
</project>
|
4
tests/publishers/fixtures/allure-minimal.yaml
Normal file
4
tests/publishers/fixtures/allure-minimal.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
publishers:
|
||||
- allure:
|
||||
results-paths:
|
||||
- path: 'build/allure-results'
|
Loading…
x
Reference in New Issue
Block a user