This would be fantastic.
My use case is in https://github.com/jenkins-infra/github-reports/ with two parallel blocks:
- One takes seconds and should be executed every few minutes, which is the cron schedule of the full pipeline.
- One takes a few hours to finish
I am planning to combine a timeout for the entire pipeline with a lock around the long running command and inverse precedence, but it would be much nicer to be able to just skip this part of the pipeline if the resource is still locked.
AFAIUI, there's currently no way to check for the state of a lock (to combine with declarative "when" block), or timeout the wait for a lock, specifically.