0

I have a Jenkinsfile pipeline configured and a multibranch pipeline pointed to a git repository, (A). In the same Jenkinsfile I pull down code from git repository, (B) to perform some independent steps.

I would like to have jenkins poll the A repo - and whenever it finds a change - build it. This is working.

However, it is also polling repo B. Whenever a change occurs in repo B (which is often) it picks up the change and starts a build.

How can I turn off polling from for this other repo? Thanks

||||||
1

I guess this is a known issue. https://issues.jenkins-ci.org/browse/JENKINS-38508

||||||
  • In my case I found that I could get around the issue by properly cleaning out my workspace at the end of the build process. Since there was nothing to compare to, the secondary repo, B, could detect no change. Used step([$class: 'WsCleanup']) to clean up. – FuriousD Mar 15 '17 at 14:31
1

Using the pipeline syntax snippet generator in Jenkins I come up with this:

checkout poll: false, scm: [$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[]]]
||||||
  • For checking out repo A, I'm using checkout scm. For checking out repo B, i'm using git branch: 'production', credentialsId: '00000000-0000-0000-0000-00000000', url: 'git@host:repo.git' I don't suppose I could use the poll option with 'git branch'. Perhaps I'm doing it wrong by pulling repo B with the git command? – FuriousD Mar 13 '17 at 19:15
  • I switched from the git branch command to checkout scm like you suggested (including poll: false,) but it's still triggering commits when the second repo (B) has a commit. – FuriousD Mar 13 '17 at 21:08
  • Could it be a solution that you try to find out from inside the Pipeline script which repository triggered the build, and then just abort the build in case it was the wrong one? – Thomas Hirsch May 11 '17 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.