简体   繁体   English

如何在 jenkins 管道脚本上禁用轻量级结账?

[英]How to disable lightweight checkout on jenkins pipeline script?

As for as I understood the Lightweight Checkout is enabled by default on Jenkins.据我了解,Jenkins 上默认启用Lightweight Checkout 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. Cloudbees 解决了JENKINS-33273 - 优化 Jenkinsfile 加载和分支检测,它引入/改变了行为。

Their blog has a post, Why is my multibranch project cloning the whole repository on the master?他们的博客有一篇文章, 为什么我的多分支项目要在 master 上克隆整个存储库? and a link for How to add Java arguments to Jenkins?以及如何向 Jenkins 添加 Java 参数的链接 . .

See also Jenkins Features Controlled with System Properties .另请参阅由系统属性控制的 Jenkins 功能 Essentially, it's a parameter in the arguments to launch Jenkins itself.本质上,它是启动 Jenkins 本身的参数中的一个参数。 Make sure it's a JENKINS_ARGS and not JAVA_OPTIONS .确保它是JENKINS_ARGS而不是JAVA_OPTIONS

JENKINS-45686 is Open to provide a UI option to manage this configurationy other means. JENKINS-45686开放以提供 UI 选项来管理此配置或其他方式。

Additional pipeline info: Pipeline-as-code with Multibranch Workflows in Jenkins其他管道信息: 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更多选择: 这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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