groovy scripts outside of jenkins

1,316 views
Skip to first unread message

Michael Higgins

unread,
Nov 22, 2011, 7:37:10 PM11/22/11
to jenkins...@googlegroups.com
Looking at the cool, uh... groovy, that is, stuff one can do in the
'script console'.

It would be *so* much more useful to run these scripts intended for
that 'console' from my laptop, so to get bits of information about the
systems in use in a place I can keep them -- without touching a mouse.
Or a browser...

Is this possible? I've yet to find an example of running something that
iterates, FEX, over hudson.model.Hudson.instance from an arbitrary
shell. If it is possible, can I get a pointer to an example at least?

If not, I'd like to stop thinking about it with some confirmation that
what I want isn't doable. ;-)

Cheers,

--
Michael Higgins
QA Intern, PuppetLabs
mhig...@puppetlabs.com

Simon Wiest

unread,
Nov 23, 2011, 5:19:00 AM11/23/11
to jenkins...@googlegroups.com
Hi Michael,

no problem, you can send Groovy scripts via the Command Line Interface
(https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI) to a remote
Jenkins server, get them executed there and the results sent back to
your client.

Example "Which plugins are installed on a remote Jenkins server?":

java -jar jenkins-cli.jar -s http://localhost:8080 groovysh \
'jenkins.model.Jenkins.instance.pluginManager.plugins.each { \
println("${it.longName} - ${it.version}") };'

giving you an output on the client like this:

ant - 1.1
javadoc - 1.0
Jenkins CVS Plug-in - 1.6
Maven Integration plugin - 1.440
Jenkins Subversion Plug-in - 1.34
Jenkins Parameterized Trigger plugin - 2.12
Jenkins GIT plugin - 1.1.12
JUnit Attachments Plugin - 1.1
Jenkins SSH Slaves plugin - 0.21
Jenkins Translation Assistance plugin - 1.8
[...]

Rinse and repeat for even wilder ideas... ;O)

Cheers,
Simon.
--
Michael Higgins (23.11.2011 01:37):

Slide

unread,
Nov 23, 2011, 8:17:36 AM11/23/11
to jenkins...@googlegroups.com
Wow, that is awesome. I had no idea that was possible!

Thanks!

slide

Michael Higgins

unread,
Nov 23, 2011, 11:45:23 AM11/23/11
to jenkins...@googlegroups.com
On Wed, 23 Nov 2011 06:17:36 -0700
Slide <slide...@gmail.com> wrote:

> Wow, that is awesome. I had no idea that was possible!
>
> Thanks!
>
> slide
>
> On Wed, Nov 23, 2011 at 3:19 AM, Simon Wiest <simon...@web.de>
> wrote:
>
> > Hi Michael,
> >
> > no problem, you can send Groovy scripts via the Command Line
> > Interface

[8<]

Thanks for the reply! I did see another thread that had the needed
cluebat, just after I hit send... And yes, this is an awesome feature.

Thanks again,

Reply all
Reply to author
Forward
0 new messages