Sub-projects (applications) within a single gitlab project

Hi all,

I have a question regarding GItlab CI setup. As per the documentation, it states that the “.gitlab-ci.yml” file should need to be in the root folder of the repository. But my project setup is such that I have a root folder which internally contains 5 sub-projects (APIs projects, UIs, backend services etc). Each of these sub-projects have their own root folder. I want these sub-projects to be individually build and deploy based on the changes I make in them. In other words, each of these sub-projects should need to have its own CI/CD pipeline, which indirectly means i need to have a separate “.gitlab-ci.yml” file for each one of them.

So my question is how can I handle this requirement? I can’t have a single .gitlab-ci.yml file placed in the parent folder and build and deploy sub-projects individually? Is there any possibility to handle this other than setting up individual gitlab projects for each of these sub-projects?

Thanks.

2 Likes

any update?!

+1 would like to know how to go about this.

You might be able to hack some stuff with the only and except parameters: https://docs.gitlab.com/ee/ci/yaml/#only-and-except-simplified It will require some getting used to, to include specific comments in your commits, but it’s the closest option I sees at the moment.

Assuming I’m understanding the question properly…

Could you make your “sub-projects” each there own projects. That way each “sub-project” has its own gitlab-ci.yaml. You can do sub builds/ci/cd on each project that way.

Then use gitlab submodules to pull in each “sub-project” into the parent project. That parent project would have a master gitlab-ci.yaml that does a integration build/ci/cd. (I do something similar with 3rd party source. I have my project pull in all those other projects, many of which has their own pipelines independent of my project.)

Check out this link if you this this approach might help you…

https://docs.gitlab.com/ee/ci/git_submodules.html