Need Help Getting host name

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Need Help Getting host name

LOKESH RAJU
Hi Team,

I have a custom plugin which during the post-build phase needs the hostname/IP address of the node where the build is executing,

build.getExecutor().getOwner().getNode().toComputer().getHostName()

I have been using the above method, but it does not give me the right host name

Regards
Lokesh Raju S

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/8a045919-216b-4a60-ba63-127bf2efd395%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Need Help Getting host name

Ramanathan Muthaiah
I have a custom plugin which during the post-build phase needs the hostname/IP address of the node where the build is executing,

build.getExecutor().getOwner().getNode().toComputer().getHostName()

I have been using the above method, but it does not give me the right host name

You have not mentioned if your build job is freestyle or pipeline. 

Could you not get node name from environment variable set by the build job?

/Ram 

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/2e2d1bd0-73f7-4619-9e6f-f50a260dab23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.