Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins: How do I check out two repository URLs into the same workspace without deleting the first one?

our project structure has been split. On the one hand there is the /plugins folder containing all main plugin projects. On the other hand we have a /tests folder containing all the fragment projects that are the unit tests for their corresponding main plugin projects.

Jenkins lets me check out multiple repositories, and even to the same folder in the workspace.

The problem is that the first checkout is deleted when the second URL is checked out.

/plugins is placed into the workspace directory, then the workspace directory is "cleaned":

Cleaning local Directory .

Then the second directory /tests is checked out.

Of course I want that both folder contents are placed in the same workspace directory. How can I do that?

like image 755
danowar Avatar asked Jan 30 '12 13:01

danowar


People also ask

Is there a way to checkout multiple repositories in Jenkins?

There is also a Jenkins Repo plugin that allows to checkout all or part of the repositories managed by git-repo to the same Jenkins job workspace. Thanks for contributing an answer to Stack Overflow!

How do I Checkout a specific Repository for each project?

create a different repository entry for each repository you need to checkout (main project or dependancy project. for each project, in the "advanced" menu (the second "advanced" menu, there are two buttons labeled "advanced" for each repository), find the "Local subdirectory for repo (optional)" textfield.

How can I have multiple repositories in a single job?

As a workaround, you can either have multiple upstream jobs which checkout a single repo each and then copy to your final project workspace (Problematic on a number of levels), or you can set up a shell scripting step which checks out each needed repo to the job workspace at build time.

What is a Git submodule in Jenkins?

A git submodule is creates a reference to the other repos. Those submodule repos are not cloned unless the you specify the --recursive flag when cloning the "superproject" (official term). We are using Jenkins v1.645 and the git SCM will out-of-the-box do a recursive clone for superprojects.


1 Answers

Assuming you're using Subversion to checkout your projects, you need to specify the "Local module directory" to something other than the default for each path you are checking out.

For example;

If you have svn://myrepo/myproject/plugins and svn://myrepo/myproject/tests, the configuration would be along the lines of;

Modules:
Repository URL : svn://myrepo/myproject/plugins
Local module directory (optional) : plugins

Repository URL : svn://myrepo/myproject/tests
Local module directory (optional) : tests

This would then inform Jenkins that it has two paths to checkout and into separate locations.

If you are trying to checkout a project into the subfolder of another working copy, you may have to use svn:externals on the parent directory.

like image 110
Toby Jackson Avatar answered Oct 01 '22 06:10

Toby Jackson