Open timja opened 9 years ago
Perhaps I am doing it wrong, but a projects upstream and downstream projects does not get set when adding a trigger
import jenkins.triggers.ReverseBuildTrigger import hudson.model.Result def jenkinsInstance = jenkins.model.Jenkins.getInstance() def project = jenkinsInstance.getItem("myLib2") def trigger = new ReverseBuildTrigger("myLib1", Result.SUCCESS) project.addTrigger(trigger)
project.getUpstreamProjects().size() == 0 project.getDownstreamProjects().size() == 0
It's asynchronous so it could take a bit to set the relation.
It took over 20 minutes for the upstream project to appear on the project main page.
Still, I created this issue because it would be great if one could set the upstream and downstream projects with the API, but it only has getters for them.
This isn't how the API works. Check out how hudson.model.DependencyGraph works.
Set a projects upstream or downstream projects with Jenkins API.
AbstractProject.addUpstreamProject(AbstractProject))
AbstractProject.setUpstreamProjects(List
AbstractProject.addDownstreamProject(AbstractProject))
AbstractProject.setDownstreamProjects(List
Setting upstream projects is not possible without creating a build trigger.
Originally reported by djviking, imported from: Jenkins API: Set upstream and downstream projects