Re: Need help getting a sample scriptler groovy script to run on a slave.

2012-08-20 Thread Damon G
My apologies,
  I wasn't trying to be vague. I thought it would be easier if I set my 
goal to be running any of the sample scripts listed on the groovy sample 
script page. I am actually able to run groovy code on the slave. I'm 
actually trying to use the scriptlet plugin so that I can store the groovy 
script on the master and have it copy to the slave and execute at run time. 
>From what I'm reading that's one of the benefits of using the scriptlet 
plug-in apparently: storage of the groovy scripts on the master, without 
the need to copy it to the slave at execution time.

To your point, I haven't really been that clear.

I have a scriptler script saved on the master called "test". It contains 
this one line:

println System.getenv("PATH")
When I run this from the Scriptler console interface against the master it 
works fine and prints the contents of the PATH environment variable.

However, when I attempt to run it against a slave I get the same error I 
reported in my last post.

I also get the same error when I "execute a scriptlet" as a build step and 
execute it on a slave. Again, works fine if I point it to the master.

I've even tried replacing my one line of code with :

prinln "hello world"

and get the same error! If I can't do a simple print statement I must be 
doing something very basic incorrectly with my environment.

I'm guessing my issue with executing groovy on the slave is specific to the 
scriplter plugin. I think this because I'm able to execute groovy on the 
slave if I specify a groovy script as a build step...the only caveat there 
is that the only groovy I can execute is basic groovy...I'm not able to 
reference any of the jenkins api's when executing on the slave.

Does that help describe what I'm doing a little better?




Take for instance

On Friday, August 17, 2012 5:27:09 PM UTC-4, sti wrote:
>
> You're not being too forthcoming with what you want to accomplish, so this 
> may not help you much: 
>
> Like it says in the System Groovy Script build step, system Groovy script 
> always executes on the master. The "system Groovy" actually executes inside 
> of Jenkins, in the same vm, so system Groovy can do many of the same things 
> as a plugin can. 
>
> If you want to run a Groovy script on the slave, you need to use the 
> "Execute Groovy Script" build step and then, if the job is set to execute 
> on a slave, Jenkins will really spawn the Groovy process in the slave. 
>
> -- Sami 
>
> Damon G > kirjoitti 16.8.2012 kello 
> 15.22: 
>
> > Hi There, 
> >I've been playing with the groovy plugin and I'm able to run a few 
> sample groovy scripts on the master using the system groovy script option 
> in the job. However I can't seem to get the same code to execute on the 
> slave by executing a groovy script or by using the scriptler plugin. Even a 
> simple "println" statement doesn't work. For instance: 
> > 
> > import hudson.model.* 
> > prinln("hello!!!") 
> > 
> > results in: 
> > 
> > Execution of script [test.groovy] failed - Unable to serialize 
> org.jenkinsci.plugins.scriptler.util.GroovyScript@75f0ab39Build step 
> 'Scriptler script' marked build as failure 
> > 
> > I get the same thing if I just do prinln("hello!!!") and leave out the 
> import statement. 
> > 
> > I have groovy installed on the slave but I must be missing something. 
> When I execute on the slave do I need something additional in my classpath? 
> I didn't seem to need anything explicit in my classspath to run this as a 
> system groovy script on the master. 
> > 
> > Does anyone have simple example config to share? I think I must be 
> missing something fairly basic here. 
> > 
> > Thanks! 
> > 
> > 
> > 
>
>

Re: Need help getting a sample scriptler groovy script to run on a slave.

2012-08-17 Thread Sami Tikka
You're not being too forthcoming with what you want to accomplish, so this may 
not help you much:

Like it says in the System Groovy Script build step, system Groovy script 
always executes on the master. The "system Groovy" actually executes inside of 
Jenkins, in the same vm, so system Groovy can do many of the same things as a 
plugin can.

If you want to run a Groovy script on the slave, you need to use the "Execute 
Groovy Script" build step and then, if the job is set to execute on a slave, 
Jenkins will really spawn the Groovy process in the slave.

-- Sami

Damon G  kirjoitti 16.8.2012 kello 15.22:

> Hi There,
>I've been playing with the groovy plugin and I'm able to run a few sample 
> groovy scripts on the master using the system groovy script option in the 
> job. However I can't seem to get the same code to execute on the slave by 
> executing a groovy script or by using the scriptler plugin. Even a simple 
> "println" statement doesn't work. For instance:
> 
> import hudson.model.*
> prinln("hello!!!")
> 
> results in:
> 
> Execution of script [test.groovy] failed - Unable to serialize 
> org.jenkinsci.plugins.scriptler.util.GroovyScript@75f0ab39Build step 
> 'Scriptler script' marked build as failure
> 
> I get the same thing if I just do prinln("hello!!!") and leave out the import 
> statement.
> 
> I have groovy installed on the slave but I must be missing something. When I 
> execute on the slave do I need something additional in my classpath? I didn't 
> seem to need anything explicit in my classspath to run this as a system 
> groovy script on the master.
> 
> Does anyone have simple example config to share? I think I must be missing 
> something fairly basic here.
> 
> Thanks!
> 
> 
> 



Need help getting a sample scriptler groovy script to run on a slave.

2012-08-16 Thread Damon G
Hi There,
   I've been playing with the groovy plugin and I'm able to run a few 
sample groovy scripts on the master using the system groovy script option 
in the job. However I can't seem to get the same code to execute on the 
slave by executing a groovy script or by using the scriptler plugin. Even a 
simple "println" statement doesn't work. For instance:

import hudson.model.*
prinln("hello!!!")

results in:

Execution of script [test.groovy] failed - Unable to serialize 
org.jenkinsci.plugins.scriptler.util.GroovyScript@75f0ab39Build step 'Scriptler 
script' marked build as failure

I get the same thing if I just do prinln("hello!!!") and leave out the import 
statement.

I have groovy installed on the slave but I must be missing something. When I 
execute on the slave do I need something additional in my classpath? I didn't 
seem to need anything explicit in my classspath to run this as a system groovy 
script on the master.

Does anyone have simple example config to share? I think I must be missing 
something fairly basic here.

Thanks!