jenkinsci/lockable-resources-plugin

Ability to lock one resource from list, not by label

Closed this issue · 2 comments

What feature do you want to see added?

There is corner case when we have automated lockable resource creation with YAML configuration. When resource is removed from this configuration, it is still present in lockable resources configuration. So it still can be locked by label.
It would be really nice if you will add ability to lock resources from specific list of names or ability to specify include/exclude expressions to lock step.

Upstream changes

No response

I am not sure if I understand it corectly, but I think this shall helps you

https://github.com/jenkinsci/lockable-resources-plugin#multiple-resource-lock
and you can exclude resource by label like

// has labelA but NOT labelB
lock(label: 'labelA && !labelB', variable : 'someVar') {
echo 'acquired by: ' + env.someVar;
}

@mPokornyETM thanks! I will try it shortly. If it works, it is exactly what I need.