(this is for quite an old version of Jenkins)
You can access various features in Jenkins through a command-line tool. To get started, download jenkins-cli.jar, and run it as follows:
java -jar jenkins-cli.jar -s http://dockerhost:8080/ help
Note that this will only work if you have access to port 8080 and port
- If you’ve mapped 8080 to port 80, that’s fine too, but you need to be able to connect to the JNLP port for the CLI tool to work. If you get this message
Jul 09, 2015 9:58:16 AM hudson.remoting.SynchronousCommandTransport$ReaderThread run
SEVERE: I/O error in channel Chunked connection to http://dockerhost:8080/cli
java.io.StreamCorruptedException: invalid stream header: 0A0A0A0A
then you don’t have access.
There is some suggestion that -Dhudson.diyChunking=false solves this problem. https://issues.jenkins-ci.org/browse/JENKINS-23223
For reference, here is a list and basic outline of all of the available Jenkins CLI commands that you can use to control Jenkins remotely.
Adds jobs to view.
Builds a job, and optionally waits until its completion.
Cancel the effect of the "quiet-down" command.
Clears the build queue.
Reconnect to a node.
Retrieves console output of a build.
Copies a job.
Creates a new job by reading stdin as a configuration XML file.
Creates a new node by reading stdin as a XML configuration.
Creates a new view by reading stdin as a XML configuration.
Deletes build record(s).
Deletes a job.
Deletes a node.
Disables a job.
Disconnects from a node.
Enables a job.
Dumps the job definition XML to stdout.
Dumps the node definition XML to stdout.
Dumps the view definition XML to stdout.
Executes the specified Groovy script.
Runs an interactive groovy shell.
Lists all the available commands or a detailed description of single command.
Installs a plugin either from a file, an URL, or from update center.
Performs automatic tool installation, and print its location to stdout. Can be only called from inside a build.
Mark the build to keep the build forever.
Dumps the changelog for the specified build(s).
Lists all jobs in a specific view or item group.
Outputs a list of installed plugins.
Saves the current credential to allow future commands to run without explicit credential information.
Deletes the credential stored with the login command.
Reads stdin and sends that out as an e-mail.
Stop using a node for performing builds temporarily, until the next "online-node" command.
Resume using a node for performing builds, to cancel out the earlier "offline-node" command.
Quiet down Jenkins, in preparation for a restart. Don’t start any builds.
Discard all the loaded data in memory and reload everything from file system. Useful when you modified config files directly on disk.
Reloads this job from disk.
Removes jobs from view.
Safely restart Jenkins.
Puts Jenkins into the quiet mode, wait for existing builds to be completed, and then shut down Jenkins.
Outputs the session ID, which changes every time Jenkins restarts.
Sets the description of a build.
Sets the displayName of a build.
Update/set the build parameter of the current build in progress.
Sets the result of the current build. Works only if invoked from within a build.
Set external monitor job result.
Immediately shuts down Jenkins server.
Updates the job definition XML from stdin. The opposite of the get-job command.
Updates the node definition XML from stdin. The opposite of the get-node command.
Updates the view definition XML from stdin. The opposite of the get-view command.
Outputs the current version.
Wait for a node to become offline.
Wait for a node to become online.
Reports your credential and permissions.