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

0 stars 0 forks source link

[JENKINS-35148] CLI list-jobs is not listing multibranch sub projects #3188

Open timja opened 8 years ago

timja commented 8 years ago

The CLI list-jobs is not listing sub projects of an multibranch project.


Originally reported by mheinzerling, imported from: CLI list-jobs is not listing multibranch sub projects
  • status: Reopened
  • priority: Major
  • resolution: Unresolved
  • imported: 2022/01/10
timja commented 8 years ago

danielbeck:

What job type are you specifically referring to?

timja commented 8 years ago

mheinzerling:

danielbeck, the jobs of a Multibranch Pipeline. If I ask for all jobs I get the folder of the Multibranch Pipeline, but not it's content.

timja commented 8 years ago

danielbeck:

It's not recursive. Are you saying list-jobs NameOfTheMultibranchFolder does not work?

timja commented 6 years ago

danielbeck:

No response to comment asking for clarification in a year.

timja commented 3 years ago

gdj:

danielbeck This is correct, you're unable to get the configured multibranch workflow branches

$ java -jar ~/jenkins-cli/jenkins-cli.jar -auth @~/jenkins-cli/auth.txt -s "http://localhost:8080/" -webSocket list-jobs | grep SSL_daily
SSL_daily
$ java -jar ~/jenkins-cli/jenkins-cli.jar -auth @~/jenkins-cli/auth.txt -s "http://localhost:8080/" -webSocket list-jobs SSL_daily

ERROR: No view or item group with the given name 'SSL_daily' found.
timja commented 3 years ago

danielbeck:

gdj Could you provide the "full name" of a branch job in your environment so the output makes sense to users not knowing it?

timja commented 3 years ago

gdj:

SSL_daily is the multibranch workflow project, which configures the branches from git. The URL for the full job looks like so: http://example.com:8090/job/SSL_daily/job/master/

If you try to build just SSL_daily it'll fail.

$ java -jar ~/jenkins-cli/jenkins-cli.jar -auth @~/jenkins-cli/auth.txt -s "http://localhost:8080/" -webSocket build SSL_daily

ERROR: No such job 'SSL_daily'; perhaps you meant 'SSL_daily/master'?

You also have to specify the branch for build to work.

$ java -jar ~/jenkins-cli/jenkins-cli.jar -auth @~/jenkins-cli/auth.txt -s "http://localhost:8080/" -webSocket ~proci/bin/jenkins-cli build SSL_daily/master
$ echo $?
0

timja commented 3 years ago

danielbeck:

Interesting. I see where this is coming from, ComputedFolder isn't a ModifiableTopLevelItemGroup and that is what ListJobsCommand expects. There's no TopLevelItemGroup or similar more applicable interface, unfortunately.

timja commented 3 years ago

gdj:

Does that mean that can't easily be fixed?

The branches are available from the script console.

hudson.model.Hudson.instance.getItemByFullName('SSL_daily').getAllJobs()
Result: [org.jenkinsci.plugins.workflow.job.WorkflowJob@56d136ee[SSL_daily/master]]