Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing a Jenkins plugin package from a Groovy script

Tags:

jenkins

groovy

How can I find the path to a Jenkins plugin if I want to use it from a groovy script?

For example, just testing on the master, I'd like to be able to use the LabelParameterValue class from the NodeLabelParameter plugin. An example of what I'm looking for is below, (though it doesn't work).

currentParameters.add(new hudson.plugins.nodelabelparameter.LabelParameterValue(nodeName))

like image 354
Roy Avatar asked Sep 15 '25 21:09

Roy


1 Answers

In Postbuild Groovy script you can specify Additional groovy classpath. For example: /var/jenkins/plugins/claim/WEB-INF/classes for Claim plugin code. I tried it and it worked.

Unfortunately the path has to be absolute and does not allow for environment variables (such as ${JENKINS_HOME}). Also, I am not entirely sure where the script will look when run on a slave - on the slave or on master.

like image 71
malenkiy_scot Avatar answered Sep 19 '25 19:09

malenkiy_scot