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()
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') &&
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
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
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...@