diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py index 1cd145277..6021cf3e9 100644 --- a/jenkins_jobs/modules/publishers.py +++ b/jenkins_jobs/modules/publishers.py @@ -3973,6 +3973,8 @@ def plot(registry, xml_parent, data): :arg str title: title for the graph (default '') :arg str yaxis: title of Y axis (default '') + :arg int width: the width of the plot in pixels (default 750) + :arg int height: the height of the plot in pixels (default 450) :arg str group: name of the group to which the plot belongs (required) :arg int num-builds: number of builds to plot across (default plot all builds) @@ -4050,6 +4052,8 @@ def plot(registry, xml_parent, data): plugin = XML.SubElement(plots, 'hudson.plugins.plot.Plot') XML.SubElement(plugin, 'title').text = plot.get('title', '') XML.SubElement(plugin, 'yaxis').text = plot['yaxis'] + XML.SubElement(plugin, 'width').text = str(plot.get('width', '750')) + XML.SubElement(plugin, 'height').text = str(plot.get('height', '450')) XML.SubElement(plugin, 'csvFileName').text = \ plot.get('csv-file-name', '%s.csv' % random.randrange(2 << 32)) topseries = XML.SubElement(plugin, 'series') diff --git a/tests/publishers/fixtures/plot001.xml b/tests/publishers/fixtures/plot001.xml index 88fbda0fd..f0e9b8275 100644 --- a/tests/publishers/fixtures/plot001.xml +++ b/tests/publishers/fixtures/plot001.xml @@ -6,6 +6,8 @@ <hudson.plugins.plot.Plot> <title>Sample graph</title> <yaxis/> + <width>750</width> + <height>450</height> <csvFileName>persisted.csv</csvFileName> <series> <hudson.plugins.plot.CSVSeries> diff --git a/tests/publishers/fixtures/plot002.xml b/tests/publishers/fixtures/plot002.xml index e0c336b1b..21c0b5aa8 100644 --- a/tests/publishers/fixtures/plot002.xml +++ b/tests/publishers/fixtures/plot002.xml @@ -6,6 +6,8 @@ <hudson.plugins.plot.Plot> <title>Sample graph</title> <yaxis/> + <width>750</width> + <height>450</height> <csvFileName>persisted.csv</csvFileName> <series> <hudson.plugins.plot.PropertiesSeries> diff --git a/tests/publishers/fixtures/plot003.xml b/tests/publishers/fixtures/plot003.xml index 89a574a2d..e4f11d652 100644 --- a/tests/publishers/fixtures/plot003.xml +++ b/tests/publishers/fixtures/plot003.xml @@ -6,6 +6,8 @@ <hudson.plugins.plot.Plot> <title>Sample graph</title> <yaxis/> + <width>750</width> + <height>450</height> <csvFileName>persisted.csv</csvFileName> <series> <hudson.plugins.plot.XMLSeries> diff --git a/tests/publishers/fixtures/plot004.xml b/tests/publishers/fixtures/plot004.xml index b2a6b016f..55b1143b1 100644 --- a/tests/publishers/fixtures/plot004.xml +++ b/tests/publishers/fixtures/plot004.xml @@ -6,6 +6,8 @@ <hudson.plugins.plot.Plot> <title>MyPlot</title> <yaxis>Y</yaxis> + <width>750</width> + <height>450</height> <csvFileName>myplot.csv</csvFileName> <series> <hudson.plugins.plot.PropertiesSeries> @@ -33,6 +35,8 @@ <hudson.plugins.plot.Plot> <title>MyPlot2</title> <yaxis>Y</yaxis> + <width>750</width> + <height>450</height> <csvFileName>myplot2.csv</csvFileName> <series> <hudson.plugins.plot.XMLSeries> diff --git a/tests/publishers/fixtures/plot005.xml b/tests/publishers/fixtures/plot005.xml index 071c7d97d..d8b8fd9e6 100644 --- a/tests/publishers/fixtures/plot005.xml +++ b/tests/publishers/fixtures/plot005.xml @@ -6,6 +6,8 @@ <hudson.plugins.plot.Plot> <title>Sample graph</title> <yaxis/> + <width>750</width> + <height>450</height> <csvFileName>persisted.csv</csvFileName> <series> <hudson.plugins.plot.CSVSeries> diff --git a/tests/publishers/fixtures/plot006.xml b/tests/publishers/fixtures/plot006.xml new file mode 100644 index 000000000..dc67a6e7c --- /dev/null +++ b/tests/publishers/fixtures/plot006.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <publishers> + <hudson.plugins.plot.PlotPublisher> + <plots> + <hudson.plugins.plot.Plot> + <title>Sample graph</title> + <yaxis/> + <width>900</width> + <height>1000</height> + <csvFileName>persisted.csv</csvFileName> + <series> + <hudson.plugins.plot.CSVSeries> + <file>data.csv</file> + <inclusionFlag>OFF</inclusionFlag> + <exclusionValues/> + <url/> + <displayTableFlag>false</displayTableFlag> + <fileType>csv</fileType> + </hudson.plugins.plot.CSVSeries> + </series> + <group>bench</group> + <useDescr>false</useDescr> + <exclZero>false</exclZero> + <logarithmic>false</logarithmic> + <keepRecords>true</keepRecords> + <numBuilds/> + <style>line</style> + </hudson.plugins.plot.Plot> + </plots> + </hudson.plugins.plot.PlotPublisher> + </publishers> +</project> diff --git a/tests/publishers/fixtures/plot006.yaml b/tests/publishers/fixtures/plot006.yaml new file mode 100644 index 000000000..2b1932883 --- /dev/null +++ b/tests/publishers/fixtures/plot006.yaml @@ -0,0 +1,19 @@ +publishers: + - plot: + - title: 'Sample graph' + yaxis: '' + width: 900 + height: 1000 + csv-file-name: 'persisted.csv' + group: 'bench' + numbuilds: '1' + style: 'line' + use-description: false + keep-records: true + series: + - file: 'data.csv' + label: '' + url: '' + format: 'csv' + display-table: false + inclusion-flag: 'off'