How to wait for build to finish when triggering from CLI?

Article ID:228392127
1 minute readKnowledge base

Issue

How to wait for build to finish when triggering via Jenkins CLI (jenkins-cli.jar)?

Environment

  • CloudBees Jenkins Enterprise

  • Jenkins

  • Jenkins CLI

Resolution

Add the -s parameter to the build command:

java -jar jenkins-cli.jar -s https://localhost:8000 build "my-job" -s

Replace https://localhost:8000 with your Jenkins URL and my-job with your job name.

Authentication is not included in this example for brevity.

This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by CloudBees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.