Table of Contents
- Jenkins CLI over SSH
1.1 Enable SSH Endpoint
1.2 List Available Commands
1.3 Trigger a Job via SSH - Jenkins CLI Client (jenkins-cli.jar)
- Jenkins REST API
3.1 Install a Plugin
3.2 Authentication Methods - References
Jenkins CLI over SSH
Jenkins includes a built-in CLI accessible over SSH. This approach avoids additional HTTP calls and works even behind strict firewalls.Enable SSH Endpoint
By default, SSH is disabled. You can reveal the SSH endpoint with:Make sure your SSH key is correctly formatted (RFC4716 or OpenSSH) before pasting into Jenkins.
List Available Commands
Once SSH is configured, list all CLI commands:Trigger a Job via SSH
Build a job namedhello-kodekloud and stream console output:
Jenkins CLI Client (jenkins-cli.jar)
If SSH isn’t an option, download thejenkins-cli.jar from your Jenkins master:
Jenkins REST API
The Jenkins REST API provides HTTP endpoints for jobs, nodes, plugins, and more.Install a Plugin
Usecurl to install or update plugins:
Authentication Methods
Jenkins supports multiple authentication schemes. Use API tokens to avoid exposing plain passwords.Never commit credentials or API tokens into version control. Use environment variables or secret managers.