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

Add the "Reset ownership" action to Manage Ownership pages

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Major Major
    • ownership-plugin
    • None

      This improvement has been proposed by ibiatiroler. Seems I've missed this feature in my Folder plugin integration TODO list.

      A helpful feature (for us), would be the ownership-inheritance on subordinate jobs in a (cloudbees-) folder. If I overwrite the ownership of a job, there's no possibility to revert to inherited ownership.

      To prevent the need to manually edit the job-configuration, a button - like "Clear Ownership" - would be helpful. For example, to clean ownership (if no longer needed) or in this case, to revert to inherited (folder-) ownership.

          [JENKINS-33447] Add the "Reset ownership" action to Manage Ownership pages

          Phil McArdle added a comment -

          Just hit this today. Looks like there's no workaround except to delete and re-create the job?

          Phil McArdle added a comment - Just hit this today. Looks like there's no workaround except to delete and re-create the job?

          Oleg Nenashev added a comment -

          The workaround is to use System Groovy script, I'd say. But yes, it makes sense to just add this feature

          Oleg Nenashev added a comment - The workaround is to use System Groovy script, I'd say. But yes, it makes sense to just add this feature

          oleg_nenashev do you have an example for the script?

          Martin Cassidy added a comment - oleg_nenashev do you have an example for the script?

          Martin Cassidy added a comment - - edited

          I worked it out. If you want to set on a folder do this

          import org.jenkinsci.plugins.ownership.model.folders.FolderOwnershipHelper
          
          Jenkins.instance.getAllItems(AbstractItem.class).find { item ->
              item.name == 'Name of Folder'
          }.with { result ->
          FolderOwnershipHelper.setOwnership(result, null)
          }
          
          

          Or, if you want to do on a job, do this:

          import com.synopsys.arc.jenkins.plugins.ownership.jobs.JobOwnerHelper
          
          Jenkins.instance.getAllItems(AbstractItem.class).find { item ->
              item.name == 'Name of job'
          }.with { result ->
          JobOwnerHelper.setOwnership(result, null)
          }
          
          

          Martin Cassidy added a comment - - edited I worked it out. If you want to set on a folder do this import org.jenkinsci.plugins.ownership.model.folders.FolderOwnershipHelper Jenkins.instance.getAllItems(AbstractItem.class).find { item -> item.name == 'Name of Folder' }.with { result -> FolderOwnershipHelper.setOwnership(result, null ) } Or, if you want to do on a job, do this: import com.synopsys.arc.jenkins.plugins.ownership.jobs.JobOwnerHelper Jenkins.instance.getAllItems(AbstractItem.class).find { item -> item.name == 'Name of job' }.with { result -> JobOwnerHelper.setOwnership(result, null ) }

            Unassigned Unassigned
            oleg_nenashev Oleg Nenashev
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: