Add DRY publisher
Change-Id: I7858e5dfed871837a5f9ea704d05dc950ee519ee
This commit is contained in:
parent
104244b833
commit
2daaa22ee2
@ -3926,6 +3926,88 @@ def scan_build(parser, xml_parent, data):
|
|||||||
XML.SubElement(p, 'bugThreshold').text = threshold
|
XML.SubElement(p, 'bugThreshold').text = threshold
|
||||||
|
|
||||||
|
|
||||||
|
def dry(parser, xml_parent, data):
|
||||||
|
"""yaml: dry
|
||||||
|
Publish trend reports with DRY.
|
||||||
|
Requires the Jenkins `DRY Plugin.
|
||||||
|
<https://wiki.jenkins-ci.org/display/JENKINS/DRY+Plugin>`_
|
||||||
|
|
||||||
|
The DRY component accepts a dictionary with the following values:
|
||||||
|
|
||||||
|
:arg str pattern: Report filename pattern (optional)
|
||||||
|
:arg bool can-run-on-failed: Also runs for failed builds, instead of just
|
||||||
|
stable or unstable builds (default false)
|
||||||
|
:arg bool should-detect-modules: Determines if Ant or Maven modules should
|
||||||
|
be detected for all files that contain warnings (default false)
|
||||||
|
:arg int healthy: Sunny threshold (optional)
|
||||||
|
:arg int unhealthy: Stormy threshold (optional)
|
||||||
|
:arg str health-threshold: Threshold priority for health status
|
||||||
|
('low', 'normal' or 'high', defaulted to 'low')
|
||||||
|
:arg int high-threshold: Minimum number of duplicated lines for high
|
||||||
|
priority warnings. (default 50)
|
||||||
|
:arg int normal-threshold: Minimum number of duplicated lines for normal
|
||||||
|
priority warnings. (default 25)
|
||||||
|
:arg dict thresholds: Mark build as failed or unstable if the number of
|
||||||
|
errors exceeds a threshold. (optional)
|
||||||
|
|
||||||
|
:thresholds:
|
||||||
|
* **unstable** (`dict`)
|
||||||
|
:unstable: * **total-all** (`int`)
|
||||||
|
* **total-high** (`int`)
|
||||||
|
* **total-normal** (`int`)
|
||||||
|
* **total-low** (`int`)
|
||||||
|
* **new-all** (`int`)
|
||||||
|
* **new-high** (`int`)
|
||||||
|
* **new-normal** (`int`)
|
||||||
|
* **new-low** (`int`)
|
||||||
|
|
||||||
|
* **failed** (`dict`)
|
||||||
|
:failed: * **total-all** (`int`)
|
||||||
|
* **total-high** (`int`)
|
||||||
|
* **total-normal** (`int`)
|
||||||
|
* **total-low** (`int`)
|
||||||
|
* **new-all** (`int`)
|
||||||
|
* **new-high** (`int`)
|
||||||
|
* **new-normal** (`int`)
|
||||||
|
* **new-low** (`int`)
|
||||||
|
:arg str default-encoding: Encoding for parsing or showing files (optional)
|
||||||
|
:arg bool do-not-resolve-relative-paths: (default false)
|
||||||
|
:arg bool dont-compute-new: If set to false, computes new warnings based on
|
||||||
|
the reference build (default true)
|
||||||
|
:arg bool use-stable-build-as-reference: The number of new warnings will be
|
||||||
|
calculated based on the last stable build, allowing reverts of unstable
|
||||||
|
builds where the number of warnings was decreased. (default false)
|
||||||
|
:arg bool use-delta-values: If set then the number of new warnings is
|
||||||
|
calculated by subtracting the total number of warnings of the current
|
||||||
|
build from the reference build.
|
||||||
|
(default false)
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
.. literalinclude:: /../../tests/publishers/fixtures/dry001.yaml
|
||||||
|
|
||||||
|
Full example:
|
||||||
|
|
||||||
|
.. literalinclude:: /../../tests/publishers/fixtures/dry004.yaml
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
xml_element = XML.SubElement(xml_parent, 'hudson.plugins.dry.DryPublisher')
|
||||||
|
|
||||||
|
build_trends_publisher('[DRY] ', xml_element, data)
|
||||||
|
|
||||||
|
# Add specific settings for this trends publisher
|
||||||
|
settings = [
|
||||||
|
('high-threshold', 'highThreshold', 50),
|
||||||
|
('normal-threshold', 'normalThreshold', 25)]
|
||||||
|
|
||||||
|
for key, tag_name, default in settings:
|
||||||
|
xml_config = XML.SubElement(xml_element, tag_name)
|
||||||
|
config_value = data.get(key, default)
|
||||||
|
|
||||||
|
xml_config.text = str(config_value)
|
||||||
|
|
||||||
|
|
||||||
def create_publishers(parser, action):
|
def create_publishers(parser, action):
|
||||||
dummy_parent = XML.Element("dummy")
|
dummy_parent = XML.Element("dummy")
|
||||||
parser.registry.dispatch('publisher', parser, dummy_parent, action)
|
parser.registry.dispatch('publisher', parser, dummy_parent, action)
|
||||||
|
@ -132,6 +132,7 @@ jenkins_jobs.publishers =
|
|||||||
cppcheck=jenkins_jobs.modules.publishers:cppcheck
|
cppcheck=jenkins_jobs.modules.publishers:cppcheck
|
||||||
description-setter=jenkins_jobs.modules.publishers:description_setter
|
description-setter=jenkins_jobs.modules.publishers:description_setter
|
||||||
doxygen=jenkins_jobs.modules.publishers:doxygen
|
doxygen=jenkins_jobs.modules.publishers:doxygen
|
||||||
|
dry=jenkins_jobs.modules.publishers:dry
|
||||||
email-ext=jenkins_jobs.modules.publishers:email_ext
|
email-ext=jenkins_jobs.modules.publishers:email_ext
|
||||||
email=jenkins_jobs.modules.publishers:email
|
email=jenkins_jobs.modules.publishers:email
|
||||||
emotional-jenkins=jenkins_jobs.modules.publishers:emotional_jenkins
|
emotional-jenkins=jenkins_jobs.modules.publishers:emotional_jenkins
|
||||||
|
31
tests/publishers/fixtures/dry001.xml
Normal file
31
tests/publishers/fixtures/dry001.xml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<publishers>
|
||||||
|
<hudson.plugins.dry.DryPublisher>
|
||||||
|
<healthy>0</healthy>
|
||||||
|
<unHealthy>100</unHealthy>
|
||||||
|
<thresholdLimit>high</thresholdLimit>
|
||||||
|
<pluginName>[DRY] </pluginName>
|
||||||
|
<defaultEncoding/>
|
||||||
|
<canRunOnFailed>false</canRunOnFailed>
|
||||||
|
<useStableBuildAsReference>false</useStableBuildAsReference>
|
||||||
|
<useDeltaValues>false</useDeltaValues>
|
||||||
|
<thresholds>
|
||||||
|
<unstableTotalAll/>
|
||||||
|
<unstableTotalHigh>10</unstableTotalHigh>
|
||||||
|
<unstableTotalNormal/>
|
||||||
|
<unstableTotalLow/>
|
||||||
|
<failedTotalAll/>
|
||||||
|
<failedTotalHigh>1</failedTotalHigh>
|
||||||
|
<failedTotalNormal/>
|
||||||
|
<failedTotalLow/>
|
||||||
|
</thresholds>
|
||||||
|
<shouldDetectModules>false</shouldDetectModules>
|
||||||
|
<dontComputeNew>true</dontComputeNew>
|
||||||
|
<doNotResolveRelativePaths>false</doNotResolveRelativePaths>
|
||||||
|
<pattern>**/cpd-result.xml</pattern>
|
||||||
|
<highThreshold>50</highThreshold>
|
||||||
|
<normalThreshold>25</normalThreshold>
|
||||||
|
</hudson.plugins.dry.DryPublisher>
|
||||||
|
</publishers>
|
||||||
|
</project>
|
13
tests/publishers/fixtures/dry001.yaml
Normal file
13
tests/publishers/fixtures/dry001.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
publishers:
|
||||||
|
- dry:
|
||||||
|
pattern: '**/cpd-result.xml'
|
||||||
|
healthy: 0
|
||||||
|
unhealthy: 100
|
||||||
|
health-threshold: 'high'
|
||||||
|
high-threshold: 50
|
||||||
|
normal-threshold: 25
|
||||||
|
thresholds:
|
||||||
|
unstable:
|
||||||
|
total-high: 10
|
||||||
|
failed:
|
||||||
|
total-high: 1
|
31
tests/publishers/fixtures/dry002.xml
Normal file
31
tests/publishers/fixtures/dry002.xml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<publishers>
|
||||||
|
<hudson.plugins.dry.DryPublisher>
|
||||||
|
<healthy>0</healthy>
|
||||||
|
<unHealthy>100</unHealthy>
|
||||||
|
<thresholdLimit>high</thresholdLimit>
|
||||||
|
<pluginName>[DRY] </pluginName>
|
||||||
|
<defaultEncoding>utf-8</defaultEncoding>
|
||||||
|
<canRunOnFailed>true</canRunOnFailed>
|
||||||
|
<useStableBuildAsReference>false</useStableBuildAsReference>
|
||||||
|
<useDeltaValues>false</useDeltaValues>
|
||||||
|
<thresholds>
|
||||||
|
<unstableTotalAll>90</unstableTotalAll>
|
||||||
|
<unstableTotalHigh>80</unstableTotalHigh>
|
||||||
|
<unstableTotalNormal>70</unstableTotalNormal>
|
||||||
|
<unstableTotalLow>60</unstableTotalLow>
|
||||||
|
<failedTotalAll>90</failedTotalAll>
|
||||||
|
<failedTotalHigh>80</failedTotalHigh>
|
||||||
|
<failedTotalNormal>70</failedTotalNormal>
|
||||||
|
<failedTotalLow>60</failedTotalLow>
|
||||||
|
</thresholds>
|
||||||
|
<shouldDetectModules>true</shouldDetectModules>
|
||||||
|
<dontComputeNew>true</dontComputeNew>
|
||||||
|
<doNotResolveRelativePaths>false</doNotResolveRelativePaths>
|
||||||
|
<pattern>**/cpd-result.xml</pattern>
|
||||||
|
<highThreshold>20</highThreshold>
|
||||||
|
<normalThreshold>10</normalThreshold>
|
||||||
|
</hudson.plugins.dry.DryPublisher>
|
||||||
|
</publishers>
|
||||||
|
</project>
|
22
tests/publishers/fixtures/dry002.yaml
Normal file
22
tests/publishers/fixtures/dry002.yaml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
publishers:
|
||||||
|
- dry:
|
||||||
|
pattern: '**/cpd-result.xml'
|
||||||
|
can-run-on-failed: true
|
||||||
|
should-detect-modules: true
|
||||||
|
healthy: 0
|
||||||
|
unhealthy: 100
|
||||||
|
health-threshold: 'high'
|
||||||
|
high-threshold: 20
|
||||||
|
normal-threshold: 10
|
||||||
|
thresholds:
|
||||||
|
unstable:
|
||||||
|
total-all: 90
|
||||||
|
total-high: 80
|
||||||
|
total-normal: 70
|
||||||
|
total-low: 60
|
||||||
|
failed:
|
||||||
|
total-all: 90
|
||||||
|
total-high: 80
|
||||||
|
total-normal: 70
|
||||||
|
total-low: 60
|
||||||
|
default-encoding: 'utf-8'
|
31
tests/publishers/fixtures/dry003.xml
Normal file
31
tests/publishers/fixtures/dry003.xml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<publishers>
|
||||||
|
<hudson.plugins.dry.DryPublisher>
|
||||||
|
<healthy/>
|
||||||
|
<unHealthy/>
|
||||||
|
<thresholdLimit>low</thresholdLimit>
|
||||||
|
<pluginName>[DRY] </pluginName>
|
||||||
|
<defaultEncoding/>
|
||||||
|
<canRunOnFailed>false</canRunOnFailed>
|
||||||
|
<useStableBuildAsReference>false</useStableBuildAsReference>
|
||||||
|
<useDeltaValues>false</useDeltaValues>
|
||||||
|
<thresholds>
|
||||||
|
<unstableTotalAll/>
|
||||||
|
<unstableTotalHigh/>
|
||||||
|
<unstableTotalNormal/>
|
||||||
|
<unstableTotalLow/>
|
||||||
|
<failedTotalAll/>
|
||||||
|
<failedTotalHigh/>
|
||||||
|
<failedTotalNormal/>
|
||||||
|
<failedTotalLow/>
|
||||||
|
</thresholds>
|
||||||
|
<shouldDetectModules>false</shouldDetectModules>
|
||||||
|
<dontComputeNew>true</dontComputeNew>
|
||||||
|
<doNotResolveRelativePaths>false</doNotResolveRelativePaths>
|
||||||
|
<pattern/>
|
||||||
|
<highThreshold>50</highThreshold>
|
||||||
|
<normalThreshold>25</normalThreshold>
|
||||||
|
</hudson.plugins.dry.DryPublisher>
|
||||||
|
</publishers>
|
||||||
|
</project>
|
2
tests/publishers/fixtures/dry003.yaml
Normal file
2
tests/publishers/fixtures/dry003.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
publishers:
|
||||||
|
- dry
|
39
tests/publishers/fixtures/dry004.xml
Normal file
39
tests/publishers/fixtures/dry004.xml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<publishers>
|
||||||
|
<hudson.plugins.dry.DryPublisher>
|
||||||
|
<healthy>0</healthy>
|
||||||
|
<unHealthy>100</unHealthy>
|
||||||
|
<thresholdLimit>high</thresholdLimit>
|
||||||
|
<pluginName>[DRY] </pluginName>
|
||||||
|
<defaultEncoding>utf-8</defaultEncoding>
|
||||||
|
<canRunOnFailed>true</canRunOnFailed>
|
||||||
|
<useStableBuildAsReference>true</useStableBuildAsReference>
|
||||||
|
<useDeltaValues>true</useDeltaValues>
|
||||||
|
<thresholds>
|
||||||
|
<unstableTotalAll>90</unstableTotalAll>
|
||||||
|
<unstableTotalHigh>80</unstableTotalHigh>
|
||||||
|
<unstableTotalNormal>70</unstableTotalNormal>
|
||||||
|
<unstableTotalLow>60</unstableTotalLow>
|
||||||
|
<unstableNewAll>50</unstableNewAll>
|
||||||
|
<unstableNewHigh>40</unstableNewHigh>
|
||||||
|
<unstableNewNormal>30</unstableNewNormal>
|
||||||
|
<unstableNewLow>20</unstableNewLow>
|
||||||
|
<failedTotalAll>91</failedTotalAll>
|
||||||
|
<failedTotalHigh>81</failedTotalHigh>
|
||||||
|
<failedTotalNormal>71</failedTotalNormal>
|
||||||
|
<failedTotalLow>61</failedTotalLow>
|
||||||
|
<failedNewAll>51</failedNewAll>
|
||||||
|
<failedNewHigh>41</failedNewHigh>
|
||||||
|
<failedNewNormal>31</failedNewNormal>
|
||||||
|
<failedNewLow>21</failedNewLow>
|
||||||
|
</thresholds>
|
||||||
|
<shouldDetectModules>true</shouldDetectModules>
|
||||||
|
<dontComputeNew>false</dontComputeNew>
|
||||||
|
<doNotResolveRelativePaths>true</doNotResolveRelativePaths>
|
||||||
|
<pattern>**/cpd-result.xml</pattern>
|
||||||
|
<highThreshold>20</highThreshold>
|
||||||
|
<normalThreshold>10</normalThreshold>
|
||||||
|
</hudson.plugins.dry.DryPublisher>
|
||||||
|
</publishers>
|
||||||
|
</project>
|
34
tests/publishers/fixtures/dry004.yaml
Normal file
34
tests/publishers/fixtures/dry004.yaml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
publishers:
|
||||||
|
- dry:
|
||||||
|
pattern: '**/cpd-result.xml'
|
||||||
|
can-run-on-failed: true
|
||||||
|
should-detect-modules: true
|
||||||
|
healthy: 0
|
||||||
|
unhealthy: 100
|
||||||
|
health-threshold: 'high'
|
||||||
|
high-threshold: 20
|
||||||
|
normal-threshold: 10
|
||||||
|
thresholds:
|
||||||
|
unstable:
|
||||||
|
total-all: 90
|
||||||
|
total-high: 80
|
||||||
|
total-normal: 70
|
||||||
|
total-low: 60
|
||||||
|
new-all: 50
|
||||||
|
new-high: 40
|
||||||
|
new-normal: 30
|
||||||
|
new-low: 20
|
||||||
|
failed:
|
||||||
|
total-all: 91
|
||||||
|
total-high: 81
|
||||||
|
total-normal: 71
|
||||||
|
total-low: 61
|
||||||
|
new-all: 51
|
||||||
|
new-high: 41
|
||||||
|
new-normal: 31
|
||||||
|
new-low: 21
|
||||||
|
default-encoding: 'utf-8'
|
||||||
|
do-not-resolve-relative-paths: true
|
||||||
|
dont-compute-new: false
|
||||||
|
use-stable-build-as-reference: true
|
||||||
|
use-delta-values: true
|
Loading…
x
Reference in New Issue
Block a user