How can disbale poll scm for specific checkout in Jenkinsfile?

92 Views Asked by At

I have two repositories that one of them is cloned in another Jenkinsfile. For example imagine we have two repositories one of them is called child

child Jenkinsfile:

pipeline {
    agent any
    environment {
        repo_credentials_id = 'XXXXXXXXXXXXXXXXXXXXXXXX'
    }
    stages {
        stage ('Hello Worl') {
            steps {
                echo  "Hello World"
            }
        }
        stage ('clone') {
            steps {
                checkout scm: [$class: 'GitSCM', 
                               branches: [[name: '*/master']], 
                               userRemoteConfigs: [[credentialsId: repo_credentials_id,url: 'http://example.com/test/test/_git/parent']]]
            }
        }
    }
}

and other repository is parent its Jenkinsfile is a simple like Hello world

parent Jenkinsfile:

pipeline {
    agent any
    stages {
        stage ('Hello Worl') {
            steps {
                echo  "Hello World"
            }
        }
    }
}

I use Azure DevOps as git source control and Jenkins as CI. To integrate Azure DevOps with Jenkins I use service hook in Azure DevOps and config it like this. In its config, I use "git trigger build" as trigger in Jenkins service hook in Azure DevOps. When I create a pull request in repository of parent, besides the parent job, the child job is also executed in Jenkins. How can update repository or create pull request in parent repository without building of child's job?

1

There are 1 best solutions below

1
Dibakar Aditya On

Please give it a try after disabling submodule configurations in your checkout step.

checkout scm: [$class: 'GitSCM', 
               branches: [[name: '*/master']],
               doGenerateSubmoduleConfigurations: false, 
               userRemoteConfigs: [[credentialsId: repo_credentials_id,url: 'http://example.com/test/test/_git/parent']]]