Add support for the Jenkins Clang Scan-Build publisher plugin.
Change-Id: Ib892c790c370301e3e7ba04a83a9cfe38745c3ec
This commit is contained in:
parent
8dfc883477
commit
c8d0710294
@ -3874,6 +3874,39 @@ def pmd(parser, xml_parent, data):
|
||||
build_trends_publisher('[PMD] ', xml_element, data)
|
||||
|
||||
|
||||
def scan_build(parser, xml_parent, data):
|
||||
"""yaml: scan-build
|
||||
Publishes results from the Clang scan-build static analyzer.
|
||||
|
||||
The scan-build report has to be generated in the directory
|
||||
``${WORKSPACE}/clangScanBuildReports`` for the publisher to find it.
|
||||
|
||||
Requires the Jenkins `Clang Scan-Build Plugin.
|
||||
<https://wiki.jenkins-ci.org/display/JENKINS/Clang+Scan-Build+Plugin>`_
|
||||
|
||||
:arg bool mark-unstable: Mark build as unstable if the number of bugs
|
||||
exceeds a threshold (default: false)
|
||||
:arg int threshold: Threshold for marking builds as unstable (default: 0)
|
||||
|
||||
Example:
|
||||
|
||||
.. literalinclude:: /../../tests/publishers/fixtures/scan-build001.yaml
|
||||
|
||||
"""
|
||||
threshold = str(data.get('threshold', 0))
|
||||
if not threshold.isdigit():
|
||||
raise JenkinsJobsException("Invalid value '%s' for threshold. "
|
||||
"Numeric value expected." % threshold)
|
||||
|
||||
p = XML.SubElement(
|
||||
xml_parent,
|
||||
'jenkins.plugins.clangscanbuild.publisher.ClangScanBuildPublisher')
|
||||
|
||||
XML.SubElement(p, 'markBuildUnstableWhenThresholdIsExceeded').text = \
|
||||
str(data.get('mark-unstable', False)).lower()
|
||||
XML.SubElement(p, 'bugThreshold').text = threshold
|
||||
|
||||
|
||||
def create_publishers(parser, action):
|
||||
dummy_parent = XML.Element("dummy")
|
||||
parser.registry.dispatch('publisher', parser, dummy_parent, action)
|
||||
|
@ -156,6 +156,7 @@ jenkins_jobs.publishers =
|
||||
robot=jenkins_jobs.modules.publishers:robot
|
||||
ruby-metrics=jenkins_jobs.modules.publishers:ruby_metrics
|
||||
s3=jenkins_jobs.modules.publishers:s3
|
||||
scan-build=jenkins_jobs.modules.publishers:scan_build
|
||||
scp=jenkins_jobs.modules.publishers:scp
|
||||
sitemonitor=jenkins_jobs.modules.publishers:sitemonitor
|
||||
sloccount=jenkins_jobs.modules.publishers:sloccount
|
||||
|
9
tests/publishers/fixtures/scan-build001.xml
Normal file
9
tests/publishers/fixtures/scan-build001.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<jenkins.plugins.clangscanbuild.publisher.ClangScanBuildPublisher>
|
||||
<markBuildUnstableWhenThresholdIsExceeded>true</markBuildUnstableWhenThresholdIsExceeded>
|
||||
<bugThreshold>0</bugThreshold>
|
||||
</jenkins.plugins.clangscanbuild.publisher.ClangScanBuildPublisher>
|
||||
</publishers>
|
||||
</project>
|
4
tests/publishers/fixtures/scan-build001.yaml
Normal file
4
tests/publishers/fixtures/scan-build001.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
publishers:
|
||||
- scan-build:
|
||||
mark-unstable: true
|
||||
threshold: 0
|
9
tests/publishers/fixtures/scan-build002.xml
Normal file
9
tests/publishers/fixtures/scan-build002.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<jenkins.plugins.clangscanbuild.publisher.ClangScanBuildPublisher>
|
||||
<markBuildUnstableWhenThresholdIsExceeded>false</markBuildUnstableWhenThresholdIsExceeded>
|
||||
<bugThreshold>0</bugThreshold>
|
||||
</jenkins.plugins.clangscanbuild.publisher.ClangScanBuildPublisher>
|
||||
</publishers>
|
||||
</project>
|
2
tests/publishers/fixtures/scan-build002.yaml
Normal file
2
tests/publishers/fixtures/scan-build002.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
publishers:
|
||||
- scan-build
|
Loading…
x
Reference in New Issue
Block a user