jenkins-gitlab-merge-request-builder-plugin icon indicating copy to clipboard operation
jenkins-gitlab-merge-request-builder-plugin copied to clipboard

how to configure for multiple projects

Open noelcapule opened this issue 8 years ago • 13 comments

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 avatar Nov 14 '15 17:11 noelcapule

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;

noelcapule avatar Nov 17 '15 20:11 noelcapule

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.

timols avatar Nov 19 '15 17:11 timols

we have 400+ projects that we maintain.

noelcapule avatar Nov 19 '15 18:11 noelcapule

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 avatar Nov 19 '15 21:11 noelcapule

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

noelcapule avatar Dec 01 '15 16:12 noelcapule

@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?

ajohnson-ventera avatar Dec 10 '15 17:12 ajohnson-ventera

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

noelcapule avatar Dec 10 '15 18:12 noelcapule

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.

ajohnson-ventera avatar Dec 10 '15 18:12 ajohnson-ventera

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

noelcapule avatar Dec 11 '15 15:12 noelcapule

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.

ajohnson-ventera avatar Dec 11 '15 16:12 ajohnson-ventera

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

noelcapule avatar Dec 11 '15 16:12 noelcapule

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.

ajohnson-ventera avatar Dec 11 '15 16:12 ajohnson-ventera

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:

  • http://myhost.com/gitlab/root/project1
  • http://myhost.com/gitlab/root/project2

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

  • Global settings: http://myhost.com/gitlab, Jenkins credentials
  • Jenkins job1: gitlab project path: root/project1

That works fine :ok_hand:

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

  • Jenkins job 2: gitlab project path: root/project2 (git repository accordingly)

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!

pazoozooCH avatar Dec 18 '15 20:12 pazoozooCH