Update dependency_check plugin

- update docstring
- update test cases

Change-Id: I825950ea54977d5ccef7359535a14d67a374bbd8
This commit is contained in:
Dong Ma 2017-06-26 21:43:28 +08:00
parent de631d49d3
commit ee912cbf46
6 changed files with 93 additions and 18 deletions

View File

@ -4455,15 +4455,15 @@ def dependency_check(registry, xml_parent, data):
: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)
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)
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')
('low', 'normal' or 'high', defaulted to 'low')
:arg dict thresholds: Mark build as failed or unstable if the number of
errors exceeds a threshold. (optional)
errors exceeds a threshold. (optional)
:thresholds:
* **unstable** (`dict`)
@ -4488,21 +4488,27 @@ def dependency_check(registry, xml_parent, data):
: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)
the reference build (default true)
:arg bool use-previous-build-as-reference: determines whether to always
use the previous build as the reference build (default false)
: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)
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)
calculated by subtracting the total number of warnings of the current
build from the reference build.
(default false)
Example:
Minimal Example:
.. literalinclude::
/../../tests/publishers/fixtures/dependency-check001.yaml
/../../tests/publishers/fixtures/dependency-check-minimal.yaml
:language: yaml
Full Example:
.. literalinclude::
/../../tests/publishers/fixtures/dependency-check-full.yaml
:language: yaml
"""

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<org.jenkinsci.plugins.DependencyCheck.DependencyCheckPublisher>
<healthy>0</healthy>
<unHealthy>100</unHealthy>
<thresholdLimit>high</thresholdLimit>
<pluginName>[DEPENDENCYCHECK] </pluginName>
<defaultEncoding>utf-8</defaultEncoding>
<canRunOnFailed>true</canRunOnFailed>
<useStableBuildAsReference>true</useStableBuildAsReference>
<usePreviousBuildAsReference>true</usePreviousBuildAsReference>
<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>**/dependency-check-report.xml</pattern>
</org.jenkinsci.plugins.DependencyCheck.DependencyCheckPublisher>
</publishers>
</project>

View File

@ -0,0 +1,33 @@
publishers:
- dependency-check:
pattern: '**/dependency-check-report.xml'
can-run-on-failed: true
should-detect-modules: true
healthy: 0
unhealthy: 100
health-threshold: 'high'
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-previous-build-as-reference: true
use-stable-build-as-reference: true
use-delta-values: true

View File

@ -8,7 +8,7 @@
<pluginName>[DEPENDENCYCHECK] </pluginName>
<defaultEncoding/>
<canRunOnFailed>false</canRunOnFailed>
<useStableBuildAsReference>true</useStableBuildAsReference>
<useStableBuildAsReference>false</useStableBuildAsReference>
<usePreviousBuildAsReference>false</usePreviousBuildAsReference>
<useDeltaValues>false</useDeltaValues>
<thresholds>
@ -24,7 +24,7 @@
<shouldDetectModules>false</shouldDetectModules>
<dontComputeNew>true</dontComputeNew>
<doNotResolveRelativePaths>false</doNotResolveRelativePaths>
<pattern>**/dependency-check-report.xml</pattern>
<pattern/>
</org.jenkinsci.plugins.DependencyCheck.DependencyCheckPublisher>
</publishers>
</project>

View File

@ -0,0 +1,2 @@
publishers:
- dependency-check

View File

@ -1,4 +0,0 @@
publishers:
- dependency-check:
pattern: '**/dependency-check-report.xml'
use-stable-build-as-reference: true