Merge "Adding builder for SSH plugin"

This commit is contained in:
Jenkins 2015-06-16 10:09:46 +00:00 committed by Gerrit Code Review
commit db7eebf67a
4 changed files with 37 additions and 0 deletions

View File

@ -1870,6 +1870,29 @@ def github_notifier(parser, xml_parent, data):
'com.cloudbees.jenkins.GitHubSetCommitStatusBuilder')
def ssh_builder(parser, xml_parent, data):
"""yaml: ssh-builder
Executes command on remote host
Requires the Jenkins `SSH plugin.
<https://wiki.jenkins-ci.org/display/JENKINS/SSH+plugin>`_
:arg str ssh-user-ip: user@ip:ssh_port of machine that was defined
in jenkins according to SSH plugin instructions
:arg str command: command to run on remote server
Example:
.. literalinclude:: /../../tests/builders/fixtures/ssh-builder.yaml
"""
builder = XML.SubElement(
xml_parent, 'org.jvnet.hudson.plugins.SSHBuilder')
try:
XML.SubElement(builder, 'siteName').text = str(data['ssh-user-ip'])
XML.SubElement(builder, 'command').text = str(data['command'])
except KeyError as e:
raise MissingAttributeError("'%s'" % e.args[0])
def sonar(parser, xml_parent, data):
"""yaml: sonar
Invoke standalone Sonar analysis.

View File

@ -74,6 +74,7 @@ jenkins_jobs.builders =
shining-panda=jenkins_jobs.modules.builders:shining_panda
sonar=jenkins_jobs.modules.builders:sonar
sonatype-clm=jenkins_jobs.modules.builders:sonatype_clm
ssh-builder=jenkins_jobs.modules.builders:ssh_builder
system-groovy=jenkins_jobs.modules.builders:system_groovy
trigger-builds=jenkins_jobs.modules.builders:trigger_builds
jenkins_jobs.reporters =

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<builders>
<org.jvnet.hudson.plugins.SSHBuilder>
<siteName>foo@bar:22</siteName>
<command>echo foo</command>
</org.jvnet.hudson.plugins.SSHBuilder>
</builders>
</project>

View File

@ -0,0 +1,4 @@
builders:
- ssh-builder:
ssh-user-ip: foo@bar:22
command: echo foo