如何使用CLI使Jenkins主节点脱机? [英] How to take Jenkins master node offline using CLI?
问题描述
当我同步我们的开发数据库时,我已经手动将主节点(而且只有)节点离线,以避免一系列错误的测试失败。我有一个脚本,做完整的数据库导入,并希望自动化的节点维护。
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.
如何标记主节点暂时离线使用命令行接口JAR?
How can I mark the master node temporarily offline using the command-line interface JAR?
- 我写了一个简单的Bash脚本来执行Jenkins任务。
-
我可以使用该脚本进行身份验证。
- 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
code> offline-node 或 online-node
来识别主节点。帮助说明我可以省略master的节点名,但这不起作用。
However, I cannot get offline-node
or online-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:
java -jar jenkins-cli.jar quiet-down
这将停止任何新构建的执行。您可以使用
This will stop any new builds from executing. You can use
java -jar jenkins-cli.jar cancel-quiet-down
使Jenkins重新上线;此时它将运行在离线时排队的任何版本。
to put Jenkins back on line; at this point it will run any builds that were queued up while it was offline.
这篇关于如何使用CLI使Jenkins主节点脱机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!