-
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
API to get list of Jenkins Jobs #81
Conversation
Hi, any feedback on this? |
@choweiyuan apologies as I've been busy with other projects. Code looks good and sane. I'll merge this and kick a point release. Thanks for the PR!!! |
{ | ||
"_class" : "hudson.model.FreeStyleProject", | ||
"name" : "Test Project", | ||
"url": "http://localhost:8080/job/username" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noticed PR got merged and feature ticket closed already but one part of the Job that Jenkins returns that we missed here is the color
json attiribute, e.g.
"jobs": [ { "_class": "org.jenkinsci.plugins.workflow.job.WorkflowJob", "name": "myPipelineJobBranchName", "url": "https://myJenkinsHost.com/job/folder1/job/folder2/job/myPipelineJob/job/myPipelineJobBranchName/", "color": "blue" },
it's an attribute that could be used to determine if the job is currently running or not. e.g. the enumerated values I've discovered for this attribute are:
- blue: completed/non-running, latest build passed
- blue_anime: running, latest build passed
- red: completed/non-running, latest build failed
- red_anime: running, latest build failed
- notbuilt: currently not running, pipeline branch has never run
- notbuilt_anime: currently running, pipeline branch has never run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, my bad, I was mixing up the terms "pipeline" and "job". I see what I need now when passing job name in (from the new JobList endpoint)
client.api().jobsApi().jobInfo("folder1/folder2/myPipeline", "pipelineBranchJobName");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noticed PR got merged and feature ticket closed already but one part of the Job that Jenkins returns that we missed here is the
color
json attiribute, e.g.
"jobs": [ { "_class": "org.jenkinsci.plugins.workflow.job.WorkflowJob", "name": "myPipelineJobBranchName", "url": "https://myJenkinsHost.com/job/folder1/job/folder2/job/myPipelineJob/job/myPipelineJobBranchName/", "color": "blue" },
it's an attribute that could be used to determine if the job is currently running or not. e.g. the enumerated values I've discovered for this attribute are:
- blue: completed/non-running, latest build passed
- blue_anime: running, latest build passed
- red: completed/non-running, latest build failed
- red_anime: running, latest build failed
- notbuilt: currently not running, pipeline branch has never run
- notbuilt_anime: currently running, pipeline branch has never run
I think you have a point that we could add "color" to the "Jobs" object, so that I can get an overview of the status of pipeline/Job when I query JobList, without making another API call.
There's also a "disabled" for disabled jobs
"color": "disabled"
Could be another PR I suppose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure could!!!
Explain the details for making this change: What existing problem does the Pull Request solve? Why is this feature beneficial?
This solves #79 , where you can get a list of Jobs (whether its root or in folders)