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

            mattmoor Matthew Moore created issue -
            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.
            hrmpw Patrick Wolf made changes -
            Field Original Value New Value
            Labels 2.0
            jglick Jesse Glick made changes -
            Priority Minor [ 4 ] Critical [ 2 ]
            jglick Jesse Glick made changes -
            Assignee Matthew Moore [ mattmoor ] Jesse Glick [ jglick ]
            jglick Jesse Glick made changes -
            Labels 2.0 2.0-planned
            jglick Jesse Glick made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            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.
            jglick Jesse Glick made changes -
            Link This issue is related to JENKINS-32783 [ JENKINS-32783 ]
            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.
            jglick Jesse Glick made changes -
            Component/s cloudbees-folder-plugin [ 18137 ]
            Component/s branch-api-plugin [ 18621 ]
            Labels 2.0-planned 2.0-planned multibranch
            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.
            jglick Jesse Glick made changes -
            Remote Link This issue links to "PR 44 (Web Link)" [ 14081 ]
            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.
            scm_issue_link SCM/JIRA link daemon made changes -
            Status In Progress [ 3 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            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.
            jglick Jesse Glick made changes -
            Resolution Fixed [ 1 ]
            Status Resolved [ 5 ] Reopened [ 4 ]
            jglick Jesse Glick made changes -
            Status Reopened [ 4 ] Open [ 1 ]
            jglick Jesse Glick made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "PR 46 (Web Link)" [ 14113 ]
            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.
            scm_issue_link SCM/JIRA link daemon made changes -
            Status In Progress [ 3 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            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.
            jglick Jesse Glick made changes -
            Resolution Fixed [ 1 ]
            Status Resolved [ 5 ] Reopened [ 4 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "PR 53 (Web Link)" [ 14142 ]
            jglick Jesse Glick made changes -
            Status Reopened [ 4 ] Open [ 1 ]
            jglick Jesse Glick made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            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.
            scm_issue_link SCM/JIRA link daemon made changes -
            Status In Progress [ 3 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            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
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 159152 ] JNJira + In-Review [ 196004 ]

              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: