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

Jobs not removed when branch gets removed in case of orphaned item strategy set

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • None
    • Jenkins 2.33
      Ubuntu 14.04 LTS

      If there is "Orphaned Item Strategy" configured with the non-zero "Max # of old items to keep" the jobs for removed branches are not removed.

      When branch indexing occurs I have the following log for the removed branch

      ...
      Looking up <team_name>/<repo_name> for pull requests
      Evaluating orphaned items in <repo_name> » build-multi
      Will not remove DMC-1234-test as it is only #1 in the list
      ...
      

      It would be great to have an option (which is "on" by default) whether it is necessary to remove builds for deleted branches or not.
      I suppose it's more expected behavior that the job for the removed branch will be deleted than will be kept until an expected number of builds occurs (that may never happen as the branch is already deleted)

      I have the orphan strategy setup like the following

      ... with Max # of old items to keep set to an empty string.
      Then while reindexing Jenkins says

      ...
      Looking up <team_name>/<repo_name> for pull requests
      Evaluating orphaned items in <repo_name> » build-multi
      Will not remove DMC-1234-test as it is only #1 in the list
      ...
      

      If I set Max # of old items to keep to zero directly

      ... then old items for non-existent branches are removed successfully

      ...
      Looking up <team_name>/<repo_name> for pull requests
      Evaluating orphaned items in <repo_name> » build-multi
      Will remove DMC-1234-test as it is only #1 in the list
      ...
      

      There are some details in this issue: JENKINS-35173

            amuniz Antonio Muñiz
            szhem Sergey Zhemzhitsky
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: