Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Using Hudson/Command-line interface"

Line 1: Line 1:
 
This article is a stub. It will be expanded as content is migrated from the [http://wiki.hudson-ci.org/display/HUDSON/Use+Hudson|Use Hudson-CI]Web site.  
 
This article is a stub. It will be expanded as content is migrated from the [http://wiki.hudson-ci.org/display/HUDSON/Use+Hudson|Use Hudson-CI]Web site.  
  
<br>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.
+
<br>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.  
  
== <br>Obtaining CLI ==
+
== <br>Obtaining CLI ==
  
Hudson CLI is distributed inside hudson.war. Download it from http://yourserver.com/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.
+
Hudson CLI is distributed inside hudson.war. Download it from http://yourserver.com/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.  
  
== <br>Running CLI ==
+
== <br>Running CLI ==
  
The general syntax is as follows (the design is similar to tools like svn/git):
+
The general syntax is as follows (the design is similar to tools like svn/git):  
  
 +
<br>
 +
<pre>java -jar hudson-cli.jar [-s HUDSON_URL] command [options...] [arguments...]</pre>
 +
<br> 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.
  
<pre>java -jar hudson-cli.jar [-s HUDSON_URL] command [options...] [arguments...]</pre>
+
== <br>Extending CLI  ==
  
 +
Plugins installed on Hudson server can add custom CLI commands to Hudson. See [http://wiki.hudson-ci.org/display/HUDSON/Writing+CLI+commands Writing CLI commands] for more details.
  
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.
+
== <br>Working with Credentials  ==
  
== <br>Extending CLI ==
+
If your Hudson requires authentication, use --username and --password or --password-file options to specify the credentials. To avoid doing this for every command, you can also use the login CLI command once (with the same credentials parameters), and after that you may use other commands without specifying credentials.
  
Plugins installed on Hudson server can add custom CLI commands to Hudson. See Writing CLI commands for more details.
+
<br>Note that not every authentication type supports these parameters for credentials. Prior to Hudson 1.373, only authentication in Hudson's own database was supported. As of 1.373, LDAP is also supported. If the CLI reports these are invalid parameters, file an issue for your authentication type and ask them to extend AbstractPasswordBasedSecurityRealm instead of directly from SecurityRealm to get support for these parameters.  
 
+
== <br>Working with Credentials ==
+
 
+
If your Hudson requires authentication, use --username and --password or --password-file options to specify the credentials. To avoid doing this for every command, you can also use the login CLI command once (with the same credentials parameters), and after that you may use other commands without specifying credentials.
+
 
+
<br>Note that not every authentication type supports these parameters for credentials. Prior to Hudson 1.373, only authentication in Hudson's own database was supported. As of 1.373, LDAP is also supported. If the CLI reports these are invalid parameters, file an issue for your authentication type and ask them to extend AbstractPasswordBasedSecurityRealm instead of directly from SecurityRealm to get support for these parameters.
+
  
 
Change History: Note that a security hole in CLI commands was fixed in Hudson 1.371, and that CLI login did not work properly for many commands until 1.375.
 
Change History: Note that a security hole in CLI commands was fixed in Hudson 1.371, and that CLI login did not work properly for many commands until 1.375.

Revision as of 19:46, 4 December 2012

This article is a stub. It will be expanded as content is migrated from the Hudson-CIWeb site.


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.


Obtaining CLI

Hudson CLI is distributed inside hudson.war. Download it from http://yourserver.com/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.


Running CLI

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.


Extending CLI

Plugins installed on Hudson server can add custom CLI commands to Hudson. See Writing CLI commands for more details.


Working with Credentials

If your Hudson requires authentication, use --username and --password or --password-file options to specify the credentials. To avoid doing this for every command, you can also use the login CLI command once (with the same credentials parameters), and after that you may use other commands without specifying credentials.


Note that not every authentication type supports these parameters for credentials. Prior to Hudson 1.373, only authentication in Hudson's own database was supported. As of 1.373, LDAP is also supported. If the CLI reports these are invalid parameters, file an issue for your authentication type and ask them to extend AbstractPasswordBasedSecurityRealm instead of directly from SecurityRealm to get support for these parameters.

Change History: Note that a security hole in CLI commands was fixed in Hudson 1.371, and that CLI login did not work properly for many commands until 1.375.

Back to the top