-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Listing Jenkins Jobs (within a folder) #79
Comments
@choweiyuan did you want to send in a PR for this? In the past I've purposefully shied away from doing this as the API itself returns raw json which in itself is extremely complicated instead of a more targeted API with very specific endpoints. However we can give something a go and try to just target this very specific use-case if you're willing to put something together. |
I see, thanks for your explanation. I'll give it a go |
+1 for this feature. My company is switching from Bamboo to Jenkins. We have a handful of java and groovy apps that rely on hitting REST api to get list of pipeline jobs, their current latest build status for each branch of the pipeline, etc. When researching how to use Jenkins REST api I found this github project, but unfortunately it's missing some very key features for us, such as given a folder endpoint/URL, return the list of jobs. E.g. in Postman can hit the Jenkins REST api with a URL like so: https://myJenkinsHost.com/job/folder1/job/folder2/job/myPipeline/api/json?pretty=true |
@choweiyuan @blajoie55 And special thanks to @choweiyuan for knocking this out! |
Thanks for this addition! Just a note for anyone else who is looking. You can list all jobs by passing an empty String to the new method: JobList jobList = jobs.jobList(""); Future enhancement could be to have the input for |
@l3ender feel free to send in a PR with the proposed change/fix. |
Expected Behavior
I'd like to use an API to list me jobs that are available within a folder (or root folder).
Current Behavior
I can't see any API within Jenkins-rest that supports this behaviour
Context
The use case is to allow user to select job based on the list of available jobs (whether it's inside a folder or not), rather than knowing the job name beforehand.
Sample API URL:
{jenkins-url}/api/json?tree=jobs[name]&pretty=true - will list you all jobs name on root folder
{jenkins-url}/job/{foldername}/api/json?tree=jobs[name]&pretty=true - will list you all jobs name within {foldername}
The text was updated successfully, but these errors were encountered: