4

when run the command like

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

the result is :

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 does it not find the 'testjob' ?

Sleepwom
  • 227
  • 6
  • 15

2 Answers2

4

I had the same behavior and found out that allowing anonymous read access in the global security section fixed it. It is still mandatory to specify --username and --password to access the resource.

allow anonymous read access

iMil
  • 816
  • 9
  • 16
1

Just for future searchs:

As described here:

If you use the API token, what 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
Community
  • 1
  • 1