Starting 1.302, Hudson has a built-in CLI client that allows you to access Hudson from a script or from your shell. This is convenient for automation of routine tasks, bulk updates, trouble diagnosis, and so on.
Hudson CLI is distributed inside
hudson.war. Download it from
/jnlpJars/hudson-cli.jar . In theory, the CLI jar is dependent on the version of Hudson, but in practice, we expect to be able to retain compatibility between different versions of Hudson.
The general syntax is as follows (the design is similar to tools like svn/git):
java -jar hudson-cli.jar [-s HUDSON_URL] command [options...] [arguments...]
HUDSON_URL can be specified via the environment variable
$HUDSON_URL. The 'help' command will give you the list of the available commands, which depends on the server you are talking to.
Plugins installed on Hudson server can add custom CLI commands to Hudson. See writing CLI commands for more details.
Hudson CLI does not support credentials at the moment. If you have secured your Hudson installation (login with username and password) you just get a
java.io.IOException: Server returned HTTP response code: 403 for URL: http://HUDSON_SERVER/cli
Adding this feature is on the list.