Answers: <p>I would be inclined to use <a href="https://jenkins.io/blog/2019/05/09/templating-engine/" rel="nofollow noreferrer">Pipeline Templating</a> as this gives you the ability to define standard templates centrally but leave the SCM field to be defined by the individual job.</p>
  
  <blockquote>
    <p>Leveraging templates in this way lets you separate the business logic (what should happen when) of your pipeline from the technical implementation (what’s actually going to happen). The result of this is a CI/CD pipeline that’s proven to be significantly easier to manage when supporting multiple teams simultaneously.</p>
  </blockquote>
  
  <p>I recommend that you <strong>do not</strong> have a single pipeline for all repositories as that is going to make it very hard to tell which repository is failing or slow via dashboards and alerts.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-11-13T10:36:55.647Z
Answers: 2019-11-13T10:36:55.647Z
Answers: Richard Slater
Answers: <p>I use <a href="https://jenkins.io/doc/book/pipeline/shared-libraries/" rel="nofollow noreferrer">Pipeline Shared Libraries</a> to share a single build pipeline across roughly 180 different repositories.</p>
  
  <p>The pipeline itself is defined in a function in the shared library, and the Jenkinsfile for all of the repos is just a one-liner that calls that function.</p>
  
  <p>There's also an example of how to share a build pipeline using shared libraries <a href="https://jenkins.io/blog/2017/10/02/pipeline-templates-with-shared-libraries/" rel="nofollow noreferrer">in an official Jenkins blog post</a>.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-11-18T18:55:16.337Z
Answers: 2019-11-18T18:55:16.337Z
Answers: jayhendren
Body: <p>I've been looking around to see how to have ~10 different repos all on a git push trigger a single pipeline that does pretty much the same exact thing - build a docker image -except that the different repo names will be used for the docker image repo and the specific git commit will be the tag.</p>
  
  <p>Is this possible or do I have to break it down into multiple pipelines? Ideally I would be able to have one that queues jobs when multiple pushes happen in a short period of time. </p>
  
Tags: <docker><jenkins><continuous-integration><jenkins-pipeline>
Title: Jenkins triggered by multiple git repos
UserDisplayName: joshk132
ThreadText: # Jenkins triggered by multiple git repos
  
  (Asked by: username_0 on 2019-11-13)
  
  I've been looking around to see how to have ~10 different repos all on a git push trigger a single pipeline that does pretty much the same exact thing - build a docker image -except that the different repo names will be used for the docker image repo and the specific git commit will be the tag.
  
  Is this possible or do I have to break it down into multiple pipelines? Ideally I would be able to have one that queues jobs when multiple pushes happen in a short period of time.
  
  **Tags:** docker, jenkins, continuous-integration, jenkins-pipeline
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-11-13. Score: 1
  
  I would be inclined to use [Pipeline Templating](https://jenkins.io/blog/2019/05/09/templating-engine/) as this gives you the ability to define standard templates centrally but leave the SCM field to be defined by the individual job.
  
  > Leveraging templates in this way lets you separate the business logic (what should happen when) of your pipeline from the technical implementation (what’s actually going to happen). The result of this is a CI/CD pipeline that’s proven to be significantly easier to manage when supporting multiple teams simultaneously.
  
  I recommend that you **do not** have a single pipeline for all repositories as that is going to make it very hard to tell which repository is failing or slow via dashboards and alerts.
  
  
  ---
  
  ### Answer by username_2 on 2019-11-18. Score: 0
  
  I use [Pipeline Shared Libraries](https://jenkins.io/doc/book/pipeline/shared-libraries/) to share a single build pipeline across roughly 180 different repositories.
  
  The pipeline itself is defined in a function in the shared library, and the Jenkinsfile for all of the repos is just a one-liner that calls that function.
  
  There's also an example of how to share a build pipeline using shared libraries [in an official Jenkins blog post](https://jenkins.io/blog/2017/10/02/pipeline-templates-with-shared-libraries/).
  
  
  ---
  
  