Retrieving a list of Pipeline jobs

58 views
Skip to first unread message

Emory Penney

unread,
Jan 5, 2017, 3:45:47 PM1/5/17
to Jenkins Developers
Hi,

Sorry for the noob question, I'm sure this is answered somewhere in the documentation I'm just completely unable to find it...

I've noticed that

Jenkins.getInstance().jenkinsInstance.getAllItems(AbstractProject.class);

doesn't seem to get me a list of Pipelines jobs.  I'm sure I need to use a different class but I'm unclear which one.  Or is there a different preferred method for getting a list of pipeline jobs?

Thanks in advance for your help.

Jesse Glick

unread,
Jan 5, 2017, 5:19:54 PM1/5/17
to Jenkins Dev
On Thu, Jan 5, 2017 at 3:45 PM, Emory Penney <treads...@gmail.com> wrote:
> I've noticed that
>
> Jenkins.getInstance().jenkinsInstance.getAllItems(AbstractProject.class);
>
> doesn't seem to get me a list of Pipelines jobs. I'm sure I need to use a
> different class but I'm unclear which one.

`Job.class` to get anything, or `WorkflowJob.class` to get Pipeline only.

https://github.com/jenkinsci/pipeline-plugin/blob/master/DEVGUIDE.md#historical-background

Currently there is not an official (i.e., API plugin) marker interface
for `Job` subtypes that would correspond to the
`FlowExecutionOwner.Executable` marker interface for `Run` subtypes,
though I have been thinking about adding one as it would be useful on
occasion.

Emory Penney

unread,
Jan 5, 2017, 7:08:01 PM1/5/17
to jenkin...@googlegroups.com
Thanks for the suggestions!  Also, the historical background makes this much clearer.  Neither of those classes have getTrigger() implemented, any tips for how to get build triggers from Job.class or WorkflowJob.class?


--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/PKbpT-84ie4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr1V88O%3DB%2BotL%2BZNRutpGyTfjbdBQnUvyrjykxafJp%2BY_g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Jesse Glick

unread,
Jan 6, 2017, 9:24:30 AM1/6/17
to Jenkins Dev
On Thu, Jan 5, 2017 at 7:07 PM, Emory Penney <treads...@gmail.com> wrote:
> Neither of those classes have getTrigger() implemented, any tips
> for how to get build triggers from Job.class or WorkflowJob.class?

`ParameterizedJobMixIn.ParameterizedJob.getTriggers()`

Emory Penney

unread,
Jan 6, 2017, 1:12:19 PM1/6/17
to Jenkins Developers
Perfect that got me exactly what I needed, thanks!
Reply all
Reply to author
Forward
0 new messages