Have Jenkins projects as Multibranch pipeline:
org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject
extends jenkins.branch.MultiBranchProject
extends com.cloudbees.hudson.plugins.folder.computed.ComputedFolder
extends com.cloudbees.hudson.plugins.folder.AbstractFolder
extends hudson.model.AbstractItem
I need to get the latest build job in my Groovy build script. Jenkins
Javadoc is available online, but other APIs are not. It makes it difficult
to know which methods I have access to.
WorkflowMultiBranch does not extend AbstractProject which has easy access
methods such getLastBuild() or getLastCompletedBuild(). Not having access
to the Javadoc for Cloudbees or Branch-API I am unsure if such a method
exists for either MultiBranchProject, ComputedFolder or AbstractFolder.
Go searching through the source code for access methods is tedious and time
consuming.
MultiBranchProject:
https://github.com/jenkinsci/branch-api-plugin/blob/master/src/main/java/jenkins/branch/MultiBranchProject.java
ComputedFolder:
https://github.com/jenkinsci/cloudbees-folder-plugin/blob/master/src/main/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolder.java
AbstractFolder:
https://github.com/jenkinsci/cloudbees-folder-plugin/blob/master/src/main/java/com/cloudbees/hudson/plugins/folder/AbstractFolder.java
Anyway that is what I was forced to do with no access to such Javadocs.
Could not find any such easy access methods as those in hudson.model.Job or
hudson.model.AbstractProject.
Can get all jobs from AbstractItem
public abstract Collection<? extends Job> getAllJobs()
And pick the first in the list (if the first is the latest build).
--
You received this message because you are subscribed to the Google Groups
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-dev/997498f0-7f23-4b56-932b-203f1976de4d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.