Skip to content
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

Merged
merged 1 commit into from
Jan 27, 2020
Merged

API to get list of Jenkins Jobs #81

merged 1 commit into from
Jan 27, 2020

Conversation

choweiyuan
Copy link
Contributor

@choweiyuan choweiyuan commented Jan 20, 2020

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)

@choweiyuan
Copy link
Contributor Author

Hi, any feedback on this?

@cdancy cdancy added this to the v0.0.23 milestone Jan 27, 2020
@cdancy
Copy link
Owner

cdancy commented Jan 27, 2020

@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!!!

@cdancy cdancy merged commit fc02d29 into cdancy:master Jan 27, 2020
{
"_class" : "hudson.model.FreeStyleProject",
"name" : "Test Project",
"url": "http://localhost:8080/job/username"
Copy link

@blajoie55 blajoie55 Jan 27, 2020

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

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");

Copy link
Contributor Author

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?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure could!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants