Difference between execute groovy script and the execute system groovy script in jenkins?

user2400564 picture user2400564 · Oct 28, 2013 · Viewed 9k times · Source

Can anyone explain the different between the execute groovy script and the execute system groovy script in jenkins? And how to call the script to slave using execute system groovy script.

Answer

Jayan picture Jayan · Oct 28, 2013

To execute a groovy script on the slave machine, you should use groovy plugin

Quote

The plain "Groovy Script" is run in a forked JVM, on the slave where the build is run. It's the basically the same as running the "groovy" command and pass in the script.

First part of your question is answered in the same page

The system groovy script, OTOH, runs inside the Hudson master's JVM. Thus it will have access to all the internal objects of Hudson, so you can use this to alter the state of Hudson. It is similar to the Jenkins Script Console functionality.