Hi,

  (For full disclosure, the following question was first asked on SO 
<http://stackoverflow.com/questions/39101559/how-to-nest-dependent-jenkins-pipelines-to-execute-on-a-single-machine>
 
a few weeks ago.)

  We are a company of few developers, which will try to implement 
Continuous Integration for our codebase. It is constituted of half a dozen 
repositories, with dependencies between them. Ideally, each repository will 
be built when commits are pushed on origin (for predefined branches).
 As far as we understand, this means that we create a separate Pipeline for 
each of our own repo. But because of dependencies, some of the Pipelines 
downstream would somehow need to first build the upstream Pipelines they 
depend upon.

---

  We could take an example: let's assume *libA* is a dependency of *libB* 
which is a dependency of *clientC*.

*libA pipeline*

*libA* has external dependencies, so we can write the pipeline 
*build-A-pipe* to build it : one of the stages being responsible for 
gathering such external dependencies, and a subsequent stage actually 
invokes the build command.
This pipeline is directly invoked when a new commit to *libA* is pushed on 
origin.

*libB pipeline*

*libB* would ideally be built within a separate pipeline, called 
*build-B-pipe*. During the stage to gather *libB* dependencies, we have to 
build *libA*. It seems to us that the recommended way to achieve such 
behaviour is to call 
build job: 'build-A-pipe'
within the pipeline that builds *libB.* (This way we respect the DRY 
principle: reuse the *build-A-pipe*, which already describes all steps and 
details required to successfully build libA.)

*clientC pipeline*

Now, if we wanted to build *clientC*, we would follow a similar procedure. 
There would be a call
build job: 'build-B-pipe'
in the dependencies gathering stage of the pipeline building *clientC*. The 
issue is that it results in *nested calls to the build command*, which 
deadlocks the single machine :
* at the top level calling build job: 'build-B-pipe' schedules 
*build-B-pipe*, and starts it on the master machine (our only "execution 
node").
* *build-B-pipe* then calls build job: 'build-A-pipe', which is then 
scheduled but cannot start, as the only "execution node" is already taken.

---

What would be the preferred way to approach this problem, to make this 
inherently sequential build work within Jenkins ?

Thank you for reading,

-- 
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/86875d2e-0864-45c3-9144-d0dc52b57dcb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to