简体   繁体   中英

How to disable lightweight checkout on jenkins pipeline script?

As for as I understood the Lightweight Checkout is enabled by default on Jenkins. Does someone know how to disable it?

How found the pieces of information below"

About Multibranch Pipeline support
Multibranch Pipelines support lightweight checkout since JENKINS-33273.
It is activated by default.
There is a kill switch to deactivate it.
Simply add org.jenkinsci.plugins.workflow.multibranch.USE_HEAVYWEIGHT_CHECKOUT=true to Jenkins arguments

But I don't know how to add to Jenkins.

Cloudbees addressed JENKINS-33273 - Optimize Jenkinsfile loading and branch detection, which introduced/changed the behaviour.

Their blog has a post, Why is my multibranch project cloning the whole repository on the master? and a link for How to add Java arguments to Jenkins? .

See also Jenkins Features Controlled with System Properties . Essentially, it's a parameter in the arguments to launch Jenkins itself. Make sure it's a JENKINS_ARGS and not JAVA_OPTIONS .

JENKINS-45686 is Open to provide a UI option to manage this configurationy other means.

Additional pipeline info: Pipeline-as-code with Multibranch Workflows in Jenkins

pipelineJob("pipeline with branch parameter") {
        stringParam {
            name('BRANCH')
            defaultValue('master')
            description('Branch name')
            trim(true)
        }
    }
    definition {
        cpsScm {
            scm {
                git {
                    remote {
                        github("username/myrepo", "https")
                        credentials("jenkins-gh")
                    }
                    branch("*/\${BRANCH}")
                }
            }
            scriptPath("jenkins/file/path")
            lightweight(lightweight=false)
        }
    }
    disabled(false)
}

more options: here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM