简体   繁体   中英

jenkins SCM checkout poll issue with multiple repo

I have a Jenkins job where I'm checking out 2 repos, The first repo "dev" contains src code and the Jenkinsfile and this repo is configured in Jenkins UI along with PollScm enabled. The second repo is "devops", I'm checking out this repo with sparse checkout in groovy script declarative pipeline.

        stage('Checkout DevopsScripts') {
        steps {
            script{
                dir('devops'){
                 def scmVar = checkout([$class: 'GitSCM', \
                    branches: [[name: '*/master']], \
                    doGenerateSubmoduleConfigurations: false, \
                    extensions: [[$class: 'SparseCheckoutPaths',  sparseCheckoutPaths:[[$class:'SparseCheckoutPath', path:'Scripts/testScript/']]]], \
                    submoduleCfg: [], \
                    userRemoteConfigs: [[credentialsId: 'XXXXXXX', url: "https://github.com/org/devops.git"]], \
                    poll: false, \
                    changelog: false
                    ])
                }
            }
        }
    }

Now I want PollScm to happen only for the commits happening in the "dev" repo, PollScm should ignore commits happening in "devops" repo. But even after enabling poll: false Jenkins job triggers on any commits happening in either repo. I have scrolled through the document "https://plugins.jenkins.io/workflow-scm-step/" which says "You may specify poll: false to disable polling for an SCM checkout" which is not happening in my case. Is there a bug in Jenkins related to this issue or I'm missing anything here.

This is a known bug in Jenkins that is unfixed as of 2022-11-23. See Jenkins-60757 on the bug tracker : '"poll: false" has no effect in scm (and git) pipeline steps'.

So, basically the poll: false flag doesn't work right now.

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