From dff22236d49f1cd660683448748636bef9ec53b8 Mon Sep 17 00:00:00 2001 From: Drew Rothstein Date: Sun, 13 Nov 2016 09:32:21 -0800 Subject: [PATCH] Adds height and width support to the Plot Publisher Height and width are supported by the Plot Plugin today but not made available in the Publisher. This adds support for both with the same defaults that exist in the plugin. This allows users to configure a height and width as desired. Change-Id: I1846e73d2fc3f6a9f651646b74cd3af6f85aee6d --- jenkins_jobs/modules/publishers.py | 4 ++++ tests/publishers/fixtures/plot001.xml | 2 ++ tests/publishers/fixtures/plot002.xml | 2 ++ tests/publishers/fixtures/plot003.xml | 2 ++ tests/publishers/fixtures/plot004.xml | 4 ++++ tests/publishers/fixtures/plot005.xml | 2 ++ tests/publishers/fixtures/plot006.xml | 33 ++++++++++++++++++++++++++ tests/publishers/fixtures/plot006.yaml | 19 +++++++++++++++ 8 files changed, 68 insertions(+) create mode 100644 tests/publishers/fixtures/plot006.xml create mode 100644 tests/publishers/fixtures/plot006.yaml 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 @@ Sample graph + 750 + 450 persisted.csv 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 @@ Sample graph + 750 + 450 persisted.csv 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 @@ Sample graph + 750 + 450 persisted.csv 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 @@ MyPlot Y + 750 + 450 myplot.csv @@ -33,6 +35,8 @@ MyPlot2 Y + 750 + 450 myplot2.csv 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 @@ Sample graph + 750 + 450 persisted.csv 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 @@ + + + + + + + Sample graph + + 900 + 1000 + persisted.csv + + + data.csv + OFF + + + false + csv + + + bench + false + false + false + true + + + + + + + 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'