Skip to content
Permalink
Browse files
[JENKINS-33881] Added support for Jython Plugin
  • Loading branch information
v1v committed Mar 29, 2016
1 parent c028e8c commit 3f0be7aa3235031b53573682d05af55fdcc35720
@@ -0,0 +1,6 @@
job('example') {
steps {
jython('print "Hello" + "Goodbye"')
jython(readFileFromWorkspace('build.py'))
}
}
@@ -1170,6 +1170,19 @@ class StepContext extends AbstractExtensibleContext {
stepNodes << cmakeNode
}

/**
* Runs a jython script.
*
* Use {@link javaposse.jobdsl.dsl.DslFactory#readFileFromWorkspace(java.lang.String) readFileFromWorkspace} to read
* the script from a file.
* @since 1.45
*/
void jython(String command) {
stepNodes << new NodeBuilder().'org.jvnet.hudson.plugins.Jython' {
delegate.command(command)
}
}

/**
* @since 1.35
*/
@@ -3702,4 +3702,17 @@ class StepContextSpec extends Specification {
}
1 * jobManagement.requireMinimumPluginVersion('cmakebuilder', '2.4.1')
}

def 'call jython method'() {
when:
context.jython('print "Hello" + "Goodbye"')

then:
context.stepNodes != null
context.stepNodes.size() == 1
with(context.stepNodes[0]) {
name() == 'org.jvnet.hudson.plugins.Jython'
command[0].value() == 'print "Hello" + "Goodbye"'
}
}
}

0 comments on commit 3f0be7a

Please sign in to comment.