Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 392
user2400564 Avatar asked Oct 28 '13 12:10

user2400564


People also ask

What is a Groovy script in Jenkins?

Groovy is a very powerful language which offers the ability to do practically anything Java can do including: Create sub-processes and execute arbitrary commands on the Jenkins controller and agents. It can even read files in which the Jenkins controller has access to on the host (like /etc/passwd )

Which Groovy version does Jenkins use?

Groovy Postbuild plugins use the groovy version included in Jenkins (1.8. 9).

What is Groovy script console?

The Groovy Web Console is a website for sharing and executing Groovy programming snippets of code!


1 Answers

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.

like image 75
Jayan Avatar answered Oct 13 '22 07:10

Jayan