Getting Downstream Dependencies for Folder

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Getting Downstream Dependencies for Folder

Sverre Moe-2
Each projects in the folder have configured Dependencies.

I can access them with project.getTransitiveDownstreamProjects() or getTransitiveUpstreamProjects() for each project.
However I need to build all projects in order, based on their dependencies. Calling this for each projects will only get me the list of downstream projects for each project.

When standing on the folder I can see all the projects and its dependencies from "Dependency Graph" in the menu.

However how can I get this programmatically? How does Dependency Graph do it?
The Folder class does not have the methods for accessing the Dependencies.

    def jenkinsInstance = jenkins.model.Jenkins.getInstance()
    def project = jenkinsInstance.getItemByFullName("folder/project")
    def downstreamProjects = project.getDownstreamProjects()

If I could get it as a orderd list, that would work. Then I could build all projects in the right order, so that the next project has its dependencies when building.

An ordered Tree would be much better. Then I could build all projects on same level in parallel.

A much bigger job for me, is if I need to loop through all projects in the folder, get its Upstream and/or Downstream dependencies. Then when I have them all, calculate the ordered list, or structured tree. I have been trying to wrap my head around how to write such an algorithm.
Dependency Graph seems to have such algorithms, so I was hoping to save some time using it if possible.

You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit