Groovy Postbuild Plugin And Cloudbees Folders Plugin

Issue

Using the Groovy Postbuild Plugin in Jenkins Environment that utilizes Folders 

Environment

CloudBees Jenkins Enterprise

Resolution

When jobs are arranged using folders they are accessible via Groovy Postbuild scripts as shown in the examples below.

Accessing a specific job that is located in folder_name/folder_name/folder_name.

job1 = hudson.model.Hudson.instance.getItem("folder_name").getItem("folder_name").getItem("folder_name")

Searching for an item inside of a folder.

jenkins.model.Jenkins.instance.getItemByFullName("folder_name/folder_name/folder_name");

The following link has more information about the methods that are available to use:

http://javadoc.jenkins-ci.org/jenkins/model/Jenkins.html

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.