Merge "Add support for OWASP Dependency-Check Plugin"

This commit is contained in:
Jenkins 2016-04-30 11:29:54 +00:00 committed by Gerrit Code Review
commit 2721691960
20 changed files with 133 additions and 13 deletions

View File

@ -60,6 +60,8 @@ def build_trends_publisher(plugin_name, xml_element, data):
('default-encoding', 'defaultEncoding', ''), ('default-encoding', 'defaultEncoding', ''),
('can-run-on-failed', 'canRunOnFailed', False), ('can-run-on-failed', 'canRunOnFailed', False),
('use-stable-build-as-reference', 'useStableBuildAsReference', False), ('use-stable-build-as-reference', 'useStableBuildAsReference', False),
('use-previous-build-as-reference',
'usePreviousBuildAsReference', False),
('use-delta-values', 'useDeltaValues', False), ('use-delta-values', 'useDeltaValues', False),
('thresholds', 'thresholds', {}), ('thresholds', 'thresholds', {}),
('should-detect-modules', 'shouldDetectModules', False), ('should-detect-modules', 'shouldDetectModules', False),
@ -132,9 +134,8 @@ def config_file_provider_settings(xml_parent, data):
# For cfp versions <2.10.0 we are able to detect cfp via the config # For cfp versions <2.10.0 we are able to detect cfp via the config
# settings name. # settings name.
if settings_file.startswith( text = 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig'
'org.jenkinsci.plugins.configfiles.maven.' if settings_file.startswith(text):
'MavenSettingsConfig'):
settings_type = 'cfp' settings_type = 'cfp'
if settings_type == 'file': if settings_type == 'file':
@ -161,9 +162,9 @@ def config_file_provider_settings(xml_parent, data):
# For cfp versions <2.10.0 we are able to detect cfp via the config # For cfp versions <2.10.0 we are able to detect cfp via the config
# settings name. # settings name.
if global_settings_file.startswith( text = ('org.jenkinsci.plugins.configfiles.maven.'
'org.jenkinsci.plugins.configfiles.maven.' 'GlobalMavenSettingsConfig')
'GlobalMavenSettingsConfig'): if global_settings_file.startswith(text):
global_settings_type = 'cfp' global_settings_type = 'cfp'
if global_settings_type == 'file': if global_settings_type == 'file':
@ -242,10 +243,6 @@ def findbugs_settings(xml_parent, data):
XML.SubElement(xml_parent, 'includePattern').text = include_files XML.SubElement(xml_parent, 'includePattern').text = include_files
exclude_files = data.get('exclude-files', '') exclude_files = data.get('exclude-files', '')
XML.SubElement(xml_parent, 'excludePattern').text = exclude_files XML.SubElement(xml_parent, 'excludePattern').text = exclude_files
use_previous_build = str(data.get('use-previous-build-as-reference',
False)).lower()
XML.SubElement(xml_parent,
'usePreviousBuildAsReference').text = use_previous_build
def get_value_from_yaml_or_config_file(key, section, data, parser): def get_value_from_yaml_or_config_file(key, section, data, parser):

View File

@ -1507,6 +1507,8 @@ def checkstyle(parser, xml_parent, data):
:arg bool do-not-resolve-relative-paths: (default false) :arg bool do-not-resolve-relative-paths: (default false)
:arg bool dont-compute-new: If set to false, computes new warnings based on :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 :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 calculated based on the last stable build, allowing reverts of unstable
builds where the number of warnings was decreased. (default false) builds where the number of warnings was decreased. (default false)
@ -3941,6 +3943,76 @@ def stash(parser, xml_parent, data):
data.get('include-build-number', False)).lower() data.get('include-build-number', False)).lower()
def dependency_check(parser, xml_parent, data):
"""yaml: dependency-check
Dependency-Check is an open source utility that identifies project
dependencies and checks if there are any known, publicly disclosed,
vulnerabilities.
Requires the Jenkins :jenkins-wiki:`OWASP Dependency-Check Plugin
<OWASP+Dependency-Check+Plugin>`.
: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 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-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)
: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/dependency-check001.yaml
:language: yaml
"""
dependency_check = XML.SubElement(
xml_parent,
'org.jenkinsci.plugins.DependencyCheck.DependencyCheckPublisher')
# trends
build_trends_publisher('[DEPENDENCYCHECK] ', dependency_check, data)
def description_setter(parser, xml_parent, data): def description_setter(parser, xml_parent, data):
"""yaml: description-setter """yaml: description-setter
This plugin sets the description for each build, This plugin sets the description for each build,
@ -4397,6 +4469,8 @@ def pmd(parser, xml_parent, data):
:arg bool do-not-resolve-relative-paths: (default false) :arg bool do-not-resolve-relative-paths: (default false)
:arg bool dont-compute-new: If set to false, computes new warnings based on :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 :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 calculated based on the last stable build, allowing reverts of unstable
builds where the number of warnings was decreased. (default false) builds where the number of warnings was decreased. (default false)
@ -4505,6 +4579,8 @@ def dry(parser, xml_parent, data):
:arg bool do-not-resolve-relative-paths: (default false) :arg bool do-not-resolve-relative-paths: (default false)
:arg bool dont-compute-new: If set to false, computes new warnings based on :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 :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 calculated based on the last stable build, allowing reverts of unstable
builds where the number of warnings was decreased. (default false) builds where the number of warnings was decreased. (default false)

View File

@ -9,6 +9,7 @@
<defaultEncoding/> <defaultEncoding/>
<canRunOnFailed>false</canRunOnFailed> <canRunOnFailed>false</canRunOnFailed>
<useStableBuildAsReference>false</useStableBuildAsReference> <useStableBuildAsReference>false</useStableBuildAsReference>
<usePreviousBuildAsReference>false</usePreviousBuildAsReference>
<useDeltaValues>false</useDeltaValues> <useDeltaValues>false</useDeltaValues>
<thresholds> <thresholds>
<unstableTotalAll/> <unstableTotalAll/>

View File

@ -9,6 +9,7 @@
<defaultEncoding>utf-8</defaultEncoding> <defaultEncoding>utf-8</defaultEncoding>
<canRunOnFailed>true</canRunOnFailed> <canRunOnFailed>true</canRunOnFailed>
<useStableBuildAsReference>false</useStableBuildAsReference> <useStableBuildAsReference>false</useStableBuildAsReference>
<usePreviousBuildAsReference>false</usePreviousBuildAsReference>
<useDeltaValues>false</useDeltaValues> <useDeltaValues>false</useDeltaValues>
<thresholds> <thresholds>
<unstableTotalAll>90</unstableTotalAll> <unstableTotalAll>90</unstableTotalAll>

View File

@ -9,6 +9,7 @@
<defaultEncoding/> <defaultEncoding/>
<canRunOnFailed>false</canRunOnFailed> <canRunOnFailed>false</canRunOnFailed>
<useStableBuildAsReference>false</useStableBuildAsReference> <useStableBuildAsReference>false</useStableBuildAsReference>
<usePreviousBuildAsReference>false</usePreviousBuildAsReference>
<useDeltaValues>false</useDeltaValues> <useDeltaValues>false</useDeltaValues>
<thresholds> <thresholds>
<unstableTotalAll/> <unstableTotalAll/>

View File

@ -9,6 +9,7 @@
<defaultEncoding/> <defaultEncoding/>
<canRunOnFailed>false</canRunOnFailed> <canRunOnFailed>false</canRunOnFailed>
<useStableBuildAsReference>false</useStableBuildAsReference> <useStableBuildAsReference>false</useStableBuildAsReference>
<usePreviousBuildAsReference>false</usePreviousBuildAsReference>
<useDeltaValues>false</useDeltaValues> <useDeltaValues>false</useDeltaValues>
<thresholds> <thresholds>
<unstableTotalAll/> <unstableTotalAll/>

View File

@ -9,6 +9,7 @@
<defaultEncoding>utf-8</defaultEncoding> <defaultEncoding>utf-8</defaultEncoding>
<canRunOnFailed>true</canRunOnFailed> <canRunOnFailed>true</canRunOnFailed>
<useStableBuildAsReference>false</useStableBuildAsReference> <useStableBuildAsReference>false</useStableBuildAsReference>
<usePreviousBuildAsReference>false</usePreviousBuildAsReference>
<useDeltaValues>false</useDeltaValues> <useDeltaValues>false</useDeltaValues>
<thresholds> <thresholds>
<unstableTotalAll>90</unstableTotalAll> <unstableTotalAll>90</unstableTotalAll>

View File

@ -9,6 +9,7 @@
<defaultEncoding>utf-8</defaultEncoding> <defaultEncoding>utf-8</defaultEncoding>
<canRunOnFailed>true</canRunOnFailed> <canRunOnFailed>true</canRunOnFailed>
<useStableBuildAsReference>true</useStableBuildAsReference> <useStableBuildAsReference>true</useStableBuildAsReference>
<usePreviousBuildAsReference>false</usePreviousBuildAsReference>
<useDeltaValues>true</useDeltaValues> <useDeltaValues>true</useDeltaValues>
<thresholds> <thresholds>
<unstableTotalAll>90</unstableTotalAll> <unstableTotalAll>90</unstableTotalAll>

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<org.jenkinsci.plugins.DependencyCheck.DependencyCheckPublisher>
<healthy/>
<unHealthy/>
<thresholdLimit>low</thresholdLimit>
<pluginName>[DEPENDENCYCHECK] </pluginName>
<defaultEncoding/>
<canRunOnFailed>false</canRunOnFailed>
<useStableBuildAsReference>true</useStableBuildAsReference>
<usePreviousBuildAsReference>false</usePreviousBuildAsReference>
<useDeltaValues>false</useDeltaValues>
<thresholds>
<unstableTotalAll/>
<unstableTotalHigh/>
<unstableTotalNormal/>
<unstableTotalLow/>
<failedTotalAll/>
<failedTotalHigh/>
<failedTotalNormal/>
<failedTotalLow/>
</thresholds>
<shouldDetectModules>false</shouldDetectModules>
<dontComputeNew>true</dontComputeNew>
<doNotResolveRelativePaths>false</doNotResolveRelativePaths>
<pattern>**/dependency-check-report.xml</pattern>
</org.jenkinsci.plugins.DependencyCheck.DependencyCheckPublisher>
</publishers>
</project>

View File

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

View File

@ -9,6 +9,7 @@
<defaultEncoding/> <defaultEncoding/>
<canRunOnFailed>false</canRunOnFailed> <canRunOnFailed>false</canRunOnFailed>
<useStableBuildAsReference>false</useStableBuildAsReference> <useStableBuildAsReference>false</useStableBuildAsReference>
<usePreviousBuildAsReference>false</usePreviousBuildAsReference>
<useDeltaValues>false</useDeltaValues> <useDeltaValues>false</useDeltaValues>
<thresholds> <thresholds>
<unstableTotalAll/> <unstableTotalAll/>

View File

@ -9,6 +9,7 @@
<defaultEncoding>utf-8</defaultEncoding> <defaultEncoding>utf-8</defaultEncoding>
<canRunOnFailed>true</canRunOnFailed> <canRunOnFailed>true</canRunOnFailed>
<useStableBuildAsReference>false</useStableBuildAsReference> <useStableBuildAsReference>false</useStableBuildAsReference>
<usePreviousBuildAsReference>false</usePreviousBuildAsReference>
<useDeltaValues>false</useDeltaValues> <useDeltaValues>false</useDeltaValues>
<thresholds> <thresholds>
<unstableTotalAll>90</unstableTotalAll> <unstableTotalAll>90</unstableTotalAll>

View File

@ -9,6 +9,7 @@
<defaultEncoding/> <defaultEncoding/>
<canRunOnFailed>false</canRunOnFailed> <canRunOnFailed>false</canRunOnFailed>
<useStableBuildAsReference>false</useStableBuildAsReference> <useStableBuildAsReference>false</useStableBuildAsReference>
<usePreviousBuildAsReference>false</usePreviousBuildAsReference>
<useDeltaValues>false</useDeltaValues> <useDeltaValues>false</useDeltaValues>
<thresholds> <thresholds>
<unstableTotalAll/> <unstableTotalAll/>

View File

@ -9,6 +9,7 @@
<defaultEncoding>utf-8</defaultEncoding> <defaultEncoding>utf-8</defaultEncoding>
<canRunOnFailed>true</canRunOnFailed> <canRunOnFailed>true</canRunOnFailed>
<useStableBuildAsReference>true</useStableBuildAsReference> <useStableBuildAsReference>true</useStableBuildAsReference>
<usePreviousBuildAsReference>false</usePreviousBuildAsReference>
<useDeltaValues>true</useDeltaValues> <useDeltaValues>true</useDeltaValues>
<thresholds> <thresholds>
<unstableTotalAll>90</unstableTotalAll> <unstableTotalAll>90</unstableTotalAll>

View File

@ -5,7 +5,6 @@
<isRankActivated>true</isRankActivated> <isRankActivated>true</isRankActivated>
<includePattern>f,d,e,.*</includePattern> <includePattern>f,d,e,.*</includePattern>
<excludePattern>a,c,d,.*</excludePattern> <excludePattern>a,c,d,.*</excludePattern>
<usePreviousBuildAsReference>true</usePreviousBuildAsReference>
<healthy>80</healthy> <healthy>80</healthy>
<unHealthy>10</unHealthy> <unHealthy>10</unHealthy>
<thresholdLimit>high</thresholdLimit> <thresholdLimit>high</thresholdLimit>
@ -13,6 +12,7 @@
<defaultEncoding/> <defaultEncoding/>
<canRunOnFailed>true</canRunOnFailed> <canRunOnFailed>true</canRunOnFailed>
<useStableBuildAsReference>true</useStableBuildAsReference> <useStableBuildAsReference>true</useStableBuildAsReference>
<usePreviousBuildAsReference>true</usePreviousBuildAsReference>
<useDeltaValues>true</useDeltaValues> <useDeltaValues>true</useDeltaValues>
<thresholds> <thresholds>
<unstableTotalAll>90</unstableTotalAll> <unstableTotalAll>90</unstableTotalAll>

View File

@ -9,6 +9,7 @@
<defaultEncoding/> <defaultEncoding/>
<canRunOnFailed>false</canRunOnFailed> <canRunOnFailed>false</canRunOnFailed>
<useStableBuildAsReference>false</useStableBuildAsReference> <useStableBuildAsReference>false</useStableBuildAsReference>
<usePreviousBuildAsReference>false</usePreviousBuildAsReference>
<useDeltaValues>false</useDeltaValues> <useDeltaValues>false</useDeltaValues>
<thresholds> <thresholds>
<unstableTotalAll/> <unstableTotalAll/>

View File

@ -9,6 +9,7 @@
<defaultEncoding>utf-8</defaultEncoding> <defaultEncoding>utf-8</defaultEncoding>
<canRunOnFailed>true</canRunOnFailed> <canRunOnFailed>true</canRunOnFailed>
<useStableBuildAsReference>false</useStableBuildAsReference> <useStableBuildAsReference>false</useStableBuildAsReference>
<usePreviousBuildAsReference>false</usePreviousBuildAsReference>
<useDeltaValues>false</useDeltaValues> <useDeltaValues>false</useDeltaValues>
<thresholds> <thresholds>
<unstableTotalAll>90</unstableTotalAll> <unstableTotalAll>90</unstableTotalAll>

View File

@ -9,6 +9,7 @@
<defaultEncoding/> <defaultEncoding/>
<canRunOnFailed>false</canRunOnFailed> <canRunOnFailed>false</canRunOnFailed>
<useStableBuildAsReference>false</useStableBuildAsReference> <useStableBuildAsReference>false</useStableBuildAsReference>
<usePreviousBuildAsReference>false</usePreviousBuildAsReference>
<useDeltaValues>false</useDeltaValues> <useDeltaValues>false</useDeltaValues>
<thresholds> <thresholds>
<unstableTotalAll/> <unstableTotalAll/>

View File

@ -5,7 +5,6 @@
<isRankActivated>false</isRankActivated> <isRankActivated>false</isRankActivated>
<includePattern/> <includePattern/>
<excludePattern/> <excludePattern/>
<usePreviousBuildAsReference>false</usePreviousBuildAsReference>
<healthy/> <healthy/>
<unHealthy/> <unHealthy/>
<thresholdLimit>low</thresholdLimit> <thresholdLimit>low</thresholdLimit>
@ -13,6 +12,7 @@
<defaultEncoding/> <defaultEncoding/>
<canRunOnFailed>false</canRunOnFailed> <canRunOnFailed>false</canRunOnFailed>
<useStableBuildAsReference>false</useStableBuildAsReference> <useStableBuildAsReference>false</useStableBuildAsReference>
<usePreviousBuildAsReference>false</usePreviousBuildAsReference>
<useDeltaValues>false</useDeltaValues> <useDeltaValues>false</useDeltaValues>
<thresholds> <thresholds>
<unstableTotalAll/> <unstableTotalAll/>

View File

@ -5,7 +5,6 @@
<isRankActivated>true</isRankActivated> <isRankActivated>true</isRankActivated>
<includePattern>f,d,e,.*</includePattern> <includePattern>f,d,e,.*</includePattern>
<excludePattern>a,c,d,.*</excludePattern> <excludePattern>a,c,d,.*</excludePattern>
<usePreviousBuildAsReference>true</usePreviousBuildAsReference>
<healthy>80</healthy> <healthy>80</healthy>
<unHealthy>10</unHealthy> <unHealthy>10</unHealthy>
<thresholdLimit>high</thresholdLimit> <thresholdLimit>high</thresholdLimit>
@ -13,6 +12,7 @@
<defaultEncoding/> <defaultEncoding/>
<canRunOnFailed>true</canRunOnFailed> <canRunOnFailed>true</canRunOnFailed>
<useStableBuildAsReference>true</useStableBuildAsReference> <useStableBuildAsReference>true</useStableBuildAsReference>
<usePreviousBuildAsReference>true</usePreviousBuildAsReference>
<useDeltaValues>true</useDeltaValues> <useDeltaValues>true</useDeltaValues>
<thresholds> <thresholds>
<unstableTotalAll>90</unstableTotalAll> <unstableTotalAll>90</unstableTotalAll>