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

Implement pathRestriction to job DSL extension context

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Major Major
    • job-dsl-plugin
    • None

      pathRestriction is not implemented in extension GitContext. So when we want to use this we have to use configure block. It is fine if you are not in sandbox mode.

       

      pipelineJob("jobname") {
      //..
          definition {
              cpsScm {
                  scm {
                      git {
                          //..
                          extensions {
                              relativeTargetDirectory("myRootPath") // works because implemented 
                              pathRestriction('includedPaths', 'excludedPaths') // not implemented in the dsl plugin
                          }
                          // code below doesn't allowed in sandbox mode
                          configure { node ->
                              node / 'extensions' / 'hudson.plugins.git.extensions.impl.PathRestriction' {
                                  excludedRegions 'excludedPaths'
                              }
                          }
                      }
                  }
              }
          }
      }
      
      
      

       

      Can't we add pathRestriction to the extensions GitContext.

      Here is how relativeTargetDirectory implemented. 

            daspilker Daniel Spilker
            onuralp Onuralp Taner
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: