I have a github multibranch pipeline, in declarative format. It is configured to trigger on pushes to pull request branches (ie, branches which are included in pull requests to a target branch, say
If a new commit comes in before the execution of a previous commit is finished, this will trigger a concurrent build of the pipeline. I want to maintain this behaviour, but need to know if there is a new pipeline running in one of the stages.
Ie I want a groovy script step like this pseudo code:
if (build_number + 1) is_currently_running do one thing else do something else
Is there any way to ask Jenkins if build n+1 is running?