jenkinsci / lockable-resources-plugin

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

manually unlock "globally locked" resource early #638

Open maks-io opened 5 months ago

maks-io commented 5 months ago

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