[英]Get Jenkins workspacedirs from master with Groovy Script
At first I try to give out my workspacefiles from slave-nodes with this code and it works : 首先,我尝试使用此代码从从属节点分发我的工作区文件,并且它的工作原理是:
import Jenkins.*
jenkins = Jenkins.instance
for (slave in jenkins.nodes) {
try {
wsNodes = slave.getWorkspaceRoot()
println("workspaceRoot: " + wsNodes)
for (dir in wsNodes.list()) {
try {
println(" dirname: " + dir )
}catch (Exception e) {
println("! Error in slave processing: ${e}")
}
}
}catch (Exception e) {
println("! Error in slave processing: ${e}")
}
}
I only find solutions for this with the slaves. 我只找到与奴隶有关的解决方案。 Is there a solution to get the workspacedirs from the master-node ?
有没有从主节点获取工作区目录的解决方案?
Code snippet below should do what you want: 下面的代码段应该可以满足您的要求:
import Jenkins.*
jenkins = Jenkins.instance
String jenkinsMasterWorkspace = jenkins.getRawWorkspaceDir()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.