gitjenkinspull-requestghprb

Jenkins Pull Request Builder start build old closed pull requests


I am trying to setup Jenkins to trigger build on opening and merging pull requests.

I created a pull request from branch A to B. Then closed it (PR-1). Build started and completed successfully.

Next, I created a pull request from same branch A to same branch B (PR-2). After success build Jenkins started build PR-1 again.

Same if I closed PR-2 and created PR-3. Jenkins will start builds for PR-1 and PR-2 again!

This is my setup for Jenkins job.

enter image description here

Why does Jenkins start to build old closed pull requests?

Thank you.


Solution

  • The JENKINS Multi-Branch Project Plugin, now JENKINS Pipeline Multibranch Plugin should be the one allowing to build only branches with new commits.

    If you don't use that plugin, the refspec refs/remotes/origin/pr/* would select all PR branches.