-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for advanced label filters when locking #309
Conversation
Lock can now be selected with a combination of all/any/none filters. The pre-existing label is still supported to require a single specific label.
...n/java/org/jenkins/plugins/lockableresources/queue/LockableResourcesQueueTaskDispatcher.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jenkins/plugins/lockableresources/LockableResourcesManager.java
Show resolved
Hide resolved
Bumps [plugin](https://github.com/jenkinsci/plugin-pom) from 4.33 to 4.37. - [Release notes](https://github.com/jenkinsci/plugin-pom/releases) - [Changelog](https://github.com/jenkinsci/plugin-pom/blob/master/CHANGELOG.md) - [Commits](jenkinsci/plugin-pom@plugin-4.33...plugin-4.37) --- updated-dependencies: - dependency-name: org.jenkins-ci.plugins:plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [plugin](https://github.com/jenkinsci/plugin-pom) from 4.37 to 4.38. - [Release notes](https://github.com/jenkinsci/plugin-pom/releases) - [Changelog](https://github.com/jenkinsci/plugin-pom/blob/master/CHANGELOG.md) - [Commits](jenkinsci/plugin-pom@plugin-4.37...plugin-4.38) --- updated-dependencies: - dependency-name: org.jenkins-ci.plugins:plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
Should have been label == null || label.isEmpty() - using StringUtils.isBlank for improved readability
Lock can now be selected with a combination of all/any/none filters. The pre-existing label is still supported to require a single specific label.
Removed irrelavant comment, added back deprecated getResourcesWithLabel for backward compatibility
Thanks for the review, I added back the |
I love this addition ! Any chance to see it merged soon? |
Any update on this? this feature will be super useful for our use case |
will be handled in #428 |
would this feature also support allocating a resource to a specific node (eg by name reference) , then checking as one of the conditions that such node is online? Eg image 6 nodes each having a printer, for which some printer_NN resource is defined with label 'printer'. How to lock a printer resource from an online node? |
There are few similar PRs and no one is completed (for some historical reason). At the moment it is hard to merge master in this branches. PS: Strange for some reason is the Groovy expression visible only in free-style jobs. This shall be fixed. Please help me and create new issue here in GitHub (thx) PS2: currently I am thinking about new global-lockable-resources-shared-library which extends core functionality in groovy. Because of historical reason, are many things no more possible here (without big effort, by refactoring this plugin). This can be loaded by you, in your Jenkins instance and used for free. BUT it need time and we shall specified which content shall be done there. Currently nobody will contribute (there)[https://github.com//discussions/445]. Maybe you will find some time and help me (us). It does not mean to contribute on coding. Describe an idea in new issues helps too ;-) |
@mPokornyETM : I have created a new issue #455 describing my idea of the use-case. I would be even willing to help on the coding part, but am an absolute newbie on plugin development (and Java ;-) ) |
Any help is welcome. Contributing is not only about Java. |
Finding resources based on labels is nice, but the current implementation is very limiting. We would need to be able to filter out some resources.
Typically when implementing filters, my experience is that a trio of all/any/none is sufficient for most use cases, so instead of just adding exclusion I added all three.
anyOfLabels
will consider resources if they have at least one matching labelallOfLabels
will consider resources if all labels matchnoneOfLabels
will consider resources unless any of their label matchesThe previously used
label
is still supported and considered a "simple" case of finding a resource using a single label. In implementation, this value is merged into theallOfLabels
down the road.The three new filters are placed under an "Advanced" group in the jelly.
I hope this is useful to others as well. Happy to make any changes necessary to get this PR in.