timja / jenkins-gh-issues-poc-06-18

0 stars 0 forks source link

[JENKINS-43346] Getting "No Such Job" Error while accessing the jobs through jenkins-cli.jar #3984

Open timja opened 7 years ago

timja commented 7 years ago

Currently we are using Cloudbees Jenkins Enterprise [Jenkins ver. 2.7.20.0.2 (CloudBees Jenkins Enterprise 2.7.20.0.2-fixed) in our Project.

We used to update Build Description automatically by parsing log using Python and used jenkins-cli.jar [version=2.7.20]  for updating description in each builds using "set-build-description" parameter.

Jenkins folder structure will be like Project Code–> Projects.

Eg: TGM0 is root folder and inside that we have Projects as sub folders as shown below

list-jobs --> list all root folders as shown below,

But when we try to execute the below command we're getting error as "no job found"

java -jar C:\apps\jenkins-cli.jar -s http://jenkins.fg.rbc.com/ set-build-description DAILY_PERFORMANCE 62 = --username hramkuma --password ** 0<"F:\Jenkins\workspace\TGM0\DAILY_PERFORMANCE\results\Performance_Daily\builddesc.txt" 

But the job "Daily Performance" exists in TGM0 folder,

Kindly provide a solution for this.


Originally reported by ramkumar_haridass, imported from: Getting "No Such Job" Error while accessing the jobs through jenkins-cli.jar
  • assignee: fbelzunc
  • status: Open
  • priority: Major
  • resolution: Unresolved
  • imported: 2022/01/10
timja commented 7 years ago

oleg_nenashev:

From what I see your job is located in the folder, hence this folder should be specified in the request. Try specifying "TGM0/DAILY_PERFORMANCE" in the command line.

timja commented 7 years ago

ramkumar_haridass:

I already tried that, but still, same error,

timja commented 7 years ago

ramkumar_haridass:

I tried removing Root folder name from url as well,

timja commented 7 years ago

oleg_nenashev:

Likely just a lack of permissions due to whatever reason. Since you use CloudBees Jenkins Enterprise, please contact their support

timja commented 7 years ago

fbelzunc:

I am able to reproduce this problem in 2.60.1.1

timja commented 7 years ago

oleg_nenashev:

fbelzunc assigned it to you then. If it is a CloudBees support ticket, please follow up in this vendor's support channels

timja commented 7 years ago

fbelzunc:

As per documentation:

Authentication is preferably via SSH keypair. A login command and --username / --password command (note: not global) options are also available; these are discouraged since they cannot work with a non-password-based security realm, certain command arguments will not be properly parsed if anonymous users lack overall or job read access, and saving human-chosen passwords for use in scripts is considered insecure.

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
timja commented 6 years ago

overflow:

https://stackoverflow.com/questions/30066657/jenkins-cant-found-the-job-when-build-job-why

it is working for me.

timja commented 6 years ago

rzhou:

If you use the console option, it works for freestyle jobs but not pipeline.