Eduardo Lima
Eduardo Lima

Reputation: 153

How to manage multiple repositories in a build inside TeamCity?

I was assigned to implement a CI / CD process (Using TeamCity) in a project in my company.

The point is that the project is distributed in different repositories (One for the framework, one for the base application and two for project-specific issues)

If I were to assemble this project now, I should first clone the framework, then clone the other repositories and manually move them to their proper folders.

The project in its "final form" has a folder structure similar to this:

BigProject/
├── Framework (Repository)/
│   ├── bin/
│   ├── obj/
│   ├── Application/
│        ├── BaseApplication (Repository)/
│            ├── Foo/
│            ├── Bar/
│            ├── Project-Specific-1 (Respository)/
│            ├── Project-Specific-2 (Respository)/

In TeamCity, I set up all VCS Roots for the four repositories and edited the Checkout Rules to make it all work.

For example, I set the Checkout Rule of my BaseApplication to look like this:

+:.=>./Framework/Application/

As I understand it, this command should copy all contents of the BaseApplication repository to the directory ./Framework/Application/ .

The problem is that when I run the build I get the following error:

stderr: The 'https: //me@myvcs.com/xx/xx/BaseApplication.git' repository has a submodule in the 'xx' commit to the 'Project-Specific-1' path, but has not .gitmodules configuration in the root directory
exit code: 1

I do not understand why this error is happening. Did I go wrong setting up Checkout Rules? Is TeamCity trying to build the project before doing the necessary checkouts? Does anyone have any suggestions on how I can make this work?

A note, I cannot configure .gitmodules for this project because I believe that .gitmodules should be in the framework repository and the framework is used in other projects.

Thanks in advance!

Upvotes: 2

Views: 1489

Answers (1)

Christian Schyma
Christian Schyma

Reputation: 309

You are trying to checkout a repository within another repositories structure. Git itself is complaining about this and not TeamCity. You could change the general directory structure so that the application isn't inside the framework anymore.

BigProject/
├── Framework (Repository)/
│   ├── bin/
│   ├── obj/
├── BaseApplication (Repository)/
│   ├── Foo/
│   ├── Bar/
├── Project-Specific-1 (Respository)/
├── Project-Specific-2 (Respository)/

Upvotes: 2

Related Questions