Skip to content

Add resource event listener extension point and Groovy callback#1015

Open
mPokornyETM wants to merge 7 commits intomasterfrom
feature/340-resource-event-listener
Open

Add resource event listener extension point and Groovy callback#1015
mPokornyETM wants to merge 7 commits intomasterfrom
feature/340-resource-event-listener

Conversation

@mPokornyETM
Copy link
Copy Markdown
Contributor

@mPokornyETM mPokornyETM commented Apr 19, 2026

Summary

Introduces a ResourceEventListener extension point that fires events when lockable resources change state. A built-in GroovyCallbackListener evaluates a user-configured Groovy script on each event.

New features

  • ResourceEventListener (ExtensionPoint): Java extension point for plugins to receive resource state change notifications
  • GroovyCallbackListener: Built-in listener that evaluates a global Groovy callback script per event
  • ResourceInfo: Immutable, sandbox-safe snapshot of a resource passed to Groovy scripts
  • Async execution (default) with configurable timeout
  • Events: LOCKED, UNLOCKED, RESERVED, UNRESERVED, STOLEN, REASSIGNED, RESET, RECYCLED, QUEUED

Configuration

Navigate to Manage Jenkins → System → Lockable Resources Manager → Resource Event Callback to configure the Groovy script, async mode, and timeout.

Binding variables in Groovy callback

Variable Type Description
\
esource\ \ResourceInfo\ Read-only snapshot of the affected resource
\event\ \String\ Event name (e.g. \LOCKED, \RESERVED)
\userName\ \String\ User who triggered the action
\�uildName\ \String\ Build display name

Testing

15 automated tests covering all event types, extension point registration, ResourceInfo snapshot correctness, Groovy callback execution (sync/async), and failure resilience.

Documentation

Added resource-event-notifications.md with usage examples.

Fixes #340
Fixes #676

Introduce a ResourceEventListener extension point that fires events when
lockable resources change state (locked, unlocked, reserved, stolen, etc.).

A built-in GroovyCallbackListener evaluates a user-configured Groovy script
on each event, with async execution by default and configurable timeout.
A read-only ResourceInfo snapshot is passed to scripts for safe sandbox access.

Includes 15 automated tests and documentation examples.

Fixes #340
@mPokornyETM mPokornyETM requested a review from a team as a code owner April 19, 2026 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Jenkins events on lock actions Inform user when assigned resource change state

1 participant