summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Conrad <alexandre@surveymonkey.com>2014-04-25 13:38:13 -0700
committerAlexandre Conrad <alexandre@surveymonkey.com>2014-04-26 18:04:44 -0700
commitbd4bbaf3c01a2b3100eedc1b7f7d1b7429a5a9bf (patch)
treef57d5f1d71ddbef453cb2bd7ca5dbddec8be60a0
parentc68249a7f16af8aacbce2639cb2600f5638aca0c (diff)
downloadpython-jenkins-job-builder-bd4bbaf3c01a2b3100eedc1b7f7d1b7429a5a9bf.tar.gz
python-jenkins-job-builder-bd4bbaf3c01a2b3100eedc1b7f7d1b7429a5a9bf.tar.xz
python-jenkins-job-builder-bd4bbaf3c01a2b3100eedc1b7f7d1b7429a5a9bf.zip
add support for python builder
Change-Id: I0b1711c04435287bb851a72df25ebba10c891831
-rw-r--r--jenkins_jobs/modules/builders.py16
-rw-r--r--setup.cfg1
-rw-r--r--tests/builders/fixtures/python.xml8
-rw-r--r--tests/builders/fixtures/python.yaml2
4 files changed, 27 insertions, 0 deletions
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.
+ <https://wiki.jenkins-ci.org/display/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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project>
+ <builders>
+ <hudson.plugins.python.Python>
+ <command>import foobar</command>
+ </hudson.plugins.python.Python>
+ </builders>
+</project>
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'