0
votes

I want to execute a groovy script from Jenkins using "Execute system Groovy Script". I have the groovy script ready. But i don't want the script to be there in the Groovy Command Console present. Instead it should take from the SVN server. I think i can use the option "Groovy Script File" for that. If so, how do i do it? If not, what is the correct way to execute groovy scripts given that groovy scripts are present in a file in some location.

1

1 Answers

0
votes

if you want to execute the script file, you have to use "Execute groovy script" option.you cam maintain in any location as parameter/variable and mention it in path.

using execute shell or svn plugin you can checkout the file into that location.

Groovy Script vs System Groovy Script

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.

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.