Running multiple gitlab-ci files

We’re writing several .NET Core templates (webapp, class library, etc), that allow us to generate a project quickly. Part of this includes packaging a default .gitlab-ci.yml file that does the build and package steps for the project.

The folder structure looks like this:

\
	.gitlab-ci.yml
	\class-library
		\content
			.gitlab-ci.yml
	\api-service
		\content
			.gitlab-ci.yml
	\\ etc.

Each templates’ .gitlab-ci.yml file contains steps with the same name.

Is there a way I can “execute” the “build” step of each individual template within the top-level .gitlab-ci.yml? The examples I can see about including files seem to bring in the full step names, which will conflict (as there wil be multiple steps).

I’ve tried including the files directly, but because there are multiple build steps, only one gets included (if they conflict with the same name in the root file, then none get included).

Hi,

you can use parent child pipeline.

You need a .gitlabci.yml file in each directory like your example, and your “parent” .gitlabci.yml must contain this :

stages:
- triggers

class-library :
stage: triggers
trigger:
include: class-library/content/.gitlab-ci.yml
rules:
- changes:
- class-library/content/*

api-service :
stage: triggers
trigger:
include: api-service/content/.gitlab-ci.yml
rules:
- changes:
- api-service/content/*