jenkins如何为pipelineJob启用轻型签出?

jenkins如何为pipelineJob启用轻型签出?,jenkins,jenkins-pipeline,jenkins-job-dsl,Jenkins,Jenkins Pipeline,Jenkins Job Dsl,这里是我的作业DSL,它创建pipelinejob,其中脚本取自scm本身 pipelineJob ("${jobName}_deploy") { description("built by seed") definition { cpsScm { scm { git { remote { url('gitUrl') creden

这里是我的作业DSL,它创建pipelinejob,其中脚本取自scm本身

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

definition {
     cpsScm {
        scm {
            git {
                remote {
                    url('gitUrl')
                    credentials('user_creds')
                }
              branch('master')
            }
        }
        scriptPath "scripts/pipeline/jenkinsfile_deploy"
    }
 }
 }
我需要轻量结帐应该自动检查。

任何帮助都将不胜感激。我有这么多的工作,我需要打开每一个工作,并点击复选框,这是痛苦的

您可以使用添加内置DSL中缺少的任何选项:

pipelineJob('example') {
  definition {
    cpsScm {
      // ...
    } 
  }
  configure {
     it / definition / lightweight(true)
  }
}
我尝试使用轻量级(),但它对我不起作用

我解决这个问题的方法是使用cpsScmFlowDefinition()如下所示:

pipelineJob('example') {
  definition {
    cpsScmFlowDefinition {
      scm {
        gitSCM {
          userRemoteConfigs {
            userRemoteConfig {
              credentialsId('')
              name('')
              refspec('')
              url('')
            }
          }
          branches {
            branchSpec {
              name('')
            }
          }
          extensions {
            cleanBeforeCheckout()
            localBranch {
              localBranch('')
            }
          }
          doGenerateSubmoduleConfigurations(false)
          browser {
            gitWeb {
              repoUrl('')
            }
          }
          gitTool('')
        }
      }
      scriptPath('')
      lightweight(true)
    }
  }
}
根据维基,这必须是这样的

pipelineJob('job-name') {

  description('''
Job description
''')

  definition {
    cpsScm {
      lightweight(true)
      scm {
        git {
          remote {
            url('git@github.com:arulrajnet/attila.git')
            credentials('CREDENTIAL_ID')
          }
          branches('*/master')
        }
      }
      scriptPath('build.groovy')
    }
  }
}

@达斯派克,非常感谢你。这是强大的。我喜欢DSL的工作。