I am confused about whether a Jenkins job can be run using Groovy script in the slave node. I referred a StackOverflow answer [1] which says that System Groovy script jobs can be run in master and not in slave, and to run a job in slave it has to be Groovy script rather than System Groovy Script. Can someone clarify me whether we can run a slave job using System Groovy Script? Since I am trying through Groovy script I am unable to access few Jenkins instances. Please suggest me a better way with an explanation. Thanks in advance
Asked
Active
Viewed 1,091 times
0
-
Possible duplicate of [Jenkins Declarative Pipeline, run groovy script on slave agent](https://stackoverflow.com/questions/43748826/jenkins-declarative-pipeline-run-groovy-script-on-slave-agent) – Ori Marko Oct 06 '19 at 15:02
-
I had already gone through the above links. Is there any other possibilities to run as a plain groovy script rather than a pipeline job? Thanks for your advice @user7294900 – hema Oct 07 '19 at 12:07
1 Answers
0
I have finally found that it is only possible to run jobs in Jenkins slave node using Grovvy script. The system groovy script runs inside the Hudson master's JVM. Thus it will have access to all the internal objects of Hudson, so we can use this to alter the state of Hudson. It is similar to the Jenkins Script Console functionality.

hema
- 45
- 1
- 2
- 11