jenkinsci / jenkinsci/lockable-resources-plugin

Lock management "by hand": example with early release of a lock

Open
#164 4 comments 1 reaction 0 assignees View on GitHub
documentation good first issue Good for Groovy shared library let it leak when we want that Triage
Dominant language
Java
Stars
99
Forks
205
Avg merge
2d 13h
Merged PRs (30d)
8

Description

Hi,

I've a Jenkins job using pipeline and locks.
My Jenkinsfile looks like that:

```
[...]
lock(resource: 'mylock') {
parallel foo: stuff_for_foo, bar: stuff_for_bar
}
[...]
```

Of course, the lock is kept until foo and bar are both terminated.
I would like to know whether it's possible to release the lock as soon as one there is a failure (in either foo or bar).
Note: I'm aware of the "failFast" option of parallel step. However, I do not want to kill all branches in case of failure. Just to release the lock.

Is it possible to lock and release resources directly using API ? Perhaps using LockableResourceManager.lock(..) and LockableResourceManager.freeResources(...) programmatically ?

Any clue on this topic ?

Many thanks

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.