Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-52406

Unexpected job deletion with "Exclude branches that are also filed as PRs" when opening a PR

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Given:

      Jenkins: Branch scanning with "Discover Branches Strategy" set to "Exclude branches that are also filed as PRs"

      Bitbucket: Automatic merging enabled

      When:

      Merging changes from feature/X into release/Y, where automatic merge from release/Y into master fails.

      Then:

      Bitbucket creates new PR-Z for merging release/Y into master. Jenkins deletes old release/Y job, and creates new PR-Z job. Upon PR closure, PR job is deleted and release/Y job re-created starting from BUILD_NUMBER=1

       

      The underlying issue is the ability to unintentionally delete branch jobs by simply opening a PR. As another example, it is also possible to delete master job by simply requesting master branch to be merged anywhere else.

      I don't see any nice way around this, other than introducing another type of filter that would specify "permanent/sticky" jobs - ones that will never be deleted, only disabled if no longer matched by the normal branch filter. Any thoughts?

        Attachments

          Issue Links

            Activity

            Hide
            ahammar Anders Hammar added a comment -

            We've run into this as well (see JENKINS-65275). However, I don't think that the current behavior is correct as the discard old items text says:

            Jobs for removed SCM heads (i.e. deleted branches) can be removed immediately or kept based on a desired retention strategy.

            But as the branch still exists, it shouldn't be removed.

            Show
            ahammar Anders Hammar added a comment - We've run into this as well (see JENKINS-65275 ). However, I don't think that the current behavior is correct as the discard old items text says: Jobs for removed SCM heads (i.e. deleted branches) can be removed immediately or kept based on a desired retention strategy. But as the branch still exists, it shouldn't be removed.
            Hide
            ahammar Anders Hammar added a comment -

            I'm tracing what happens and I'm trying to understand all the involved parts/plugins. To me it looks like the problem is that bitbucket-branch-source-plugin adds the branches as orphaned. That makes the DefaultOrphanedItemStrategy then removed them.
            There should be some other way of disabling those branch jobs, without marking them as orphaned.

            Show
            ahammar Anders Hammar added a comment - I'm tracing what happens and I'm trying to understand all the involved parts/plugins. To me it looks like the problem is that bitbucket-branch-source-plugin adds the branches as orphaned. That makes the DefaultOrphanedItemStrategy then removed them. There should be some other way of disabling those branch jobs, without marking them as orphaned.
            Hide
            ahammar Anders Hammar added a comment -

            I tested with github-branch-source-plugin and it's the same behavior with that plugin and a github.org repo. So I added it to components.

            Show
            ahammar Anders Hammar added a comment - I tested with github-branch-source-plugin and it's the same behavior with that plugin and a github.org repo. So I added it to components.

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              sbgerdp Gert Palok
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated: