Home > Software engineering >  One SCM poll for multiple jobs to improve performance
One SCM poll for multiple jobs to improve performance

Time:01-26

Is it possible to have Jenkins retrieve the code from SCM (Subversion in my case) periodically and all the jobs using this updated code instead of re-polling themselves every time they run ?

Thank you

CodePudding user response:

Here's one way to achieve it:

Lets say you have 4 jobs: A,B,C,D.

Job A's configuration:

  • Source Code Management configured with SVN repo details.
  • Build Triggers set as Poll SCM.
  • Post-build Actions configured to build jobs B,C,D.

Jobs B,C,D configuration:

  • Source Code Management set as None.
  • No Build Triggers set.
  • Code from job A's workspace is used in the build steps.

Here job A periodically polls SCM for changes. When changes are detected, it pulls latest code from SCM and builds. Post build, it triggers jobs B,C,D.
Since jobs B,C,D are configured to use code from job A's workspace, they use the same code that was recently pulled by job A.

CodePudding user response:

I'm not sure, if jenkins has such a build in feature. But even if it has, I think the polling from jenkins side is always just the second best solution. Better try to notify jenkins about SCM changes and let jenkins decide which jobs to build. You just have to call the "notifyCommit" URL of jenkins. See https://plugins.jenkins.io/subversion/ for details.

  •  Tags:  
  • Related