[workflow-plugin] How can I get the hostname of the parent node

39 views
Skip to first unread message

Clifford Sanders

unread,
Mar 30, 2015, 7:36:23 AM3/30/15
to jenkins...@googlegroups.com
In the following workflow I need to get the hostname of the parent node.

node('clifford') {

    sh "sh create-modules-list.sh > modules.txt"

}

def branches = [:]
branches["build1"] = {
  node('clifford') {
    ws {
      sh "ssh build@${PARENT_HOST} 'bash -s' < get-next-module.sh /var/lib/build/workspace/test-workflow/modules.txt 2>&1"
    }
  }
}

Is it possible to pass the hostname as parameter?

I could write the hostname to a file and archive/unarchive it to read the hostname from there. But maybe there is an easier way?

Thanks

Clifford

Baptiste Mathus

unread,
Mar 31, 2015, 1:21:48 AM3/31/15
to jenkins...@googlegroups.com
currentBuild.getBuiltOn(), at least as a starting point? (Though I didn't check if this is actually an AbstractBuild instance which is passed)

Cheers

--
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/8ee30fa8-295d-4892-96d5-0e7edd17b166%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Baptiste <Batmat> MATHUS - http://batmat.net
Sauvez un arbre,
Mangez un castor !

Jesse Glick

unread,
Jun 16, 2015, 3:01:30 PM6/16/15
to jenkins...@googlegroups.com
On Monday, March 30, 2015 at 7:36:23 AM UTC-4, Clifford Sanders wrote:
I could write the hostname to a file and archive/unarchive it to read the hostname from there.

readFile 
Reply all
Reply to author
Forward
0 new messages