Update live-screenshot plugin to use convert xml

- Rename test file to be more descriptive
- Add plugin="livescreenshot" attribute

Change-Id: I587e52c2cc2ba601b9d610ee6916edba4c9e3367
Signed-off-by: Kien Ha <kienha9922@gmail.com>
This commit is contained in:
Kien Ha 2016-07-14 18:07:20 -04:00
parent d6add35e72
commit f646a016b8
5 changed files with 15 additions and 10 deletions

View File

@ -37,6 +37,7 @@ from jenkins_jobs.modules.helpers import artifactory_env_vars_patterns
from jenkins_jobs.modules.helpers import artifactory_optional_props
from jenkins_jobs.modules.helpers import artifactory_repository
from jenkins_jobs.modules.helpers import config_file_provider_builder
from jenkins_jobs.modules.helpers import convert_mapping_to_xml
logger = logging.getLogger(__name__)
@ -550,21 +551,25 @@ def live_screenshot(parser, xml_parent, data):
File type must be .png and they must be located inside the $WORKDIR.
Example using defaults:
Full Example:
.. literalinclude:: /../../tests/wrappers/fixtures/live_screenshot001.yaml
.. literalinclude::
/../../tests/wrappers/fixtures/live-screenshot-full.yaml
or specifying the files to use:
Minimal Example:
.. literalinclude:: /../../tests/wrappers/fixtures/live_screenshot002.yaml
.. literalinclude::
/../../tests/wrappers/fixtures/live-screenshot-minimal.yaml
"""
live = XML.SubElement(
xml_parent,
'org.jenkinsci.plugins.livescreenshot.LiveScreenshotBuildWrapper')
XML.SubElement(live, 'fullscreenFilename').text = data.get(
'full-size', 'screenshot.png')
XML.SubElement(live, 'thumbnailFilename').text = data.get(
'thumbnail', 'screenshot-thumb.png')
live.set('plugin', 'livescreenshot')
mapping = [
('full-size', 'fullscreenFilename', 'screenshot.png'),
('thumbnail', 'thumbnailFilename', 'screenshot-thumb.png'),
]
convert_mapping_to_xml(live, data, mapping, fail_required=True)
def mask_passwords(parser, xml_parent, data):

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<buildWrappers>
<org.jenkinsci.plugins.livescreenshot.LiveScreenshotBuildWrapper>
<org.jenkinsci.plugins.livescreenshot.LiveScreenshotBuildWrapper plugin="livescreenshot">
<fullscreenFilename>my_screenshot.png</fullscreenFilename>
<thumbnailFilename>my_screenshot-thumb.png</thumbnailFilename>
</org.jenkinsci.plugins.livescreenshot.LiveScreenshotBuildWrapper>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<buildWrappers>
<org.jenkinsci.plugins.livescreenshot.LiveScreenshotBuildWrapper>
<org.jenkinsci.plugins.livescreenshot.LiveScreenshotBuildWrapper plugin="livescreenshot">
<fullscreenFilename>screenshot.png</fullscreenFilename>
<thumbnailFilename>screenshot-thumb.png</thumbnailFilename>
</org.jenkinsci.plugins.livescreenshot.LiveScreenshotBuildWrapper>