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

"Delete All Disabled Modules" Not visible for project users

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • maven-plugin
    • None
    • Platform: All, OS: All

      The option "Delete All Disabled Modules" is not visible for users with
      Job:Delete privilages when project-based security is enabled. In top of that,
      privilaged user can use the option above, if he will enter manually URL similar
      to this one: http://hudson-installation/job/the-project/deleteAllDisabledModules

      My Hudson version is 1.323

          [JENKINS-4561] "Delete All Disabled Modules" Not visible for project users

          vdupain added a comment -

          same issue with Jenkins 1.532.1 with projects matrix security strategy.

          vdupain added a comment - same issue with Jenkins 1.532.1 with projects matrix security strategy.

          Skylar Sutton added a comment -

          Experiencing this on v1.597

          Skylar Sutton added a comment - Experiencing this on v1.597

          podskalsky added a comment -

          I have this problem at v.1.611

          Is there a running workaround?
          "http://hudson-installation/job/the-project/deleteAllDisabledModules" returns a "HTTP ERROR 404"

          podskalsky added a comment - I have this problem at v.1.611 Is there a running workaround? "http://hudson-installation/job/the-project/deleteAllDisabledModules" returns a "HTTP ERROR 404"

          epikur2412 added a comment -

          We have this problem at V.1.618 and the same error HTTP EROR 404.

          epikur2412 added a comment - We have this problem at V.1.618 and the same error HTTP EROR 404.

          Have you tried "http://hudson-installation/job/the-project/doDeleteAllDisabledModules"?

          The web method is called "doDoDeleteAllDisabledModules", maybe this should be fixed?

          source: https://github.com/jenkinsci/maven-plugin/blob/master/src/main/java/hudson/maven/MavenModuleSet.java#L1237

          Michael Prankl added a comment - Have you tried "http://hudson-installation/job/the-project/doDeleteAllDisabledModules"? The web method is called "doDoDeleteAllDisabledModules", maybe this should be fixed? source: https://github.com/jenkinsci/maven-plugin/blob/master/src/main/java/hudson/maven/MavenModuleSet.java#L1237

          podskalsky added a comment -

          Now there is no error message, but at "http://hudson-installation/job/the-project/build-number" there is still a list of disabled/removed modules

          podskalsky added a comment - Now there is no error message, but at "http://hudson-installation/job/the-project/build-number" there is still a list of disabled/removed modules

          Roberto Lo Giacco added a comment - - edited

          I've tried the Groovy script on the wiki, but even if it completes successfully I still have the disabled modules listed...

          Jenkins version is 1.635, latest available for what I know.

          After a little investigation running the following script highlighted the modules are not marked as disabled: no wonder they are not deleted!

          import hudson.model.*
          import hudson.maven.*
          
          hudson.model.Hudson.instance.items.findAll{job -> job instanceof MavenModuleSet}.each {
          job ->
            job.getModules().each { module -> println(module.name + " found " + module.disabled) }
            job.getDisabledModules(true).each {
              module -> module.delete()
              println(module.name + " deleted")
            } 
            println(job.name + " cleaned")
          }
          

          Roberto Lo Giacco added a comment - - edited I've tried the Groovy script on the wiki , but even if it completes successfully I still have the disabled modules listed... Jenkins version is 1.635, latest available for what I know. After a little investigation running the following script highlighted the modules are not marked as disabled: no wonder they are not deleted! import hudson.model.* import hudson.maven.* hudson.model.Hudson.instance.items.findAll{job -> job instanceof MavenModuleSet}.each { job -> job.getModules().each { module -> println(module.name + " found " + module.disabled) } job.getDisabledModules( true ).each { module -> module.delete() println(module.name + " deleted" ) } println(job.name + " cleaned" ) }

          Since it seems like modules aren't correctly being marked disabled, I have been manually removing them after refactoring with this code:
          (updating the module name by hand based on what no longer exists/didn't run)

          import hudson.model.*
          import hudson.maven.*
          
          hudson.model.Hudson.instance.items.findAll{job -> job instanceof MavenModuleSet}.each {
          
            job ->
            println("Job: " + job.name)  
            job.getModules().each {
              module ->
              print("  " + module.name + " (disabled = " + module.disabled + ")")
              if ("someModuleYouNoLongerWant".equals(module.name)) {
                module.delete() 
                println(" <-- deleted module " + module.name)
              } else {
                println("");
              }    
            }  
          }

          Marcus Russell added a comment - Since it seems like modules aren't correctly being marked disabled, I have been manually removing them after refactoring with this code: (updating the module name by hand based on what no longer exists/didn't run) import hudson.model.* import hudson.maven.* hudson.model.Hudson.instance.items.findAll{job -> job instanceof MavenModuleSet}.each { job -> println( "Job: " + job.name) job.getModules().each { module -> print( " " + module.name + " (disabled = " + module.disabled + ")" ) if ( "someModuleYouNoLongerWant" .equals(module.name)) { module.delete() println( " <-- deleted module " + module.name) } else { println(""); } } }

          Hi guys,
          is there any news about this?
          Thanks
          Cheers
          Davide

          Davide Bolognini added a comment - Hi guys, is there any news about this? Thanks Cheers Davide

          This also affects Jenkins 2.23, see http://stackoverflow.com/questions/39791774/how-to-remove-outdated-maven-artifacts-from-jenkins-maven2-3-job

          There is a little glitch with the script workaround: Archived builds will loose their modules of the build relevant to that build time. Sadly, this seems to be unrecoverable after applying the workaround. Might be tragic for others, for me it is OK atm.

          Richard Zowalla added a comment - This also affects Jenkins 2.23, see http://stackoverflow.com/questions/39791774/how-to-remove-outdated-maven-artifacts-from-jenkins-maven2-3-job There is a little glitch with the script workaround: Archived builds will loose their modules of the build relevant to that build time. Sadly, this seems to be unrecoverable after applying the workaround. Might be tragic for others, for me it is OK atm.

            Unassigned Unassigned
            pkorzuszek pkorzuszek
            Votes:
            27 Vote for this issue
            Watchers:
            34 Start watching this issue

              Created:
              Updated: