Administering CloudBees Jenkins Enterprise 2.x
This guide has been superseded by the CloudBees Core Admin Guide.
This chapter describes how to manage your Operations Center instance.
Jenkins CLI allows you to perform a number of activities on items (i.e. jobs or projects configured in your Operations Center instance), as well as agent- and administration-related activies on Operations Center, all from the command line.
The Jenkins CLI feature’s page (of the Operations Center interface) provides access to the
Jenkins CLI tool (
jenkins-cli.jar), which you can download from this page. This
page also contains detailed information about using this tool and its
To access Jenkins CLI feature’s page and download the CLI tool:
On the Manage Jenkins page, scroll down and click Jenkins CLI.
On the Jenkins CLI page, click the jenkins-cli.jar link to download the CLI tool near the top of this page.
jenkins-cli.jarfile to an appropriate location on your operation system’s file system.
Once you have obtained the Jenkins CLI tool (above), to use the CLI tool:
In a terminal/command prompt (window),
cdto the directory containing the
Enter the command:
java -jar jenkins-cli.jar -s http://operations-center-url:port-number/ command
port-numberis the HTTP port through which Operations Center is accessible.
commandis the Jenkins CLI command you want to execute.
To obtain a list of all options (like
-authfor authentication) that can be passed to the
jenkins-cli.jarcommand itself, enter the command:
java -jar jenkins-cli.jar -h
To list all available Jenkins CLI tool commands, enter the command:
java -jar jenkins-cli.jar -s http://operations-center-url:8888/ help
which outputs a list of commands followed by indented descriptions, like:
add-job-to-view Adds jobs to view. ...
To authenticate your Jenkins user when using the Jenkins CLI tool, specify the
-authoption with your username and password in the format:
For example, enter the command:
java -jar jenkins-cli.jar -auth username:password -s http://operations-center-url:8888/ version
which outputs something like:
Many Jenkins CLI commands require an authenticated Jenkins user with appropriate permissions, such as the Administer permission.
To obtain more information about a particular Jenkins CLI command, specify
helpfollowed by the command itself.
For example, to obtain more information about the
plugin-catalogcommand, enter the command:
java -jar jenkins-cli.jar -auth username:password -s http://operations-center-url:8888/ help plugin-catalog
java -jar jenkins-cli.jar plugin-catalog [VAL] [--delete VAL] [--master VAL] [--push VAL] [--put] [--remove VAL] Plugin Catalog Management VAL : Use a catalog name to get its metadata content. A list of catalog names is returned by calling the command without any parameter. plugin-catalog plugin-catalog my-plugin-catalog --delete VAL : Use this option to delete a catalog from the available list, whose name is passed as parameter. --delete my-plugin-catalog --master VAL : Master item full name (including folders and white spaces, which needs double quotes). Use it in tandem with --push to select the master to push the catalog to. --master my-master --push my-plugin-catalog --push VAL : This option pushes a catalog to a master. Use it in tandem with --master to select the master to apply the catalog to. --master my-master --push my-plugin-catalog --put : Create or update a catalog. It will not be applied to any master, just added to the catalog management. --put < my-plugin-catalog.json --remove VAL : Removes the current catalog from a master. The catalog will not be deleted from the available list. --remove my-master-with-a-plugin-catalog
If you find yourself using the Jenkins CLI tool on a regular basis, configure an alias to save you having to write out the entire command each time.
For instance, assuming you are using on Linux operating systems and/or a Bash  command language environment:
cdto the directory containing the
In your favorite text editor, copy and paste the following into a new "alias" file:
#!/bin/sh java -jar jenkins-cli.jar -auth username:password -s http://operations-center-url:port-number/ "$@"
port-numbervalues as required.
Save the alias file with an appropriate file name (e.g.
Note: This alias file assumes that
jenkins-cli.jaris located in the same directory.
Make the alias file executable (e.g.
chmod a+x jenkins-cli.sh).
Configure the actual alias to your alias file in your appropriate Bash configuration file (i.e
.bashrc), which is usually located in your home directory.
For example, in your favorite text editor, copy and paste the following line into
/path/tovalue as required and save the configuration file.
Reload your Bash configuration by entering the appropriate command (based on the file you edited).
For example, enter the appropriate command:
From now on, regardless of your current directory, you can enter the command:
jenkins-cli, which would actually be:
java -jar jenkins-cli.jar -auth username:password -s http://operations-center-url:port-number/
Therefore, using this alias, the important examples of usage (above) could be simplified to the following:
Listing all available Jenkins CLI tool commands:
Retrieving the version of your Operations Center instance:
Obtaining more information about a specific Jenkins CLI command:
jenkins-cli help plugin-catalog
The remaining Jenkins CLI examples used throughout this guide assume that this alias has been configured.
Online version published by CloudBees, Inc. under the Creative Commons Attribution-ShareAlike 4.0 license.
CloudBees and CloudBees DevOptics are registered trademarks and CloudBees Core, CloudBees CodeShip, CloudBees Jenkins Enterprise, CloudBees Jenkins Platform, CloudBees Jenkins Operations Center and DEV@cloud are trademarks of CloudBees, Inc.
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
The registered trademark Jenkins® is used pursuant to a sublicense from the Jenkins project and Software in the Public Interest, Inc. Read more at www.cloudbees.com/jenkins/about.
Apache, Apache Ant, Apache Maven, Ant and Maven are trademarks of The Apache Software Foundation. Used with permission. No endorsement by The Apache Software Foundation is implied by the use of these marks.
Other names may be trademarks of their respective owners. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this content, and CloudBees was aware of a trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this content, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.