NodeLabel Parameter Plugin with Scripted pipeline

17 views
Skip to first unread message

jer...@bodycad.com

unread,
Dec 6, 2017, 3:11:53 PM12/6/17
to Jenkins Users
Is anybody can point me to some info or an how to use the node and label parameter.

I can make it work with a choice list but I would rather make it work with the plugin if possible with proper default value.

jer...@bodycad.com

unread,
Dec 13, 2017, 1:00:52 PM12/13/17
to Jenkins Users
For prosperity, my finding is:
  1. it seem like the node have their node name as label automatically (I realized this when trying to add the node name to the label, the label was disappearing when saving the changes) 
  2. Knowning number 1 point, I could just use the named parametrized input and ask for the node name as unique label, which was forcing the Jenkinsfile to run on that node.
  3. parametrized build is node type: name: ENFORCED_NODE, fill the rest as wanted
  4. Use it as follow into the scripted pipeline Jenkinsfiles: 
println("Enforced node: $ENFORCED_NODE")
node(!ENFORCED_NODE ? 'windows && x64' : ENFORCED_NODE)
{
...
}



Reply all
Reply to author
Forward
0 new messages