diff options
author | Thanh Ha <thanh.ha@linuxfoundation.org> | 2015-02-07 02:22:09 -0500 |
---|---|---|
committer | Thanh Ha <thanh.ha@linuxfoundation.org> | 2015-03-11 10:14:01 -0400 |
commit | 849ca49eff6a3a3495eba0e4c6e5d94c032f02ce (patch) | |
tree | 8c8b923c95862ff82760881c9ea7fd5f5deab749 /jenkins_jobs/modules/reporters.py | |
parent | be8def78291c6e6f20c69bc382fa8d2711abd8ac (diff) | |
download | python-jenkins-job-builder-849ca49eff6a3a3495eba0e4c6e5d94c032f02ce.tar.gz python-jenkins-job-builder-849ca49eff6a3a3495eba0e4c6e5d94c032f02ce.tar.xz python-jenkins-job-builder-849ca49eff6a3a3495eba0e4c6e5d94c032f02ce.zip |
Add FindBugs plugin support
- Add reporters test module
- Move build_trends_publisher to helpers module now that there is
multiple modules using the function
https://wiki.jenkins-ci.org/display/JENKINS/FindBugs+Plugin
Change-Id: Ic537279ff875589b41823f6f5324feb61ed7054e
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
Diffstat (limited to 'jenkins_jobs/modules/reporters.py')
-rw-r--r-- | jenkins_jobs/modules/reporters.py | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/jenkins_jobs/modules/reporters.py b/jenkins_jobs/modules/reporters.py index 1dfa4083..75c6a092 100644 --- a/jenkins_jobs/modules/reporters.py +++ b/jenkins_jobs/modules/reporters.py @@ -34,6 +34,7 @@ Example:: import xml.etree.ElementTree as XML import jenkins_jobs.modules.base +from jenkins_jobs.modules.helpers import build_trends_publisher from jenkins_jobs.errors import JenkinsJobsException @@ -69,6 +70,83 @@ def email(parser, xml_parent, data): XML.SubElement(mailer, 'perModuleEmail').text = 'true' +def findbugs(parser, xml_parent, data): + """yaml: findbugs + FindBugs reporting for builds + + Requires the Jenkins :jenkins-wiki:`FindBugs Plugin + <FindBugs+Plugin>`. + + :arg bool rank-priority: Use rank as priority (default: false) + :arg str include-files: Comma separated list of files to include. + (Optional) + :arg str exclude-files: Comma separated list of files to exclude. + (Optional) + :arg bool can-run-on-failed: Weather or not to run plug-in on failed builds + (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 bool dont-compute-new: If set to false, computes new warnings based on + the reference build (default true) + :arg bool use-delta-values: Use delta for new warnings. (Default: false) + :arg bool use-previous-build-as-reference: If set then the number of new + warnings will always be calculated based on the previous build. Otherwise + 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 dict thresholds: + :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`) + + Minimal Example: + + .. literalinclude:: /../../tests/reporters/fixtures/findbugs-minimal.yaml + + Full Example: + + .. literalinclude:: /../../tests/reporters/fixtures/findbugs01.yaml + + """ + findbugs = XML.SubElement(xml_parent, + 'hudson.plugins.findbugs.FindBugsReporter') + findbugs.set('plugin', 'findbugs') + + # General Options + rank_priority = str(data.get('rank-priority', False)).lower() + XML.SubElement(findbugs, 'isRankActivated').text = rank_priority + include_files = data.get('include-files', '') + XML.SubElement(findbugs, 'includePattern').text = include_files + exclude_files = data.get('exclude-files', '') + XML.SubElement(findbugs, 'excludePattern').text = exclude_files + use_previous_build = str(data.get('use-previous-build-as-reference', + False)).lower() + XML.SubElement(findbugs, + 'usePreviousBuildAsReference').text = use_previous_build + + build_trends_publisher('[FINDBUGS] ', findbugs, data) + + class Reporters(jenkins_jobs.modules.base.Base): sequence = 55 |