Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Hudson and build steps with multiple git repositories

I'm trying out Hudson to replace our current Buildbot setup. I installed the git plugin. Our current setup is like:

ssh://server:/repo/test_framework.git
ssh://server:/repo/project_a.git

Now, to build project_a I added a new job with multiple git repositories (the ones above). I wanted Hudson to clone the repositories into different directories under $WORKSPACE, becase test_framework needs that hierarchy. But Hudson seems to merge everything into $WORKSPACE instead. From the console log:

warning: no common commits
...
[workspace] $ git merge-base ce14a4579e87971659e5e0469136713847055a29 96d2b3c27595de243702414c4358366923696d78
[workspace] $ git merge-base ce14a4579e87971659e5e0469136713847055a29 5bb011b3fa288afd5e4392640b32b8bcc982103e
[workspace] $ git merge-base ce14a4579e87971659e5e0469136713847055a29 aa6ade81669883909ba5f5459a205df1bd0df3c0

Can I configure this in Hudson to better fit our project setup? Do I need to create a local dummy git repository with every project as git submodules or something?

like image 430
pojo Avatar asked Nov 27 '09 13:11

pojo


People also ask

Can I have multiple Git repositories?

With Git, using multiple repositories is the only way to work efficiently. This enables each team to work independently, and do their work faster. You can also make sure that developers only have access to the repositories they need access to (thus making Git more secure.)

Can we use multiple Git repos in a single Jenkins job?

Checking out more than one repo at a time in a single workspace is possible with Jenkins + Git Plugin (maybe only in more recent versions?). In section "Source-Code-Management", do not select "Git", but "Multiple SCMs" and add several git repositories.


1 Answers

Within Hudson you can chain multiple jobs together. You could try creating separate Hudson jobs for test_framework and another for project_a. Hudson creates a separate directory in $WORKSPACE for each job, so now you should have two different directories under $WORKSPACE.


Setup Chaining

In the job configuration of project_a scroll down to Post-build actions and check Build other projects... Enter in test_framework as the project to build.

In the job configuration of test_framework ensure that Poll SCM is unchecked and that Build after other projects is set to project_a.


How it works

What you have now configured is project_a will poll the SCM looking for changes, when changes are found it will pull them from git. Run build steps (if any) and on completion trigger the test_framework job to pull changes from git (if any) and run its build steps.

like image 82
Clinton Avatar answered Sep 18 '22 05:09

Clinton