jenkinsci / lockable-resources-plugin

Lock resources against concurrent use
https://plugins.jenkins.io/lockable-resources
MIT License
87 stars 185 forks source link

Sort requested resources by user defined groovy script #669

Open mPokornyETM opened 5 months ago

mPokornyETM commented 5 months ago

What feature do you want to see added?

When the resources are requested by label, it is possible to pick resources randomly or just by index, when there are added.

It will be great to provide a feature to sort the resources by user defined groovy script.

ex: name | labels resource1 | nwcard:1 nwcard:2 resource2 | nwcard:1

def sortScript = { if (resource.hasLabel('nwcard:2') return 0; else return 1; }
lock(label : 'nwcard:1', quantity : 1, sortBy : sortScript) { echo 'I am locked') }

Upstream changes

No response

Are you interested in contributing this feature?

No response