timols / jenkins-gitlab-merge-request-builder-plugin

A plugin that allows jenkins to build merge requests in Gitlab
Other
345 stars 127 forks source link

how to configure for multiple projects #156

Open noelcapule opened 9 years ago

noelcapule commented 9 years ago

Hi,

I followed the installation and creating a job on jenkins for the merge request builder plugin. For one repo/project it is triggering the build on jenkins. My question now, is how can i configure so that it will be able to handle multiple repos/projects? In jenkins project configuration, if "Gitlab Project Path" is hard coded eg. "group/project" then jenkins build will trigger fine. I am thinking that the "Gitlab Project Path" field can take a variable so that it can handle multiple repo/projects. So I tried using the variable ${gitlabSourceName}, however, with using this string the build will not trigger at all. Am I missing something? Please advice - Thanks

noelcapule commented 8 years ago

I'm not a java expert, but I am looking at the GitlabBuildTrigger.java, i wonder if the variable below needs to be initialized differently so that it will take a variable as an input?

private final String projectPath;

timols commented 8 years ago

How many projects are you looking to have this run on? Generally this plugin is designed to run on a single project, so if you wanted multiple projects, you'd have multiple builds.

noelcapule commented 8 years ago

we have 400+ projects that we maintain.

noelcapule commented 8 years ago

Hi Tim, Is there a way to run this with a number of projects or how much effort is it to update the code to make it work with a bunch of projects? thx, noel

noelcapule commented 8 years ago

Hi Tim, Just checking if you have any thoughts on this? thx, Noel

ajohnson-ventera commented 8 years ago

@noelcapule I'm not sure I understand your configuration. You want to set up ONE jenkins project to build all of your 400+ gitlab projects?

noelcapule commented 8 years ago

yes, that is correct. One jenkins under source code management we are planning to use the Gerrit repo to get the manifest.

ajohnson-ventera commented 8 years ago

I'm not sure Jenkins was ever intended to do something like that, at least I've never heard of anyone doing it.

I'm not sure if something exists, but maybe you should look for some kind of automatic project creator? Something that digests your repos or this 'manifest' and creates a Jenkins project for each one.

The only other thing I can think of, to use only one Jenkins project, is to write a custom script that will invoke all the Git Fetches and run the builds.

noelcapule commented 8 years ago

Gitlab has a multi-project option that will automatically create a project on jenkins, However, this works nicely for a specific repo/project. I think it would benefit if there is a way to pass a project variable such as ${gitlabSourceRepository} so that jenkins will be able to recognize this if we plug this variable in the repository URL under the jenkins configuration

ajohnson-ventera commented 8 years ago

Can you provide a link to a tutorial or something that I can understand what you are talking about? I have no idea how you are creating a 'multi-project' in gitlab.

noelcapule commented 8 years ago

http://doc.gitlab.com/ee/integration/jenkins.html This requires the gitlab hook plugin into jenkins

ajohnson-ventera commented 8 years ago

I don't think this does what you are implying. What this does is create a new Jenkins project for each feature branch of a repo, instead of using the same project to build for each feature branch.

pazoozooCH commented 8 years ago

I'm not quite sure if I'm getting this correctly:

I have multiple (well, let's say 2 for this sample) git repositories on the same host, say:

I've set up a gitlab-merge-request-builder job for project 1 as follows:

That works fine :ok_hand:

Now I was adding a second job for the second project:

I can successfully trigger a build manually (by providing appropriate values for the placeholder parameters). BUT, the job never gets triggered, no matter how many merge requests I create. job1 continues to work.

Is this a limitation of the plugin or is there something wrong???

Thanks for a clarification!