SCM Plugins / Multiple instances

40 views
Skip to first unread message

markus...@neulion.com

unread,
Jan 25, 2018, 12:19:21 PM1/25/18
to go-cd
Hi,

i am currently considering to write a GoCD scm plugin to track a number of company specific projects, that can otherwise not easily be mapped using the existing SCM plugins due to nested directory structure.
I am encountering one problem however, which seems to be that the Material settings always seem to be global for the full server, while i probably want to track multiple different projects of same style.
So before going forward i wonder if it is possible at all to use an SCM plugin such that each pipeline can have its own settings?

I see that there is i.e. one plugin to follow GitHub pull requests for a certain repository, but does that mean one server can at maximum follow one GitHub project, or can a single SCM plugin be instantiated multiple times with different parameters on one server?


Thanks,

Markus Kramer


Aravind SV

unread,
Jan 25, 2018, 12:39:32 PM1/25/18
to go...@googlegroups.com
Hello Markus,


On Thu, Jan 25, 2018 at 12:19 PM, <markus...@neulion.com> wrote:
I see that there is i.e. one plugin to follow GitHub pull requests for a certain repository, but does that mean one server can at maximum follow one GitHub project, or can a single SCM plugin be instantiated multiple times with different parameters on one server?

Yes, it is definitely possible for a pluggable SCM to be associated with multiple pipelines and even have one pipeline be associated with multiple pluggable SCM materials. Anything you can do with a normal git material should be possible to be done with an SCM plugin.

They're stored at a global level, though, unlike a git material which (in the config) is at a pipeline level. That is misleading because GoCD will continue to treat even those git materials as global internally, so that it doesn't poll the same repositories multiple times.

There are some SCM plugins which might be interesting to you, such as the git-path-material-plugin. To use as-is or as a skeleton for your plugin.

Feel free to ask questions here or in the gitter channel, if you get stuck.

Cheers,
Aravind

Markus Kramer

unread,
Jan 25, 2018, 1:09:51 PM1/25/18
to go...@googlegroups.com
Hi Aravind,

thanks for your reply, however i am not sure it answers all points of my question yet. What we would like to do is pretty much implement one plugin which is preferably also only loaded once and then run this
around 60 to 70 different product base URLs from around the same number of pipelines. So each pipeline should only contain one project, but the methodology applied to construct their working copies, get change information etc is always the same.
So lets assume i have a SCM plugin working properly for a single project at one base url,  is there a way to easily setup the same plugin to run against a second project base URL in a completely different pipeline without affecting the other, or would this mean to really compile and load the same plugin several times with different IDs.

Thanks,

Markus





--
You received this message because you are subscribed to a topic in the Google Groups "go-cd" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/go-cd/oK75CJB4laM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to go-cd+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aravind SV

unread,
Jan 26, 2018, 11:15:30 AM1/26/18
to go...@googlegroups.com
Maybe it's easiest to explain what I'm thinking using a config example (see below). Ideally, you'd just have one plugin and multiple SCM materials defined.

<cruise ...>
  <scms>

    <scm id="AAAA" name="proj_a">
      <pluginConfiguration id="X" version="1" />
      <configuration>
        <property>
          <key>BASE_URL</key>
          <value>/path/to/project_a</value>
        </property>
      </configuration>
    </scm>

    <scm id="BBBB" name="proj_b">
      <pluginConfiguration id="X" version="1" />
      <configuration>
        <property>
          <key>BASE_URL</key>
          <value>/path/to/project_b</value>
        </property>
      </configuration>
    </scm>

  </scms>

  <pipelines>
    <pipeline name="my_project_a">
      <materials>
        <scm ref="AAAA" />
        <git url="abcd" .../>
      </materials>
    </pipeline>

    <pipeline name="my_project_b">
      <materials>
        <scm ref="BBBB" />
      </materials>
    </pipeline>

    <pipeline name="my_combined_project">
      <materials>
        <scm ref="AAAA" />
        <scm ref="BBBB" />
      </materials>
    </pipeline>
  </pipelines>
</cruise>

As you can see, you define SCM materials with their pluginConfiguration set to your plugin ID. Then, you can use those SCM materials in pipelines however you like. The configuration is completely controlled by the plugin. In the above example, I chose to show it as BASE_URL. You can have any keys you want.

Since there is only one plugin, it loads once on the server and once on every agent.

Hope that helps,
Aravind


To unsubscribe from this group and all its topics, send an email to go-cd+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go-cd+unsubscribe@googlegroups.com.

Aravind SV

unread,
Jan 26, 2018, 11:16:37 AM1/26/18
to go...@googlegroups.com
The "scm" tag is a definition of your SCM material. It's not a description of the plugin. There can be multiple SCM material definitions per plugin.
Reply all
Reply to author
Forward
0 new messages