Skip to content

"include" keyword to support relative paths to external

The include keyword is really helpful for moving generic part of the .gitlab-ci.yml out of it, but only support local file (in the same git project) or public remote (https). It also does not allow http connection if the gitlab server is on https.

It would be really really helpful to have git submodules supported (for the moment, if the common.yml file in is a submodule of my project (to be commonalized accross several projects), it is not seen by the CI parser.

Or a better option would be to define a relative path to the common.yml file, just like we do for submodule:

include: ../common_project/common.yml

Where common.yml is a file in the root folder of another git project common_project in the same group than the current project.

The initial .. would mean "we go out of the root folder of this git project, this means we are on the group so we need to fetch from a file stored in another git project". This would also use the same creds than the one on the current project to disallow importing a file we do not have permission on.

Of course multi level up can work as well:

include: ../../common_group/common_project/common.yml

Version and branching freeze can be done using the @branch or @sha postfix, like we do for pip install. Or use the blob/branchname/common.yml part of the File API.

Edited by Gaetan Semet