I would like to have all my dockerfiles in one repository, instead of
having them in the seperate projects. Therefore I have created the
project "conductor". All my .gitlab-ci stages are also specified in
"conductor". In the actual project I only use the include command.
It looks like a good usecase to define the generic stage/template in the common repository and to to include them in the users repositories via the include keyword.
Look at the include documentation :
include
Use the include keyword to include external YAML files in your CI/CD
configuration. You can break down one long gitlab-ci.yml into multiple
files to increase readability, or reduce duplication of the same
configuration in multiple places.
From user git repositories you could include the common template in the .gitlab-ci.yml such as :
include:
- project: 'my-group/my-common-project'
file: '/templates/.gitlab-ci-docker-build-template.yml'
And of course, reference the common stage(s) you need to use in it.
Note that the common templates are not ridid. User/consummer repositories may override some things. For example variables are overridable.
-f /path/to/dockerfile?