jenkins how to enable checkout lightweight for pipelineJob?

ryan1506 picture ryan1506 · May 1, 2017 · Viewed 8.5k times · Source

Here is my job DSL which creates pipelinejob in which script is taken from scm itself.

pipelineJob ("${jobName}_deploy") {
  description("built by seed")

definition {
     cpsScm {
        scm {
            git {
                remote {
                    url('gitUrl')
                    credentials('user_creds')
                }
              branch('master')
            }
        }
        scriptPath "scripts/pipeline/jenkinsfile_deploy"
    }
 }
 }

I need the lightweight checkout should be checked automatically. enter image description here

any help would be more appreciated. I have so many jobs in which i need to open each and every job and click that check box which is painful.

Answer

daspilker picture daspilker · May 1, 2017

You can use a Configure Block to add any option that is missing in the built-in DSL:

pipelineJob('example') {
  definition {
    cpsScm {
      // ...
    } 
  }
  configure {
     it / definition / lightweight(true)
  }
}