jenkins-cli build on Cloudbees: "no such job"
Asked Answered
D

3

11

I need to remotely trigger a Jenkins build hosted on CloudBees. Right now, I'm attempting to use jenkins-cli to no avail. Right now I am authenticating using a SSH key pair.

When I do:

$ java -jar jenkins-cli.jar -s https://... list-jobs All

I can see all the jobs, including the one I want to build. But when I do:

$ java -jar jenkins-cli.jar -s https://... build job1
No such job 'job1'

I've read about a workaround that involves adding permissions to the anonymous role. Even if I add every single permission to it, I get the same error.

If it helps, I'm using Jenkins 1.532.1.3. Thanks.

Devote answered 6/2, 2014 at 17:15 Comment(1)
Is your job inside a folder or at top level?Extravagance
Y
8

Today I ran into same problem and found the solution. The response 'no such job' comes when there is actually no such job or you don't have enough access to do requested operation. Even when you have the access for requested operation and you are sending credentials with --username and --password arguments it still not works. Only solution I found was to use ssh authentication. So register your computer's ssh key to your jenkins and everything works fine. To register ssh key go to http://[yourjenkinsserver]/user/[username]/configure

Yasmeen answered 5/3, 2015 at 16:8 Comment(3)
It worked for me with -i [PRIVATE_KEY] option. Looks like it is an open Jenkins issue: JENKINS-12543Ungainly
Can you provide me the steps?Addition
+1 Thank you for this, helped me with version 1.625.18.5. Issue 12543 still unresolved. To use SSH for authenticated user: create key (important: blank passphrase); paste public key into user config; paste private key into new Jenkins credential for the user (again, blank passphrase).Nguyetni
V
3

I ran into the same error but managed to make it work by providing read permission in 'job' for anonymous user.

Viguerie answered 7/10, 2014 at 9:10 Comment(0)
S
0

I encountered the same issue today on v1.621-1.1 while trying through a non-admin user which I named as 'vikas027'. In order to fix this I ticked all checkboxes under 'Job' column for user 'vikas027' and ticked 'Discover' and 'Read' (also under 'Job') for 'Anonymous' user. These settings are in http://<IP>:<port>/configureSecurity. Hope this helps someone.

Sharpwitted answered 29/7, 2015 at 17:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.