Stop Jenkins checking out Git URL in a Pipeline stage

你离开我真会死。 提交于 2020-02-28 05:54:17

问题


I have setup a Jenkins Declarative Pipeline job, and it pulls the Jenkinsfile from Git. I have a stage that is running on a another node (selected by a label), but it is trying to checkout the Jenkinsfile from Git too.

How can I stop this behavior? This particular slave is on the other side of a firewall and I can only reach it by SSH.


回答1:


You can use the skipDefaultCheckout() in the options block. This will disable the checkout of the SCM on any node in any stage, so you will have to do a checkout scm step in the other stages manually.

pipeline {
    agent any
    options { skipDefaultCheckout() }
    stages{
        stage('first stage') {
            steps {
                checkout scm   
            }
        }
    }
}


来源:https://stackoverflow.com/questions/46475786/stop-jenkins-checking-out-git-url-in-a-pipeline-stage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!