Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Clean up a bit and make sure the examples actually use the correct syntax.

Jenkins has a built-in command line client interface that allows you to access Jenkins from a script or from your shell. This is convenient for automation of routine tasks, bulk updates, trouble diagnosis, and so on.

Obtaining CLI

This interface is accessed via the Jenkins CLI client, which is distributed inside jenkins.war as a jar file. See http://yourserver.com/cli for where to download the CLI jar file. a Java JAR file distributed with Jenkins.

Obtaining the CLI client

You can download the JAR file for the client from the URL "/cli" on your Jenkins server, e.g. https://jenkins.example.com/cli.
In theory, the CLI jar JAR is dependent on the version of Jenkins, but in practice, we expect to be able to retain compatibility between different versions of Jenkins. In case of problems, just re-download the latest JAR from your Jenkins server.

Running a CLI command

The general syntax is as follows (the design is similar to tools like svn/git):

...

The list of the available commands depends on the server you are talking to. Visit httphttps://yourserverjenkins.example.com/cli or use 'help' command to list them all:

No Format
java -jar jenkins-cli.jar -s yourserver.https://jenkins.example.com help [command]

Detailed description More detailed help for individiual commands can be obtained providing command name or visiting command page in Jenkins UI.

...

found by adding the command name after help (e.g. help build).
The same information is available via the web UI, by clicking on a command name on the Jenkins CLI page.

Extending the CLI

Plugins installed on Jenkins server can add custom CLI commands. See writing CLI commands for more details.

...