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_optional_props
from jenkins_jobs.modules.helpers import artifactory_repository from jenkins_jobs.modules.helpers import artifactory_repository
from jenkins_jobs.modules.helpers import config_file_provider_builder from jenkins_jobs.modules.helpers import config_file_provider_builder
from jenkins_jobs.modules.helpers import convert_mapping_to_xml
logger = logging.getLogger(__name__) 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. 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( live = XML.SubElement(
xml_parent, xml_parent,
'org.jenkinsci.plugins.livescreenshot.LiveScreenshotBuildWrapper') 'org.jenkinsci.plugins.livescreenshot.LiveScreenshotBuildWrapper')
XML.SubElement(live, 'fullscreenFilename').text = data.get( live.set('plugin', 'livescreenshot')
'full-size', 'screenshot.png') mapping = [
XML.SubElement(live, 'thumbnailFilename').text = data.get( ('full-size', 'fullscreenFilename', 'screenshot.png'),
'thumbnail', 'screenshot-thumb.png') ('thumbnail', 'thumbnailFilename', 'screenshot-thumb.png'),
]
convert_mapping_to_xml(live, data, mapping, fail_required=True)
def mask_passwords(parser, xml_parent, data): def mask_passwords(parser, xml_parent, data):

View File

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

View File

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