Multiple SCM plugin CANNOT track multiple revisions (i.e. branches or tags) on one repository?

50 views
Skip to first unread message

Chastina Li

unread,
Jun 9, 2016, 12:43:25 PM6/9/16
to Jenkins Users
I've been trying to get the Multiple SCM plugin to manage multiple repositories, each with default, qa and prod branches, on Mercurial. But there doesn't seem to be a way of tracking multiple branches from a single repository using one Multiple SCM task.
I've read through the official doc here and looked online but I can't find any information regarding whether this feature exists or not.
Is it possible to achieve multi-revision management using one SCM task through Jenkins? Or else I will have to "hg clone and checkout" all branches, which is a bit of a pain.
Thanks!

Craig Rodrigues

unread,
Jun 10, 2016, 3:54:06 AM6/10/16
to Jenkins Users
Hi,

If you feel that you need to use the Multiple SCMs plugin,
I would strongly encourage you *not* to use it.  The Multiple SCMs plugin was written
at a time when it was needed to overcome some limitations of the existing model of Jenkins jobs,
where it was only possible to have one SCM configured for one job.  It was never supported by the core Jenkins developers.  The Multiple SCMs plugin kind of works, and people do use it,
but it has limitations, and problems that people run into all the time.

If inside your job you feel you need to do "hg clone" or "hg update" operations, then explicitly
add those operations in your build steps.
It is not ideal, but it will get you going.

However, if I can encourage you to go in this direction, I would seriously
for you to learn pipeline ( https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Plugin ).

Pipeline is being actively worked on by the core Jenkins developers and is supported.
With Pipeline, you can check out from multiple repositories (even hg repositories), and do it in
a supported way.

You can get going with Pipeline by reading some of the documentation here: https://github.com/jenkinsci/pipeline-plugin#gettings-started

To give you some ideas, you could write a Pipeline that checkouts out from two hg repositories by doing something like:


node {
    stage "Checkout Python 3.5 source code"
    checkout([ $class: 'MercurialSCM', credentialsId: '', revision: '3.5', source
              'https://hg.python.org/cpython', subdir: 'directory1' ])
    
    stage "Checkout Python 2.7 source code"
    checkout([$class: 'MercurialSCM', credentialsId: '', revision: '2.7', source
              'https://hg.python.org/cpython', subdir: 'directory2'])

}


--
Craig


Reply all
Reply to author
Forward
0 new messages