diff --git a/jenkins_jobs/modules/wrappers.py b/jenkins_jobs/modules/wrappers.py index 3a7521d9c..e0f6bcd72 100644 --- a/jenkins_jobs/modules/wrappers.py +++ b/jenkins_jobs/modules/wrappers.py @@ -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): diff --git a/tests/wrappers/fixtures/live_screenshot002.xml b/tests/wrappers/fixtures/live-screenshot-full.xml similarity index 92% rename from tests/wrappers/fixtures/live_screenshot002.xml rename to tests/wrappers/fixtures/live-screenshot-full.xml index 00b6bf45f..2e926b004 100644 --- a/tests/wrappers/fixtures/live_screenshot002.xml +++ b/tests/wrappers/fixtures/live-screenshot-full.xml @@ -1,7 +1,7 @@ - + my_screenshot.png my_screenshot-thumb.png diff --git a/tests/wrappers/fixtures/live_screenshot002.yaml b/tests/wrappers/fixtures/live-screenshot-full.yaml similarity index 100% rename from tests/wrappers/fixtures/live_screenshot002.yaml rename to tests/wrappers/fixtures/live-screenshot-full.yaml diff --git a/tests/wrappers/fixtures/live_screenshot001.xml b/tests/wrappers/fixtures/live-screenshot-minimal.xml similarity index 92% rename from tests/wrappers/fixtures/live_screenshot001.xml rename to tests/wrappers/fixtures/live-screenshot-minimal.xml index a315e599c..cfaceba5f 100644 --- a/tests/wrappers/fixtures/live_screenshot001.xml +++ b/tests/wrappers/fixtures/live-screenshot-minimal.xml @@ -1,7 +1,7 @@ - + screenshot.png screenshot-thumb.png diff --git a/tests/wrappers/fixtures/live_screenshot001.yaml b/tests/wrappers/fixtures/live-screenshot-minimal.yaml similarity index 100% rename from tests/wrappers/fixtures/live_screenshot001.yaml rename to tests/wrappers/fixtures/live-screenshot-minimal.yaml