12

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?

2 Answers 2

19

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]
10

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.