Update clamav plugin to use convert xml

- Add plugin="clamav" attribute
- Document 'includes' must be set to check for artifacts
- Add minimal test

Change-Id: Ia54e1e3f15fc5964b139f82c09c9311dd7d9fb2c
Signed-off-by: Kien Ha <kienha9922@gmail.com>
This commit is contained in:
Kien Ha 2016-07-12 21:07:38 -04:00
parent 2bf92c3ed7
commit 26973d9c1f
5 changed files with 30 additions and 11 deletions

View File

@ -5754,23 +5754,31 @@ def clamav(parser, xml_parent, data):
Check files with ClamAV, an open source antivirus engine.
Requires the Jenkins :jenkins-wiki:`ClamAV Plugin <ClamAV+Plugin>`.
:arg str includes: Files that should be scanned.
(default "")
:arg str excludes: Files that should be ignored.
(default "")
:arg str includes: Comma seperated list of files that should be scanned.
Must be set for ClamAV to check for artifacts. (default '')
:arg str excludes: Comma seperated list of files that should be ignored
(default '')
Example:
Full Example:
.. literalinclude:: /../../tests/publishers/fixtures/clamav001.yaml
.. literalinclude:: /../../tests/publishers/fixtures/clamav-full.yaml
:language: yaml
Minimal Example:
.. literalinclude:: /../../tests/publishers/fixtures/clamav-minimal.yaml
:language: yaml
"""
clamav = XML.SubElement(
xml_parent,
'org.jenkinsci.plugins.clamav.ClamAvRecorder')
XML.SubElement(clamav, 'includes').text = str(
data.get('includes', ''))
XML.SubElement(clamav, 'excludes').text = str(
data.get('excludes', ''))
clamav.set('plugin', 'clamav')
mappings = [
('includes', 'includes', ''),
('excludes', 'excludes', ''),
]
helpers.convert_mapping_to_xml(clamav, data, mappings, fail_required=True)
def testselector(parser, xml_parent, data):

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<org.jenkinsci.plugins.clamav.ClamAvRecorder>
<org.jenkinsci.plugins.clamav.ClamAvRecorder plugin="clamav">
<includes>*.zip</includes>
<excludes>foo.zip</excludes>
</org.jenkinsci.plugins.clamav.ClamAvRecorder>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<org.jenkinsci.plugins.clamav.ClamAvRecorder plugin="clamav">
<includes/>
<excludes/>
</org.jenkinsci.plugins.clamav.ClamAvRecorder>
</publishers>
</project>

View File

@ -0,0 +1,2 @@
publishers:
- clamav