jenkinsci / jenkinsci/lockable-resources-plugin

manually unlock "globally locked" resource early

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

Description

### What feature do you want to see added?

In my main Jenkins pipeline I am currently locking 2 resources via the pipeline's `options`, like so:

`lock(variable: 'my-web-app', extra: [[resource: 'main-app'],[resource: 'health-check']])`

Then i have another Jenkinsfile in a subfolder, just for a health-check of this web-app.

My main pipeline looks like this:
`LockResources (see lock command above!) -> SendSlackMessage -> Install -> Build -> Deploy -> HealthCheck -> SendSlackMessage`

In other words, my main app pipeline also triggers the HealthCheck pipeline in one of the stages - and waits for it to finish. But since the health check is blocked i had the idea of locking 2 resources:
One that blocks all health-checks, one that blocks all other builds for this web app (it is a multi branch pipeline, i don't want another branch to run in parallel).
Somehow i thought i could manually unlock the `health-check` resource right before the HealthCheck stage starts, but it seems there is no way to do so.
This would help me start the health-check as part of the main app pipeline without the need of also releasing the `main-app` resource, because if i did the latter, my queued build for other branches for the main app would start in the meantime, which is not what i want.

Long story short, i would like to see the possibility to manually unlock a resource, even if it was locked during the global `options` of a pipeline.

### Upstream changes

_No response_

### Are you interested in contributing this feature?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing how Jenkins pipeline options acquire globally locked resources and how the lock command handles resource ownership. Define and validate behavior for manually unlocking the health-check resource while retaining the main-app lock, including what happens to queued builds and nested pipelines.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.