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

"Delete All Disabled Modules" Not visible for project users

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • maven-plugin
    • None
    • Platform: All, OS: All

    Description

      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

      Attachments

        Issue Links

          Activity

            podskalsky 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 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
            rlogiacco 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")
            }
            
            rlogiacco 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("");
                }    
              }  
            }
            marcoose 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

            dbolognini 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.

            rzo1 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.

            People

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

              Dates

                Created:
                Updated: