jenkinsci / jenkinsci/lockable-resources-plugin

Sort requested resources by user defined groovy script

Open
#669 0 comments 0 reactions 0 assignees View on GitHub
approved
Dominant language
Java
Stars
99
Forks
205
Avg merge
2d 13h
Merged PRs (30d)
8

Description

### 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_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.