I have been manually taking the master (and only) node offline whenever I sync our development database to avoid a bunch of false test failures. I have a script that does the full DB import and would like to automate the node maintenance as well.
How can I mark the master node temporarily offline using the command-line interface JAR?
- I wrote a simple Bash script to execute Jenkins tasks.
I can authenticate using that script.
$ jenkins who-am-i Authenticated as: david Authorities: david authenticated
However, I cannot get
offline-node
oronline-node
to recognize the master node. The help states that I can omit the node name for "master", but that doesn't work.$ jenkins offline-node Argument "NAME" is required java -jar jenkins-cli.jar online-node NAME Stop using a node for performing builds temporarily, until the next "online-node" command. NAME : Slave name, or empty string for master
It seems to be looking specifically for a slave, but I need to take the master's executor offline.
$ jenkins offline-node master No such slave "master" exists. Did you mean "null"?
If you only have one build executor on the master and no standalone build nodes, use this command instead:
This will stop any new builds from executing. You can use
to put Jenkins back on line; at this point it will run any builds that were queued up while it was offline.
It's not exactly intuitive, but the Jenkins documentation is correct. If you want to specify the master node for
offline-node
oronline-node
, use the empty string:That said, you should probably use @gareth_bowles answer anyways in case you add slaves in the future.