1

I have a pipeline project with a stage in which a unique identifier is retrieved from an external system and set as the job's display name. I know this identifier to be unique for my whole Jenkins installation, so any search by this key should return exactly zero or one job.

Is there any way I can get a job number/URL (or a list of jobs containing only this one job) given its display name and the project name?

EDIT: I want to find jobs from outside of Jenkins, via user interface or REST API, not from a pipeline.

willyjoker
  • 787
  • 6
  • 16

2 Answers2

0

Take look at Jenkins instance. You can retrieve all Jobs, Folders, ... using the getItem(string)/getItems() methods.

yamenk
  • 46,736
  • 10
  • 93
  • 87
  • Sorry, maybe my question wasn't specific enough. I want to find jobs from outside of Jenkins, via user interface or REST API, not from a pipeline. I'm going to edit the question to make this clearer. – willyjoker May 29 '18 at 10:28
0

Hardly ideal, but I ended up using the Script Console to list all the jobs, and then used my browsers text search.

Navigate to http://your-jenkins-instance.org.com/script (or Jenkins → Manage Jenkins → Script Console) and run:

Jenkins.instance.getAllItems(AbstractItem.class).each {
    println(it.fullName)
};
RobM
  • 8,373
  • 3
  • 45
  • 37