From bd4bbaf3c01a2b3100eedc1b7f7d1b7429a5a9bf Mon Sep 17 00:00:00 2001 From: Alexandre Conrad Date: Fri, 25 Apr 2014 13:38:13 -0700 Subject: add support for python builder Change-Id: I0b1711c04435287bb851a72df25ebba10c891831 --- jenkins_jobs/modules/builders.py | 16 ++++++++++++++++ setup.cfg | 1 + tests/builders/fixtures/python.xml | 8 ++++++++ tests/builders/fixtures/python.yaml | 2 ++ 4 files changed, 27 insertions(+) create mode 100644 tests/builders/fixtures/python.xml create mode 100644 tests/builders/fixtures/python.yaml diff --git a/jenkins_jobs/modules/builders.py b/jenkins_jobs/modules/builders.py index 51542567..1503e31d 100644 --- a/jenkins_jobs/modules/builders.py +++ b/jenkins_jobs/modules/builders.py @@ -62,6 +62,22 @@ def shell(parser, xml_parent, data): XML.SubElement(shell, 'command').text = data +def python(parser, xml_parent, data): + """yaml: python + Execute a python command. Requires the Jenkins `Python plugin. + `_ + + :arg str parameter: the python command to execute + + Example: + + .. literalinclude:: /../../tests/builders/fixtures/python.yaml + + """ + python = XML.SubElement(xml_parent, 'hudson.plugins.python.Python') + XML.SubElement(python, 'command').text = data + + def copyartifact(parser, xml_parent, data): """yaml: copyartifact diff --git a/setup.cfg b/setup.cfg index a1db8ff0..4aa64f9d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -49,6 +49,7 @@ jenkins_jobs.builders = maven-target=jenkins_jobs.modules.builders:maven_target msbuild=jenkins_jobs.modules.builders:msbuild multijob=jenkins_jobs.modules.builders:multijob + python=jenkins_jobs.modules.builders:python sbt=jenkins_jobs.modules.builders:sbt shell=jenkins_jobs.modules.builders:shell shining-panda=jenkins_jobs.modules.builders:shining_panda diff --git a/tests/builders/fixtures/python.xml b/tests/builders/fixtures/python.xml new file mode 100644 index 00000000..c3b93470 --- /dev/null +++ b/tests/builders/fixtures/python.xml @@ -0,0 +1,8 @@ + + + + + import foobar + + + diff --git a/tests/builders/fixtures/python.yaml b/tests/builders/fixtures/python.yaml new file mode 100644 index 00000000..da5f93a3 --- /dev/null +++ b/tests/builders/fixtures/python.yaml @@ -0,0 +1,2 @@ +builders: + - python: 'import foobar' -- cgit