[workflow-plugin] Unable to get NODE_NAME variable during the build

441 views
Skip to first unread message

Arek Skalski

unread,
Feb 11, 2015, 6:08:29 AM2/11/15
to jenkins...@googlegroups.com
groovy script:

print env.NODE_NAME

output:

Started by user anonymous
Running: Print Message
null
Running: End of Workflow
Finished: SUCCESS

Arek Skalski

unread,
Feb 11, 2015, 6:11:24 AM2/11/15
to jenkins...@googlegroups.com
tested also inside
node("node_name") {
   
print env.NODE_NAME
}

output:
Started by user anonymous
Running: Allocate node : Start
Running on computer1 in /jenkins/workspace/Groovy_Test
Running: Allocate node : Body : Start
Running: Print Message
null
Running: Allocate node : Body : End
Running: Allocate node : End

Running: End of Workflow
Finished: SUCCESS

Slide

unread,
Feb 11, 2015, 10:07:04 AM2/11/15
to jenkins...@googlegroups.com
Do you have the env-inject plugin installed?

--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/22ff0de5-7b1f-461d-be3f-196298c6f119%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Arek Skalski

unread,
Feb 12, 2015, 7:24:02 AM2/12/15
to jenkins...@googlegroups.com
I do have:

Environment Injector Plugin


Slide

unread,
Feb 12, 2015, 7:44:29 AM2/12/15
to jenkins...@googlegroups.com

On Thu Feb 12 2015 at 5:24:05 AM Arek Skalski <askal...@gmail.com> wrote:
I do have:

Environment Injector Plugin


--
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-use...@googlegroups.com.

Arek Skalski

unread,
Feb 20, 2015, 4:40:18 AM2/20/15
to jenkins...@googlegroups.com


Found a work around ('Linux node').

To actually get the node name I am using
def nodeName = "hostname".execute().text.replace('\n', '')

node name does not have to be equal to hostname, but the hostname is just enough for me so I could locilize the node I am currently using ;-)

Cheers!

Jesse Glick

unread,
Feb 25, 2015, 5:51:13 PM2/25/15
to jenkins...@googlegroups.com
NODE_NAME is defined for AbstractBuild (freestyle, etc.), not Workflow currently. It could not be defined using the same system by which flow builds pick up general build variables (BUILD_URL) etc. because there is not a unique node for a flow build. You could open an RFE for ExecutorStepExecution to define NODE_NAME for use by steps inside node {}.
Reply all
Reply to author
Forward
0 new messages