Adding builder for SSH plugin
This builder allows running builder on remote machine using SSH Plugin https://wiki.jenkins-ci.org/display/JENKINS/SSH+plugin Change-Id: I8ea72e75bca1f9b5b087303d73b172fed192f95d
This commit is contained in:
parent
29a09458d2
commit
2b5f9344b7
@ -1870,6 +1870,29 @@ def github_notifier(parser, xml_parent, data):
|
|||||||
'com.cloudbees.jenkins.GitHubSetCommitStatusBuilder')
|
'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):
|
def sonar(parser, xml_parent, data):
|
||||||
"""yaml: sonar
|
"""yaml: sonar
|
||||||
Invoke standalone Sonar analysis.
|
Invoke standalone Sonar analysis.
|
||||||
|
@ -73,6 +73,7 @@ jenkins_jobs.builders =
|
|||||||
shining-panda=jenkins_jobs.modules.builders:shining_panda
|
shining-panda=jenkins_jobs.modules.builders:shining_panda
|
||||||
sonar=jenkins_jobs.modules.builders:sonar
|
sonar=jenkins_jobs.modules.builders:sonar
|
||||||
sonatype-clm=jenkins_jobs.modules.builders:sonatype_clm
|
sonatype-clm=jenkins_jobs.modules.builders:sonatype_clm
|
||||||
|
ssh-builder=jenkins_jobs.modules.builders:ssh_builder
|
||||||
system-groovy=jenkins_jobs.modules.builders:system_groovy
|
system-groovy=jenkins_jobs.modules.builders:system_groovy
|
||||||
trigger-builds=jenkins_jobs.modules.builders:trigger_builds
|
trigger-builds=jenkins_jobs.modules.builders:trigger_builds
|
||||||
jenkins_jobs.reporters =
|
jenkins_jobs.reporters =
|
||||||
|
9
tests/builders/fixtures/ssh-builder.xml
Normal file
9
tests/builders/fixtures/ssh-builder.xml
Normal 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>
|
4
tests/builders/fixtures/ssh-builder.yaml
Normal file
4
tests/builders/fixtures/ssh-builder.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
builders:
|
||||||
|
- ssh-builder:
|
||||||
|
ssh-user-ip: foo@bar:22
|
||||||
|
command: echo foo
|
Loading…
Reference in New Issue
Block a user