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

AuthorizationMatrixProperty:blocksInheritance isn't supported through DSL for multibranchPipelineJob

      The DSL for the authorization block of the multibranchPipelineJob does not support blocksInheritance. I can go into the job manually once it is created and check the box, but there seems to be no way to set it in the DSL. https://jenkinsci.github.io/job-dsl-plugin/#path/multibranchPipelineJob-authorization Doing this manually defeats the purpose of creating the job through DSL.

          [JENKINS-46865] AuthorizationMatrixProperty:blocksInheritance isn't supported through DSL for multibranchPipelineJob

          Brian Mericle added a comment - - edited

          I was able to get it to work by manipulating the xml through the configure block.

          configure { project ->
            project / 'properties' / 'com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty' {
              blocksInheritance(true)
              permission('hudson.model.Item.Build:authenticated')
              permission('hudson.model.Run.Replay:authenticated')
            }
          }
          
          instead of being able to just do this:
          
          authorization {
             blocksInheritance()
             permission('hudson.model.Item.Build', 'authenticated')
             permission('hudson.model.Run.Replay', 'authenticated')
          }

           

          Brian Mericle added a comment - - edited I was able to get it to work by manipulating the xml through the configure block. configure { project -> project / 'properties' / 'com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty' { blocksInheritance( true )    permission( 'hudson.model.Item.Build:authenticated' ) permission( 'hudson.model.Run.Replay:authenticated' ) } } instead of being able to just do this : authorization { blocksInheritance() permission( 'hudson.model.Item.Build' , 'authenticated' ) permission( 'hudson.model.Run.Replay' , 'authenticated' ) }  

          Daniel Spilker added a comment - blocksInheritance is deprecated, see  https://github.com/jenkinsci/matrix-auth-plugin/blob/matrix-auth-2.0-beta-3/src/main/java/com/cloudbees/hudson/plugins/folder/properties/AuthorizationMatrixProperty.java#L84-L89

            daspilker Daniel Spilker
            bpmericle Brian Mericle
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: