How can I add Jenkins slave nodes via the CLI?

[亡魂溺海] 提交于 2019-12-09 15:46:52

问题


As per the title, in Jenkins how can I add new slave nodes to my build cluster using the CLI, or if there is not a CLI option, is there another scriptable approche that can be used?


回答1:


Many people use the Swarm Plugin to eliminate the need to actually add slaves manually. You would need to script the install of the swarm agent of course, but that should be pretty straight forward.




回答2:


Basic CLI instruction can be found here.

The following CLI command should get the new node configuration XML as stdin:

java -jar jenkins-cli.jar -s [JENKINS_URL] create-node [NewNodeName]

For example, if you want to copy an existing node, you can use:

java -jar jenkins-cli.jar -s [JENKINS_URL] get-node [NodeToCopyFrom] | java -jar jenkins-cli.jar -s [JENKINS_URL] create-node [NewNodeName]


来源:https://stackoverflow.com/questions/12750326/how-can-i-add-jenkins-slave-nodes-via-the-cli

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!