JENKINS_URL can be specified via the environment variable
$JENKINS_URL. This environment variable is automatically set when Jenkins fork a process during builds, which allows you to use Jenkins CLI from inside the build without explicitly configuring the URL.
For details on authentication methods ("
-auth" parameter or
JENKINS_API_TOKEN environment variables), see Jenkins CLI > Client connection modes > HTTP connection mode.
The list of the available commands depends on the server you are talking to. Visit
https://jenkins.example.com/cli or use '
help' command to list them all:
- Jenkins listens on a TCP/IP port configured under "TCP port for JNLP agents" in the system configuration page. This single port is used for both agents and CLI.
- Jenkins advertises this port number as a special HTTP header (if disabled, this header will not be present).)
- CLI client will make an HTTP request to the top page of Jenkins, looking for this header.
- If the header is found and the TCP/IP port is identified, the client will attempt to connect to this URL.
- If that fails (for example, if there's a reverse proxy and Jenkins runs on a different host, or if a firewall blocks access to this TCP/IP port), or if the header is not found, it will fall back to the communication mechanism that uses two simultaenous HTTP connections.