5

We have a project with two subprojects in the same SVN repository. For example:

svn://ip/svn/ trunk/subproject1
svn://ip/svn/ trunk/subproject2

The build for project should include results of builds of both subprojects. To make our build faster, I want to run build of subproject1 only if SVN was changed respectively (in the svn://ip/svn/ trunk/subproject1). Similarly for subproject2

What is the best way to do it? Can I do it with a single job? How should I define build triggers in this case?

Or I need to define 3 jobs: one for each subproject or one for each project?

Any help will be appreciated! Best regards, Michael

Michael
  • 10,063
  • 18
  • 65
  • 104

4 Answers4

9

There are various ways you can achieve this using Jenkins.

  1. The multi-SCM plugin will allow - as the name suggests - to include multiple source repositories in a single job.

  2. You can define n jobs which trigger each other (i.e. have a dependency on each other). You can find this under Build Triggers > Build after other projects are built.

  3. There is also the option of a master job controlling the downstream jobs. You'll find this option under Post-build Actions > Build other projects.

With regard to build triggering, you can use the poll SCM option. It's not the most efficient method but your options may be limited with SVN rather than Git.

I just noticed you also mentioned collating results from all builds - you can achieve this either by having a single job or by using the option aggregate downstream test results under Post-build Actions.

Ultimately, you need to be clear on your build strategy. It sounds to me that you want to ensure that nothing is broken if a change has been made to either sub-project. I'm not sure how well the multi-SCM plugin copes with the concept of polling multiple repositories so you may need to factor that in.

I think I've given you a few options to try out; let me know how you get on.

ben.snape
  • 1,495
  • 10
  • 21
  • I have asked the additional question http://stackoverflow.com/questions/15122977/jenkins-conditional-trigger-on-the-build-step – Michael Feb 27 '13 at 21:42
  • "options may be limited with SVN rather than Git" - despite its other limitations, Subversion, does have a decent system for hooks, and Jenkins can be triggered from the `post-commit` hook on the repo server. – Robert Fleming Sep 20 '19 at 21:46
2

This is an old thread (18 months) but a few days ago the Jenkins multijob plugin has released a new version that incorporates an option that allows triggering a build only when scm changed since last build:

This is the Build only if SCM changes.

There is also an option to force the build regardless of this option.

1

There is also a Multijob Plugin available for Jenkins. You can use it to run your sub project builds hierarchically in one main project.

Mikko Koho
  • 754
  • 6
  • 14
0

I have no idea about how to set with SVN, but with GIT you can set Additional Behaviours on Source Code Management step.

Choose Polling ignores commits in certain paths, then set the Included Regions. This setting can filter other sub project commits within the same git repository.

Also do setting on Build Triggers step, tick Poll SCM and leave Schedule blank.

If want to set auto deployment, you may need to set web hook on git repository side.

Jenkins version is 2.32 and Jenkins Git plugins

lily LIU
  • 119
  • 1
  • 5