I have three subprojects (Angular and Node.js) in the same GitLab project. Now I want to create the gitlab-ci.yml file for building and deploying one of this subprojects. Can I create three different gitlab-ci.yml files and run them inside subdirectories? Is it possible? Or should I push those into three different projects?
Asked
Active
Viewed 1.2k times
9
Peter Mortensen
- 30,738
- 21
- 105
- 131
Tharindu Lakshan
- 3,995
- 6
- 24
- 44
1 Answers
15
My personal preference is to keep projects small. So I usually create one GitLab project per, e.g., module, library, program, design, etc.
But if you really wanted to, you could easily either:
Create a single
.gitlab-ci.ymlthat goes something like:my_job: stage: test script: - | cd "$CI_PROJECT_DIR/folder1" < do stuff > cd "$CI_PROJECT_DIR/folder2" < do stuff> ...Create multiple gitlab-ci configurations inside the folders and include them in the root .gitlab-ci.yml file
include: - 'folder1/pipeline.yml' - 'folder2/pipeline.yml'
Note that when using the second option, you will still have to cd folderX since pipelines always start in the repository's root directory, no matter from where they are imported.
Peter Mortensen
- 30,738
- 21
- 105
- 131
uupascal
- 531
- 4
- 6
-
Great touch with `include` feature! – Kostanos Mar 16 '23 at 14:07
