title: Jenkins PollScm for specific repository
body: <p>I want to build a project using two Git repositories. One of them contains the source code, while the other has the build and deployment scripts.</p>
  <p>I am using Jenkins pipeline for building my project. The pipeline scripts are in <strong>Jenkins-pipeline</strong> repository and the Source code in <strong>middleware</strong> repository. As my pipeline scripts are in Jenkins-pipeline repository I am configuring my pipeline with the Jenkinsfile from Jenkins-pipeline repository.</p>
  <p>Here is the Jenkins file I am using:</p>
  <pre><code>pipeline {
  agent any
  parameters {
      string(name: 'repo_branch', defaultValue: 'development', description: 'The branch to be checked out')
      string(name: 'git_repo',  defaultValue: 'ssh://git@my-server.com/middleware.git' description: 'Git repository from where we are going to checkout the code')
  
  }
  options {
  
      buildDiscarder(logRotator(numToKeepStr: '5'))
      disableConcurrentBuilds()
      timeout(time: 10, unit: 'MINUTES')
  }
  triggers {
      pollSCM('* * * * *')
  }
  stages {
      stage('Checkout git repo') {
          steps {
              git branch: &quot;${params.repo_branch}&quot;, url: &quot;${params.git_repo}&quot;, credentialsId: 'git-credentials'
          }
      }
      stage('Build binary') {
          steps {
              sh &quot;./gradlew clean build -x test&quot;
          }
      }
  }
  }
  </code></pre>
  <p>Now, as we can see, the repository I am cloning in the Jenkinsfile is different and the repository where I am keeping my jenkinsfile is different.</p>
  <p><strong>Now the issue here is:</strong><br />
  In Jenkins file, I am using <strong>pollScm to trigger</strong> my Jenkins job whenever there is a new commit in the repository but I have two repositories that I have configured for the job so</p>
  <ol>
  <li>Source Code Repository (middleware.git)</li>
  <li>Pipeline Script Repository (Jenkins-pipeline.git)</li>
  </ol>
  <p>So whenever there is a commit in either of these repositories my Jenkins job is getting triggered, which I don't want! <strong>I want to trigger My Jenkins build only when there is new commit in my Source code repository and should NOT trigger the build when there is commit in Jenkins-pipeline repositories.</strong> How do I do that?</p>
  <h3>Update</h3>
  <p>I am using shared libraries in the Jenkinsfile and these libraries are also in another repository. When I am committing something in shared library repository then also Jenkins jobs are getting triggered and I am using a shared library in multiple jobs so because of that all the jobs are getting triggered which I don't want.</p>
  <p>P.S. I can't use the webhooks to trigger my Jenkins build because of my Jenkins is in private network!</p>