patternyamlModerate
Is it possible to have multiple gitlab-ci files in a single repo?
Viewed 0 times
gitlabpossiblefilessinglemultiplehaverepo
Problem
I have a single repo handling integration tests for 4 different software projects. As those projects share common resources, I'd like to create a generic file in which all those common features are set properly for preparing the CI/CD job.
The project organization looks like the following:
From GitLab's documentation on the
The thing is, the documentation is unclear on whether it is possible to have multiple
So is it possible to have multiple gitlab-ci files in a single repo in one way or another? If not, is there a way for avoiding writing the same setup command lines four times?
The project organization looks like the following:
project_root:
> folder_1
> folder_2
> folder_3
> folder_4From GitLab's documentation on the
include keyword, I understand that it is possible to include a file that would handle the common features of all those projects so I don't have to write those command lines in the 4 differents gitlab-ci.yml. So I thought I could do the following:project_root:
common-features-handler.yml
> folder_1
gitlab-ci.yml
> folder_2
gitlab-ci.yml
> folder_3
gitlab-ci.yml
> folder_4
gitlab-ci.ymlThe thing is, the documentation is unclear on whether it is possible to have multiple
gitlab-ci.yml files in the same repo, regardless of them being in separate folders. It just says that this file should be "placed at the root of [the] repository", so I guess this, in itself, excludes the possibility of having several gitlab-ci.yml files in the same repo. I tried including the common-features-handler.yml file in the gitlab-ci.yml from folder_1 but the job didn't even launched. My guess is that, as it was not at the root of the project, it simply wasn't seen by the CI pipeline. This makes me think that it's not possible for one repo to handle several gitlab-ci files, but I couldn't find anything about it in the doc or online to confirm or infirm this hypothesis.So is it possible to have multiple gitlab-ci files in a single repo in one way or another? If not, is there a way for avoiding writing the same setup command lines four times?
Solution
No, you can't have multiple gitlab-ci files per repository.
You can see more information in the following links:
Now, there are some work in progress about this, but it's not available yet.
For example, you can see here that they are working on pipeline which can include other (complete) pipelines.
The
You can see more information in the following links:
- https://gitlab.com/gitlab-org/gitlab-foss/issues/18157
- https://gitlab.com/gitlab-org/gitlab-foss/issues/28592
Now, there are some work in progress about this, but it's not available yet.
For example, you can see here that they are working on pipeline which can include other (complete) pipelines.
The
include keyword is more about reducing the size of your main gitlab-ci file.Context
StackExchange DevOps Q#5669, answer score: 14
Revisions (0)
No revisions yet.