I’m working on a slave reboot task that would take a node offline, wait for any running jobs to complete and then restart the computer. Once restarted and reconnected I need to bring the node back online which is where I’d like to have a job that is triggered by a node startup (using this plugin) and will run a groovy script via the "Execute Groovy Script" build step:
jenkins = Hudson.instance
def node = jenkins.nodes.getNode("node name").getComputer()
The two issues I have are:
1. The plugin does not appear to provide the name of the node that triggered the job – a solution would be for the plugin to provide an environment variable that I could read within the groovy script.
2. The "Restricted node Label" to does not support wild cards – it would be nice if there was some way I could say “run this for all nodes”, possibly by putting a * in the node label field although a work around for this would be to give all nodes a label of ONLINE which would give the desired result as long as it doesn’t break the existing label the slaves have
The first issue is definitely the most desired, the second nice to have.