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

DeadBranchStrategy should avoid deleting projects with active jobs

    Details

    • Similar Issues:

      Description

      If you create a DefaultDeadBranchStrategy with 0 days to live, and 0 builds to keep, you can easily create a situation where a branch can be deleted while a job on it is active.

      When branches are re-indexed, the project will be deleted and interrupt active jobs.

      I believe a more appropriate course would be to wait for a branch indexing to run while the project is inactive, a state which once entered it shouldn't leave since the branch was deleted (unless it were recreated).

        Attachments

          Issue Links

            Activity

            Hide
            jglick Jesse Glick added a comment -

            Probably suffices to just skip deletion while there is a build running.

            Show
            jglick Jesse Glick added a comment - Probably suffices to just skip deletion while there is a build running.
            Hide
            jglick Jesse Glick added a comment -

            JENKINS-32783 tracks some problems related to deleting a project with builds running. Solvable, but anyway I think the friendlier course is to just skip this branch project this time around. It will still be removed on the next branch indexing, assuming the build has finished by then and the branch truly remains gone.

            Show
            jglick Jesse Glick added a comment - JENKINS-32783 tracks some problems related to deleting a project with builds running. Solvable, but anyway I think the friendlier course is to just skip this branch project this time around. It will still be removed on the next branch indexing, assuming the build has finished by then and the branch truly remains gone.
            Hide
            jglick Jesse Glick added a comment -

            The most natural point of implementation seems to be in DefaultOrphanedItemStrategy, which is already paying attention to build history.

            Show
            jglick Jesse Glick added a comment - The most natural point of implementation seems to be in DefaultOrphanedItemStrategy , which is already paying attention to build history.
            Hide
            jglick Jesse Glick added a comment -

            A related issue is builds which are marked to not be deleted, for example because someone was actively debugging a failure: these should also block deletion of the owning branch project.

            Show
            jglick Jesse Glick added a comment - A related issue is builds which are marked to not be deleted, for example because someone was actively debugging a failure: these should also block deletion of the owning branch project.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/java/com/cloudbees/hudson/plugins/folder/computed/DefaultOrphanedItemStrategy.java
            src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java
            http://jenkins-ci.org/commit/cloudbees-folder-plugin/e0388acd0b66cefd429928f7f6d8e1d6d48f42f9
            Log:
            [FIXED JENKINS-25240] Do not delete branch projects with running builds, or builds marked to keep.
            Follows the approximate logic in LogRotator.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/com/cloudbees/hudson/plugins/folder/computed/DefaultOrphanedItemStrategy.java src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java http://jenkins-ci.org/commit/cloudbees-folder-plugin/e0388acd0b66cefd429928f7f6d8e1d6d48f42f9 Log: [FIXED JENKINS-25240] Do not delete branch projects with running builds, or builds marked to keep. Follows the approximate logic in LogRotator.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/java/com/cloudbees/hudson/plugins/folder/computed/DefaultOrphanedItemStrategy.java
            src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java
            http://jenkins-ci.org/commit/cloudbees-folder-plugin/39ad52053cf5f4a65192ac9338d515113a0694a6
            Log:
            Merge pull request #44 from jglick/orphaned-job-running-build-JENKINS-25240

            JENKINS-25240 Do not delete branch projects with running builds

            Compare: https://github.com/jenkinsci/cloudbees-folder-plugin/compare/8df445af2675...39ad52053cf5

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/com/cloudbees/hudson/plugins/folder/computed/DefaultOrphanedItemStrategy.java src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java http://jenkins-ci.org/commit/cloudbees-folder-plugin/39ad52053cf5f4a65192ac9338d515113a0694a6 Log: Merge pull request #44 from jglick/orphaned-job-running-build- JENKINS-25240 JENKINS-25240 Do not delete branch projects with running builds Compare: https://github.com/jenkinsci/cloudbees-folder-plugin/compare/8df445af2675...39ad52053cf5
            Hide
            jglick Jesse Glick added a comment -

            The fix did not work in the case of branch projects with running builds whose parents were being orphaned from an organization folder.

            Show
            jglick Jesse Glick added a comment - The fix did not work in the case of branch projects with running builds whose parents were being orphaned from an organization folder.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/java/com/cloudbees/hudson/plugins/folder/computed/DefaultOrphanedItemStrategy.java
            src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java
            http://jenkins-ci.org/commit/cloudbees-folder-plugin/be15a91e154cf3bed6a09a8a3252078e586155d3
            Log:
            [FIXED JENKINS-25240] Need to consider even nested jobs for purposes of checking running builds.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/com/cloudbees/hudson/plugins/folder/computed/DefaultOrphanedItemStrategy.java src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java http://jenkins-ci.org/commit/cloudbees-folder-plugin/be15a91e154cf3bed6a09a8a3252078e586155d3 Log: [FIXED JENKINS-25240] Need to consider even nested jobs for purposes of checking running builds.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/java/com/cloudbees/hudson/plugins/folder/computed/DefaultOrphanedItemStrategy.java
            src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java
            http://jenkins-ci.org/commit/cloudbees-folder-plugin/3857169b4daf828aedaeb4b0e37baa0fba94e560
            Log:
            Merge pull request #46 from jglick/JENKINS-25240-redux

            JENKINS-25240 Need to consider even nested jobs for purposes of checking running builds

            Compare: https://github.com/jenkinsci/cloudbees-folder-plugin/compare/585f91aa2ac9...3857169b4daf

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/com/cloudbees/hudson/plugins/folder/computed/DefaultOrphanedItemStrategy.java src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java http://jenkins-ci.org/commit/cloudbees-folder-plugin/3857169b4daf828aedaeb4b0e37baa0fba94e560 Log: Merge pull request #46 from jglick/ JENKINS-25240 -redux JENKINS-25240 Need to consider even nested jobs for purposes of checking running builds Compare: https://github.com/jenkinsci/cloudbees-folder-plugin/compare/585f91aa2ac9...3857169b4daf
            Hide
            jglick Jesse Glick added a comment -

            There was another unhandled case.

            Show
            jglick Jesse Glick added a comment - There was another unhandled case.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/java/com/cloudbees/hudson/plugins/folder/computed/DefaultOrphanedItemStrategy.java
            src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java
            http://jenkins-ci.org/commit/cloudbees-folder-plugin/f144e9013c677de08711fd53b654f5fec526889e
            Log:
            [FIXED JENKINS-25240] Neglected to break out of a loop when removing an item from a list, resulting in an IllegalStateException.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/com/cloudbees/hudson/plugins/folder/computed/DefaultOrphanedItemStrategy.java src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java http://jenkins-ci.org/commit/cloudbees-folder-plugin/f144e9013c677de08711fd53b654f5fec526889e Log: [FIXED JENKINS-25240] Neglected to break out of a loop when removing an item from a list, resulting in an IllegalStateException.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/java/com/cloudbees/hudson/plugins/folder/computed/DefaultOrphanedItemStrategy.java
            src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java
            http://jenkins-ci.org/commit/cloudbees-folder-plugin/6f2daf46be91856202328760e3759d539698b756
            Log:
            Merge pull request #53 from jglick/JENKINS-25240-reredux

            JENKINS-25240 IllegalStateException from a list iterator

            Compare: https://github.com/jenkinsci/cloudbees-folder-plugin/compare/eee3b1b0bfc0...6f2daf46be91

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/com/cloudbees/hudson/plugins/folder/computed/DefaultOrphanedItemStrategy.java src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java http://jenkins-ci.org/commit/cloudbees-folder-plugin/6f2daf46be91856202328760e3759d539698b756 Log: Merge pull request #53 from jglick/ JENKINS-25240 -reredux JENKINS-25240 IllegalStateException from a list iterator Compare: https://github.com/jenkinsci/cloudbees-folder-plugin/compare/eee3b1b0bfc0...6f2daf46be91

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                mattmoor Matthew Moore
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: