Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add Jenkins slave nodes via the CLI?

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?

like image 425
rjzii Avatar asked Oct 05 '12 16:10

rjzii


People also ask

How many ways we can connect slave in Jenkins?

There are two ways of authentication for setting up the Linux Jenkins slave agents.


1 Answers

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]
like image 85
Nir Avatar answered Sep 21 '22 22:09

Nir