Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to wait for job to finish when using jenkins-cli.jar to run a slave job?

I have a Jenkins slave ( at localhost:8000 ) and I am executing it ( link ) from a Jenkins Master ( at localhost:8080 ). The basic idea here is to run the remote job and wait until the job is finished.

java -jar jenkins-cli.jar -s http://localhost:8000 build "Test Suite"

Right now, this doesn't wait. I starts the job on the slave and the Jenkins Master says the task is immediately finished although the slave runs for another 30 minutes.

Does anyone know how I can block or check for a signal on the slave to verify it is finished and get the exit status code of the job?

NOTE: My slave test MUST run on the slave because it won't run from Jenkins master, which runs as a service and doesn't allow permissions to start a webbrowser from the test. So, I run the slave in a visible console.

like image 364
djangofan Avatar asked Dec 01 '25 12:12

djangofan


1 Answers

java -jar jenkins-cli.jar -s http://localhost:8000 build "Test Suite" -s

Adding the parameter -s to the build command should trigger the job and return after job is completed

like image 60
LuckyLuke Avatar answered Dec 05 '25 01:12

LuckyLuke



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!