Status: Open (View Workflow)
Jenkins LTS 2.263.4 on RHEL7 with Red Hat OpenJDK 8
For a multibranch pipeline job, we see that branches in the git repo where there is a PR created will be removed when "discard old items" is enabled. This is surprising as the text states:
Jobs for removed SCM heads (i.e. deleted branches) can be removed immediately or kept based on a desired retention strategy.
Also, probably related, we have "Exclude branches that are also files as PRs" selected as Discover branches strategy.
So for a scenario where a PR has been created from branch A, I guess what is happening is that the discover strategy creates a new job for the PR and disables the job for branch A. Then it looks like the discard logic removes the job for branch A. EVen though branch A very much still exists and that is not correct according to the text. Only jobs for branches that have been deleted should be discarded/removed.
I don't know if the problem is in bitbucket-branch-source-plugin or in branch-api.
JENKINS-52406 Unexpected job deletion with "Exclude branches that are also filed as PRs" when opening a PR
This is a duplicate of JENKINS-52406.
This behavior is a problem when GitFlow or similar is used as jobs for branches like 'candidate' are removed when changes are "moved" to the next branch (via a PR).