Reserve ext resource in workflow

19 views
Skip to first unread message

Dave Lawrence

unread,
Nov 11, 2015, 11:18:09 AM11/11/15
to Jenkins Users
I'm trying to figure out how I can reserve an external resource in a workflow which would cause other workflows(or it's jobs) who compete for that resource to queue.

This is the scenario:
 - I have workflows that need to run tests against a specific piece of hardware. These tests are multiple Freestyle jobs. 
 - Any one workflow will consists of: software build, hardware Setup, test(s) execution, hardware Teardown. 
 - While a workflow is using hardware platform "A" for example, from Setup through Teardown, no other jobs can use "A".
 - I cannot constrain the number of workflows or tests
 - These workflows are run asynchronously and will compete for the same hardware to run tests against.

I need a workflow to "reserve" a piece of hardware and that reservation needs to survive across multiple jobs (within the workflow). I've tried using "Throttle Concurrent Jobs" within the test jobs but the throttle is immediately released once an individual job is completed. The workflow describes the set of tests and therefore the scope of the reservation.

I thought about running a parallel job that would use Throttle Concurrent Jobs, but then I need a way to communicate to that job about when to end or be able to stop it.

Any thoughts?

Thanks,

Dave

Jens Wilke

unread,
Nov 12, 2015, 12:37:21 PM11/12/15
to Jenkins Users
Dave,

nice question.

There are several plugins that can help you: Locks and Latches (outdated), Build Blocker, Exclusion.

However, in our setups we tend to use separate Slaves/Nodes for constrained hardware. This plays well with the Jenkins scheduling and it is transparent.
The separate Jenkins slave is just used as a control gate to the resource, and can run on the master itself.

Cheers,

Jens
Reply all
Reply to author
Forward
0 new messages