Re: Get the root directory of node in Pipeline

2017-01-10 Thread Kristian
I had to change the nodeRootDir() a little bit, but this way works for me: @NonCPS def nodeRootDir(nodeName) { for (node in Jenkins.instance.nodes) { if (!nodeName.equals('master') && node.name.compareTo(nodeName) == 0 ) { return node.getRootPath()

Re: Get the root directory of node in Pipeline

2017-01-09 Thread Indra Gunawan (ingunawa)
How about this : import jenkins.model.* node () { def nodeName = ${env.NODE_NAME} def nodeRootPath = nodeRootDir(nodeName) ... } @NonCPS def nodeRootDir(nodeName) { for (node in Jenkins.instance.nodes) { if ( !nodeName.equals('master') &&

Re: Get the root directory of node in Pipeline

2017-01-09 Thread Kristian
This gives me the workspace of the job. But I want the root directory which I set when I create a new slave node in Jenkins. So, as an example, I create a new slave node. The root directory i am setting there is /home/jenkins. Currently, when I run a job, I get "/home/jenkins/workspace/Some Job Na

Re: Get the root directory of node in Pipeline

2017-01-09 Thread Slide
You can use pwd, to get it. node() { ROOT = pwd() } On Mon, Jan 9, 2017 at 9:45 AM Kristian wrote: > Hi, > > do someone knows how to get the root directory of a node in a Pipeline > script? > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" g

Get the root directory of node in Pipeline

2017-01-09 Thread Kristian
Hi, do someone knows how to get the root directory of a node in a Pipeline script? -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@