Reputation: 8376
We are implementing Continuous Integration of several repositories using Jenkins.
For this example, let's assume libA is a dependency of libB which is a dependency of clientC.
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 dependencies, and a subsequent stage actually invoking the build command.
libB would ideally be built within a separate pipeline, called build-B-pipe. In the stage to gather libB dependencies, we have to build libA. It seems to us that the best way to achieve such thing is to call build job: 'build-A-pipe'
within the pipeline that builds libB (this way it allows to reuse the build-A-pipe, which already describes all steps required to successfully build libA).
Now, if we wanted to build clientC, we would follow a similar procedure. Thus, there would be a call like 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 :
build job: 'build-B-pipe'
schedules build-B-pipe, and starts it on the master machine (our only "execution node").build job: 'build-A-pipe'
, which is then scheduled but cannot start, as the only "execution node" is already taken.How should we approach this problem to make this inherently sequential build work within Jenkins ?
Upvotes: 2
Views: 1551
Reputation: 90
The issue is that it results in nested calls to the build command, which deadlocks the single machine
By deadlock, do you mean that the slave agent which is responsible for executing the nested pipeline is running out of resources? Or is the node which is responsible for running these nested pipelines running out of executors?
If the machine responsible for running pipelines is exhausting all resources (assuming that this is the only responsibility of this machine), then your pipeline is too complex and should delegate more to other nodes/agents.
If the node is running out of executors, you can increase those in the node config.
Upvotes: 1