Jenkins can't find a job when building a job, why?

when running a command like

java -jar jenkins-cli.jar -s http://192.168.9.199:8080 list-jobs --username admin --password 'admin'

      

result:

testjob

      

but run

java -jar jenkins-cli.jar -s http://192.168.9.199:8080 build testjob --username admin --password 'admin'

No such job 'testjob'

      

why doesn't it find "testjob"?

+3


source to share


3 answers


I had the same behavior and found out that allowing anonymous read access in the global security section is fixed. You still need to specify --username

it --password

to access the resource.



allow anonymous read access

+1


source


I tried exactly your command from my local jenkins and it works great. So I don't think there is anything wrong with your commands. I am trying to help, but I currently have no further idea.



0


source


For future searches only:

As described here :

If you are using an API token, which is the recommendation here, use the command below and it will work:

java -jar jenkins-cli.jar -s http://jenkins.example:8080/ -auth admin:2793b5e799cac2ec343245e2384f06fc build testing

      

0


source







All Articles