summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraidan.mcginley <aidan.mcginley@wonga.com>2014-09-12 15:53:38 +0100
committeraidan.mcginley <launchpad@aidanmcginley.com>2014-09-12 15:58:14 +0100
commitbaf6670148a5e00665aa08d00f9d662b12029681 (patch)
tree508f386f0a035a7532cb5d52cc455c2d670c6caf
parent2d74b1662095e7e482a83615f06683cb67c91bd6 (diff)
downloadpython-jenkins-job-builder-baf6670148a5e00665aa08d00f9d662b12029681.tar.gz
python-jenkins-job-builder-baf6670148a5e00665aa08d00f9d662b12029681.tar.xz
python-jenkins-job-builder-baf6670148a5e00665aa08d00f9d662b12029681.zip
Adding support for the Powershell plugin.
See https://wiki.jenkins-ci.org/display/JENKINS/PowerShell+Plugin Change-Id: I337ea896e358fe456e556a95e22e724fe20cd722
-rw-r--r--jenkins_jobs/modules/builders.py16
-rw-r--r--setup.cfg1
-rw-r--r--tests/builders/fixtures/powershell.xml8
-rw-r--r--tests/builders/fixtures/powershell.yaml2
4 files changed, 27 insertions, 0 deletions
diff --git a/jenkins_jobs/modules/builders.py b/jenkins_jobs/modules/builders.py
index dc71d20e..721a77fa 100644
--- a/jenkins_jobs/modules/builders.py
+++ b/jenkins_jobs/modules/builders.py
@@ -631,6 +631,22 @@ def batch(parser, xml_parent, data):
XML.SubElement(batch, 'command').text = data
+def powershell(parser, xml_parent, data):
+ """yaml: powershell
+ Execute a powershell command. Requires the `Powershell Plugin
+ <https://wiki.jenkins-ci.org/display/JENKINS/PowerShell+Plugin>`_.
+
+ :Parameter: the powershell command to execute
+
+ Example:
+
+ .. literalinclude:: ../../tests/builders/fixtures/powershell.yaml
+ :language: yaml
+ """
+ ps = XML.SubElement(xml_parent, 'hudson.plugins.powershell.PowerShell')
+ XML.SubElement(ps, 'command').text = data
+
+
def msbuild(parser, xml_parent, data):
"""yaml: msbuild
Build .NET project using msbuild. Requires the `Jenkins MSBuild Plugin
diff --git a/setup.cfg b/setup.cfg
index 1f2cdda8..374e1150 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -57,6 +57,7 @@ jenkins_jobs.builders =
maven-target=jenkins_jobs.modules.builders:maven_target
msbuild=jenkins_jobs.modules.builders:msbuild
multijob=jenkins_jobs.modules.builders:multijob
+ powershell=jenkins_jobs.modules.builders:powershell
python=jenkins_jobs.modules.builders:python
sbt=jenkins_jobs.modules.builders:sbt
shell=jenkins_jobs.modules.builders:shell
diff --git a/tests/builders/fixtures/powershell.xml b/tests/builders/fixtures/powershell.xml
new file mode 100644
index 00000000..873b8449
--- /dev/null
+++ b/tests/builders/fixtures/powershell.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project>
+ <builders>
+ <hudson.plugins.powershell.PowerShell>
+ <command>foo/foo.ps1</command>
+ </hudson.plugins.powershell.PowerShell>
+ </builders>
+</project>
diff --git a/tests/builders/fixtures/powershell.yaml b/tests/builders/fixtures/powershell.yaml
new file mode 100644
index 00000000..502f4f8f
--- /dev/null
+++ b/tests/builders/fixtures/powershell.yaml
@@ -0,0 +1,2 @@
+builders:
+ - powershell: "foo/foo.ps1"