Hi,

the downside of using a ephemeral lock like "${NODE_NAME}-display" is that you
cannot select a node where the resource is actually free.
In the worst case, all your builds that require a display are using the same 
node,
blocking each other while other nodes are still free. This is not a problem in
case the UI tests runtime is short or the the nodes do not have a lot of 
executors.

Alternatively, you can actually lock a resource without a node context. You 
will need to
create a "display" resource for each node in this case. In order to map this
resource to a node, the easiest way would be to use a resource name which 
includes
the agent name.
e.g.
lock(label: 'display', quantity: 1, resourceSelectStrategy: '', variable: 
'LOCKED_RESOURCE') {
  // LOCKED_RESOURCE name should be something like "NODE-display"
  node(env.LOCKED_RESOURCE.replace('-display', '')) {
    ...
  }
}

The downside of this approach is that the agent might not have a free executor
(if there are may jobs which do not require a display).
It depends on your use case which approach is best suitable. 

I do not know of any solution which combines "free resource and free executor",
a combination of "node" and "lock" step would be a nice feature :)
-- 
Christoph

-- 
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/9164404.rMLUfLXkoz%40lmi-nb49.

Reply via email to