Need Help Getting host name

10 views
Skip to first unread message

LOKESH RAJU

unread,
Dec 6, 2017, 12:14:36 AM12/6/17
to Jenkins Users
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

Ramanathan Muthaiah

unread,
Dec 6, 2017, 6:48:10 AM12/6/17
to Jenkins Users
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 
Reply all
Reply to author
Forward
0 new messages