Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding Jenkins view from Jenkins Job

Tags:

jenkins

We have different Jenkins views for different teams for easier tracking. We have another view 'All' which lists all the jobs in Jenkins.

Now, if I navigate to a job from 'All' views, I can't make out which other view it belongs to thereby making it hard to find responsible team.

Is there a way to find in what all views a particular job shows up?

like image 915
Kumar Avatar asked Sep 14 '25 19:09

Kumar


1 Answers

use the script console to find out:-

def findAllViews(name) {
    def jen = Jenkins.getInstance();        
    def views = jen.getViews()

    for(def view in views) {
        if(view.contains(jen.getItem(name))== true){
            println view.getDisplayName()
        }
    }
}

findAllViews("<jobname>")
like image 61
prvn Avatar answered Sep 17 '25 20:09

prvn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!