Search code examples
jenkinsgroovyjenkins-job-dsl

Jenkins Job DSL: unknown return statement


some days ago I bumped into a code snippet used to override the default configuration of the Jenkins plugin "GitHub SCM Source" (unknown author):

Closure configOverride(String repo, int id, String cred) {
return {    
    it / sources / 'data' / 'jenkins.branch.BranchSource' << {
        source(class: 'org.jenkinsci.plugins.github_branch_source.GitHubSCMSource') {    
            id(id)    
            scanCredentialsId(cred)    
            checkoutCredentialsId('SAME')    
            repoOwner('owner')    
            repository(repo) 
            includes('*')    
            buildOriginBranch('true')    
            buildOriginBranchWithPR('true')    
            buildOriginPRMerge('false')    
            buildOriginPRHead('false')    
            buildForkPRMerge('true')    
            buildForkPRHead('false')    
         }
      }
   }
}

All it's good except that I can't understand the following line:

it / sources / 'data' / 'jenkins.branch.BranchSource' << { ... }

I tried to find some explanation about the use of '/' in groovy but no luck. Maybe I don't know what exactly to search.

Could someone help me please with a link to the docs or a short explanation.


Solution

  • This code snippet is used in Jenkins DSL for the "multibranchPipelineJob". The closure configOverride is used to generate an XML object which replace the default configuration in config.xml on the following path "sources/data/jenkins.branch.BranchSource".

    enter image description here