[英]Accessing a Jenkins plugin package from a Groovy script
How can I find the path to a Jenkins plugin if I want to use it from a groovy script? 如果我想从一个groovy脚本中使用它,我怎样才能找到Jenkins插件的路径?
For example, just testing on the master, I'd like to be able to use the LabelParameterValue class from the NodeLabelParameter plugin. 例如,只是在master上测试,我希望能够使用NodeLabelParameter插件中的LabelParameterValue类。 An example of what I'm looking for is below, (though it doesn't work).
我正在寻找的一个例子如下,(虽然它不起作用)。
currentParameters.add(new hudson.plugins.nodelabelparameter.LabelParameterValue(nodeName))
In Postbuild Groovy script you can specify Additional groovy classpath . 在Postbuild Groovy脚本中,您可以指定Additional groovy classpath 。 For example:
/var/jenkins/plugins/claim/WEB-INF/classes
for Claim plugin code. 例如:
/var/jenkins/plugins/claim/WEB-INF/classes
用于Claim插件代码的/var/jenkins/plugins/claim/WEB-INF/classes
。 I tried it and it worked. 我尝试了它,它的工作原理。
Unfortunately the path has to be absolute and does not allow for environment variables (such as ${JENKINS_HOME}
). 不幸的是,路径必须是绝对的,并且不允许环境变量(例如
${JENKINS_HOME}
)。 Also, I am not entirely sure where the script will look when run on a slave - on the slave or on master. 此外,我不能完全确定在奴隶上运行时脚本的位置 - 在奴隶或主人身上。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.