Have not found any code examples of how to set upstream projects. Neither does it seems possible with the Jenkins API.
I tried to add directly in config.xml <upstreamProject>myLib++</upstreamProject> <upstreamProject>myLib2++</upstreamProject> But it didn't take. According to both JSON and XML schema both downstreamProject and upstreamProject should be possible. fredag 20. februar 2015 10.42.57 UTC+1 skrev Baptiste Mathus følgende: > > Upstream means a project is kind of above of some others in the build > lifecycle. See it as a waterfall if you like, and water in a waterfall goes > down (more rarely up ;-)). > You also must think of the required building order: to build your final > artifact(s). In your case, you must indeed have built projectA before > projectB since A is a library used by B. So A is indeed upstream in this > regard. > > So yes, if you say in A configuration that B should be started after it, > then B is indeed downstream to A (and A is upstream to B). > > About doing that in Groovy, can't have a look just now, but you have a lot > of examples here: > https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Script+Console should > be a good starting point. > > HTH > > 2015-02-20 9:21 GMT+01:00 Sverre Moe <sverr...@gmail.com <javascript:>>: > >> I want to dynamically set the downstream projects with a Groovy script. >> >> I can get the list of downstream projects, but I cannot find a setter. >> hudson.model.Hudson.instance.items.each { project -> >> if (project.name.equals("myProject")) { >> project.getUpstreamProjects().each { upstreamProject -> >> println("Upstream Project: " + upstreamProject.name) >> } >> } >> } >> >> Is it possible to set this value from a Groovy script? >> >> >> When I create the Post-build Action "Build other projects" and add >> projectB for projectA. Then projectB will list projectA as a upstream >> project (should it not be downstream?). This I find confusing because >> projectA is a library used by projectB. So actually then projectB is a >> upstream project of projectA. >> projectA should list projectB as upstream project, and projectB should >> list projectA as downstream project. >> >> Or perhaps I am getting the meaning of downstream/upstream wrong: >> https://wiki.jenkins-ci.org/display/JENKINS/Terminology >> >> >> The Groovy script building projectA, should it then set downstream or >> upstream when it wants to build projectB after a successful build? >> >> -- >> 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 jenkinsci-use...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jenkinsci-users/2d8fa4bb-4d2f-4434-9940-396d03fe7a1b%40googlegroups.com >> >> <https://groups.google.com/d/msgid/jenkinsci-users/2d8fa4bb-4d2f-4434-9940-396d03fe7a1b%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Baptiste <Batmat> MATHUS - http://batmat.net > Sauvez un arbre, > Mangez un castor ! > -- 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 jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e04d0192-623c-4173-b119-9b74757502ab%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.