5
votes

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

1 Answers

13
votes

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   
            }
        }
    }
}