问题
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